home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / LNotificationTask / LNotificationTask.h < prev    next >
Encoding:
Text File  |  1995-08-27  |  3.0 KB  |  99 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    LNotificationTask.h                © 1995, Éric Forget. All rights reserved.
  3. // ===========================================================================
  4. //    
  5. //    ************************************************************************
  6. //    *                                                                      *
  7. //    *    Before using this code you should read the "License Agreement"     *
  8. //    *    document and agree with it.                                        *
  9. //    *                                                                      *
  10. //    ************************************************************************
  11. //
  12. //    Instruction and usage notes are in the LNotificationTask.cp file.
  13. //
  14. // ---------------------------------------------------------------------------
  15.  
  16.  
  17. #pragma once
  18.  
  19. #ifndef __NOTIFICATION__
  20. #include    <Notification.h>
  21. #endif    // __NOTIFICATION__
  22.  
  23. #include    "LTask.h"
  24. #include    <LPeriodical.h>
  25.  
  26.  
  27. class LNotificationTask;
  28.  
  29.  
  30. // ---------------------------------------------------------------------------
  31. //        • Structure SVBLTaskT
  32. // ---------------------------------------------------------------------------
  33.  
  34. struct    SNoteTaskT {
  35.  
  36.     NMRec                    task;
  37. #if !GENERATINGCFM
  38.     Int32                    A5World;
  39. #endif
  40.     LNotificationTask        *noteTask;
  41. };
  42.  
  43.  
  44. // ---------------------------------------------------------------------------
  45. //        • Class LNotificationTask
  46. // ---------------------------------------------------------------------------
  47.  
  48. class LNotificationTask :    public LTask,
  49.                             public LPeriodical {
  50.  
  51. private:
  52.                                 LNotificationTask() {}    // Impossible constructor!
  53. public:
  54.                                 LNotificationTask(StringPtr    inDescriptor,
  55.                                         ResIDT    inStringID = 0,
  56.                                         ResIDT    inIconFamilyID = -1,
  57.                                         Handle    inSoundH = (Handle)-1L,
  58.                                         Int16    inMark = 1,
  59.                                         Boolean inDeleteOnCompletion = true);
  60.     virtual                        ~LNotificationTask();
  61.     
  62.     void                        SetIndString(ResIDT    inStringListID,
  63.                                         ResIDT    inStringIndex)
  64.                                 {
  65.                                     ::GetIndString(mDescriptor, inStringListID, inStringIndex);
  66.                                     mNoteTask.task.nmStr = mDescriptor[0] ? mDescriptor : nil;
  67.                                 }
  68.     void                        SetIconFamily(ResIDT inIconFamilyID)
  69.                                 {
  70.                                     ::GetIconSuite(&mNoteTask.task.nmIcon, inIconFamilyID, svAllSmallData);
  71.                                 }
  72.     void                        SetSoundHandle(Handle inSoundH)
  73.                                 {
  74.                                     mNoteTask.task.nmSound = inSoundH;
  75.                                 }
  76.     void                        SetSound(ResIDT inSoundID)
  77.                                 {
  78.                                     mNoteTask.task.nmSound = ::GetResource('snd ', inSoundID);
  79.                                 }
  80.     virtual void                StartTask();
  81.     virtual void                StopTask();
  82.     virtual void                SpendTime(const EventRecord &inMacEvent);
  83.     
  84. protected:
  85.     static NMUPP                sTaskUPP;
  86.     Str255                        mDescriptor;
  87.     SNoteTaskT                    mNoteTask;
  88.     Boolean                        mUserHasSeenNote;
  89.     ProcessSerialNumber            mApplicationPSN;
  90.     
  91.         
  92.     static pascal void            TaskUPP(SNoteTaskT *inNoteTaskPtr);
  93.     virtual void                ContinueTask();
  94.     
  95.     virtual void                StartTaskSelf();
  96.     virtual void                ExecuteTaskSelf(Boolean &ioLastCall);
  97.     virtual void                StopTaskSelf();
  98. };
  99.