home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 March / SOFM_Mar1995.bin / pc / os2 / rme101 / rmndclas.h < prev    next >
Text File  |  1995-01-27  |  6KB  |  123 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Reminder Item Class - Class Definition and misc macro definitions
  4. //
  5. // Written By Eric A. Wolf
  6. // Copyright (C) 1995 - All Rights Reserved
  7. //
  8. ////////////////////////////////////////////////////////////////////////////////
  9. #ifndef REMINDER_CLASS_H
  10. #define REMINDER_CLASS_H
  11.  
  12.  
  13. ////////////////////////////////////////////////////////////////////////////////
  14. // external function declared in the .cpp portion of class
  15. ////////////////////////////////////////////////////////////////////////////////
  16. void setItem( char **, char * );
  17.  
  18.  
  19. ////////////////////////////////////////////////////////////////////////////////
  20. // ReminderItem Class - each calendar entry is stored as instance of this class
  21. ////////////////////////////////////////////////////////////////////////////////
  22. class ReminderItem
  23. {
  24. public:
  25.     // constructor/destructor
  26.     ReminderItem( char, char, char, char, char, short, char, char, char, char,
  27.                   char, char, char, char*, char* );
  28.     ~ReminderItem();
  29.  
  30.     // get members
  31.     char getMonth()                   { return month; }
  32.     char getDay()                     { return day; }
  33.     char getHour()                    { return hour; }
  34.     char getMinute()                  { return minute; }
  35.     char getToDo()                    { return todoItem; }
  36.     char getItemDone()                { return itemDone; }
  37.     char getReminder()                { return flashReminder; }
  38.     char getReminderType()            { return flashType; }
  39.     char getNumToShow()               { return numDaysToShow; }
  40.     char getMinBefore()               { return minBefore; }
  41.     char getMinsBefore()              { return minsBefore; }
  42.     char getDaysBefore()              { return daysBefore; }
  43.     char *getText()                   { return itemText; }
  44.     char *getSoundFile()              { return soundFile; }
  45.     unsigned int getYear()            { return year; }
  46.     unsigned int getTimeOfOccurence() { return timeOfOccurence; }
  47.     unsigned int getReminderTime()    { return timeOfReminder; }
  48.  
  49.     // set members
  50.     void setText( char *txt )         { setItem( &itemText, txt ); }
  51.     void setSoundFile( char *tx2 )    { setItem( &soundFile, tx2 ); }
  52.     void setHour( char hr )           { hour = hr; }
  53.     void setMinute( char mn )         { minute = mn; }
  54.     void setYear( unsigned short yr ) { year  = yr; }
  55.     void setMonth( char mn )          { month = mn; }
  56.     void setDay( char dy )            { day = dy; }
  57.     void setToDo( char td )           { todoItem = td; }
  58.     void setItemDone( char id )       { itemDone = id; }
  59.     void setReminder( char sr )       { flashReminder = sr; }
  60.     void setReminderType( char ft )   { flashType = ft; }
  61.     void setNumToShow( char nm )      { numDaysToShow = nm; }
  62.     void setMinBefore( char mb )      { minBefore = mb; }
  63.     void setMinsBefore( char me )     { minsBefore = me; }
  64.     void setDaysBefore( char db )     { daysBefore = db; }
  65.     void updateTimes( void )          { setReminderTime(); setTimeOfOccurence(); }
  66.     void setTimeOfOccurence( void );
  67.     void setReminderTime( void );
  68.  
  69. private:
  70.     unsigned int year;
  71.     unsigned int timeOfOccurence;
  72.     unsigned int timeOfReminder;
  73.     char *itemText;
  74.     char *soundFile;
  75.     char month;
  76.     char day;
  77.     char hour;
  78.     char minute;
  79.     char todoItem;
  80.     char itemDone;
  81.     char flashReminder;
  82.     char flashType;
  83.     char minBefore;
  84.     char daysBefore;
  85.     char minsBefore;
  86.     char numDaysToShow;            // # of days in advance to show on to-do list
  87. };
  88.  
  89.  
  90. ////////////////////////////////////////////////////////////////////////////////
  91. // Misc. Macro Definitions - used both in class and in main application
  92. ////////////////////////////////////////////////////////////////////////////////
  93. // calcTimeOfOccurence - give unique ordinality to each possible date and time
  94. #define calcTimeOfOccurence(YEAR,MONTH,DAY,HOUR,MIN) (YEAR-1900)*12*31*24*60 + \
  95.                                                           (MONTH-1)*31*24*60 + \
  96.                                                                (DAY-1)*24*60 + \
  97.                                                                      HOUR*60 + \
  98.                                                                          MIN
  99.  
  100. // MakeHourglassPointer - macro to make the mouse pointer the hourglass
  101. #define MakeHourglassPointer()  WinSetPointer( HWND_DESKTOP, WinQuerySysPointer( HWND_DESKTOP, SPTR_WAIT, FALSE) );
  102.  
  103. // MakeArrowPointer - macro to make the mouse pointer the arrow
  104. #define MakeArrowPointer()      WinSetPointer( HWND_DESKTOP, WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE) );
  105.  
  106. // DrawRect - draws a rectange from the give 4 coordinates in specified color
  107. #define DrawRect(x1,y1,x2,y2,color)  pt.x = (LONG) (x1);             \
  108.                                      pt.y = (LONG) (y1);             \
  109.                                      GpiSetCurrentPosition(hps,&pt); \
  110.                                      pt.x = (LONG) (x2);             \
  111.                                      pt.y = (LONG) (y2);             \
  112.                                      GpiSetColor(hps,color);         \
  113.                                      GpiBox(hps,DRO_FILL,&pt,0L,0L);
  114.  
  115. // MAX - returns max of two passed values
  116. #define MAX(A,B)      ((A)>(B)?(A):(B))
  117.  
  118. // redrawCalendar - redraws the calendar on the desktop
  119. #define redrawCalendar()  WinInvalidateRegion( calendar.client, NULLHANDLE, FALSE ); \
  120.                           fillToDoList();
  121.  
  122. #endif
  123.