1 #ifndef LIBRARIES_CALENDAR_H
    2 #define LIBRARIES_CALENDAR_H
    3 
    4 /*************************************************************************/
    5 
    6 #ifndef EXEC_TYPES_H
    7 #include <exec/types.h>
    8 #endif
    9 
   10 #ifndef UTILITY_UTILITY_H
   11 #include <utility/tagitem.h>
   12 #endif
   13 
   14 /*************************************************************************/
   15 
   16 #define CALENDAR_NAME                  "calendar.library"   /* library name */
   17 #define CALENDAR_MINVERSION            23
   18 
   19 #define CALENDAR_DATABASENAME_DEFAULT   ((STRPTR)1)  /* This is a special value for opening the database. The system default database will be used */
   20 
   21 /*************************************************************************/
   22 
   23 #define CALENDAR_ERROR_NOERROR               0   /* everything is fine */
   24 #define CALENDAR_ERROR_NOMOREENTRIES         2   /* everything is fine, scan just finished */
   25 #define CALENDAR_ERROR_OUTOFMEMORY           3   /* low memory condition */
   26 #define CALENDAR_ERROR_DATABASEERROR         4   /* for some reason database communication failed */
   27 #define CALENDAR_ERROR_APIERROR              5   /* application used API wrong */
   28 #define CALENDAR_ERROR_OUTOFBOUNDS           6   /* Calendar_CalendarDate(Add|Sub) year limit reached */
   29 #define CALENDAR_ERROR_FAILEDTOREADDATETIME  7   /* potential Calendar_ReadDateTime() result */
   30 
   31 /*************************************************************************/
   32 
   33 /* CalendarDate structure 
   34 **
   35 ** The CalendarDate structure is equal to ClockData structure provided
   36 ** by <utility/data.h>, but way more readable.
   37 **
   38 ** Please note that cd_Second and cd_Weekday are not used by calendar.library.
   39 **
   40 */
   41 #pragma pack(2)
   42 
   43 struct CalendarDate {
   44 	UWORD cd_Second;
   45 	UWORD cd_Minute;
   46 	UWORD cd_Hour;
   47 	UWORD cd_Day;
   48 	UWORD cd_Month;
   49 	UWORD cd_Year;
   50 	UWORD cd_Weekday;
   51 };
   52 
   53 #pragma pack()
   54 
   55 /*************************************************************************/
   56 
   57 /* Calendar Context Tags */
   58 
   59 #define TAGBASE_LibCalendar                       (TAG_USER)
   60 #define CED_Calendar_EventID                      (TAGBASE_LibCalendar + 21)    /* -Q - (ULONG)  - unique database entry id */
   61 #define CED_Calendar_EventColor                   (TAGBASE_LibCalendar + 22)    /* SQ - (ARGB)   - event color */
   62 #define CED_Calendar_EventImageType               (TAGBASE_LibCalendar + 23)    /* SQ - (ULONG)  - defines the image attached to an entry */
   63 #define CED_Calendar_EventFrequency               (TAGBASE_LibCalendar + 24)    /* SQ - (ULONG)  - type of event repeat */
   64 #define CED_Calendar_EventEvery                   (TAGBASE_LibCalendar + 25)    /* SQ - (ULONG)  - every (day/week/month/year) number - default 1 */
   65 #define CED_Calendar_EventLocation                (TAGBASE_LibCalendar + 26)    /* SQ - (STRPTR) - UTF-8 location string */
   66 #define CED_Calendar_EventCalendarDateStart       (TAGBASE_LibCalendar + 27)    /* SQ - (struct CalendarDate *) - event start. */
   67 #define CED_Calendar_EventCalendarDateEnd         (TAGBASE_LibCalendar + 28)    /* SQ - (struct CalendarDate *) - event end. */
   68 #define CED_Calendar_EventCalendarDateUntil       (TAGBASE_LibCalendar + 29)    /* SQ - (struct CalendarDate *) - event repeat end date */
   69 #define CED_Calendar_EventDateStringStart         (TAGBASE_LibCalendar + 30)    /* S- - (STRPTR) - event start. format is "YYYY-MM-DD HH:MM" */
   70 #define CED_Calendar_EventDateStringEnd           (TAGBASE_LibCalendar + 31)    /* S- - (STRPTR) - event end. format is "YYYY-MM-DD HH:MM" */
   71 #define CED_Calendar_EventDateStringUntil         (TAGBASE_LibCalendar + 32)    /* S- - (STRPTR) - event until format is "YYYY-MM-DD HH:MM" */
   72 #define CED_Calendar_EventDateStampStart          (TAGBASE_LibCalendar + 33)    /* SQ - (struct DateStamp *) - event start */
   73 #define CED_Calendar_EventDateStampEnd            (TAGBASE_LibCalendar + 34)    /* SQ - (struct DateStamp *) - event end */
   74 #define CED_Calendar_EventDateStampUntil          (TAGBASE_LibCalendar + 35)    /* SQ - (struct DateStamp *) - event repeat end */
   75 #define CED_Calendar_EventUntilForever            (TAGBASE_LibCalendar + 36)    /* SQ - (ULONG)  - set to non zero the event has no end */
   76 #define CED_Calendar_EventTitle                   (TAGBASE_LibCalendar + 37)    /* SQ - (STRPTR) - event title in UTF-8 format */
   77 #define CED_Calendar_EventNotes                   (TAGBASE_LibCalendar + 38)    /* SQ - (STRPTR) - event notes in UTF-8 format */
   78 #define CED_Calendar_EventImageName               (TAGBASE_LibCalendar + 39)    /* SQ - (STRPTR) - icon file name */
   79 #define CED_Calendar_EventUserData                (TAGBASE_LibCalendar + 40)    /* SQ - (STRPTR) - application user data. ### POINTERS ARE NOT ALLOWED ### */
   80 #define CED_Calendar_EventAlert1                  (TAGBASE_LibCalendar + 41)    /* SQ - (ULONG)  - event alert as defined below */
   81 #define CED_Calendar_EventAlert2                  (TAGBASE_LibCalendar + 42)    /* SQ - (ULONG)  - event alert as defined below */
   82 #define CED_Calendar_EventWayTime                 (TAGBASE_LibCalendar + 43)    /* SQ - (ULONG) */
   83 #define CED_Calendar_EventURL                     (TAGBASE_LibCalendar + 44)    /* SQ - (ULONG)  - event URL */
   84 #define CED_Calendar_EventCustomFrequency         (TAGBASE_LibCalendar + 45)    /* SQ - (ULONG)  - event custom repeat */
   85 #define CED_Calendar_EventCustomMask              (TAGBASE_LibCalendar + 46)    /* SQ - (ULONG)  - day/month/weekday bitfield (10th is 1<<10) */
   86 #define CED_Calendar_EventCustomEvery             (TAGBASE_LibCalendar + 47)    /* SQ - (ULONG)  - CED_Calendar_EventCustomEvery_#? types as defined below */
   87 #define CED_Calendar_EventCustomEveryType         (TAGBASE_LibCalendar + 48)    /* SQ - (ULONG)  - CED_Calendar_EventCustomEveryType#? types as defined below */
   88 #define CED_Calendar_EventCustomEveryEnable       (TAGBASE_LibCalendar + 49)    /* SQ - (ULONG)  - set to non zero the to enable CustomEvery#? */
   89 #define CED_Calendar_EventCalendarDateLastChange  (TAGBASE_LibCalendar + 50)    /* -Q - (struct CalendarDate *) - date this entry was modified the last time */
   90 
   91 
   92 /* values for CED_Calendar_EventImage */
   93 
   94 #define CED_Calendar_EventImageType_None                    0     /* no image for this event */
   95 #define CED_Calendar_EventImageType_Note                    1     /* default when no type was specified */
   96 #define CED_Calendar_EventImageType_Custom                  2     /* use custom image name from application */
   97 #define CED_Calendar_EventImageType_Birthday                3
   98 #define CED_Calendar_EventImageType_Holiday                 4
   99 #define CED_Calendar_EventImageType_Party                   5
  100 #define CED_Calendar_EventImageType_Meeting                 6
  101 #define CED_Calendar_EventImageType_Date                    7
  102 #define CED_Calendar_EventImageType_Work                    8
  103 #define CED_Calendar_EventImageType_Star                    9
  104 #define CED_Calendar_EventImageType_Trash1                 10     /* paper */
  105 #define CED_Calendar_EventImageType_Trash2                 11     /* plastics */
  106 #define CED_Calendar_EventImageType_Trash3                 12     /* organic */
  107 #define CED_Calendar_EventImageType_Trash4                 13     /* residual */
  108 #define CED_Calendar_EventImageType_Trash5                 14     /* hazardous */
  109 #define CED_Calendar_EventImageType_Dentist                15
  110 #define CED_Calendar_EventImageType_Doctor                 16
  111 #define CED_Calendar_EventImageType_Shopping               17
  112 #define CED_Calendar_EventImageType_Wedding                18
  113 #define CED_Calendar_EventImageType_Flight                 19
  114 
  115 
  116 /* values for CED_Calendar_EventRepeat */
  117 
  118 #define CED_Calendar_EventFrequency_None                    0
  119 #define CED_Calendar_EventFrequency_Daily                   1
  120 #define CED_Calendar_EventFrequency_Weekly                  7
  121 #define CED_Calendar_EventFrequency_2Week                  14
  122 #define CED_Calendar_EventFrequency_Monthly                31
  123 #define CED_Calendar_EventFrequency_Yearly                365
  124 #define CED_Calendar_EventFrequency_Custom                  2
  125 
  126 /* values for CED_Calendar_EventCustomRepeat */
  127 
  128 #define CED_Calendar_EventCustomFrequency_Daily             1
  129 #define CED_Calendar_EventCustomFrequency_Weekly            7
  130 #define CED_Calendar_EventCustomFrequency_Monthly          31
  131 #define CED_Calendar_EventCustomFrequency_Yearly          365
  132 
  133 /* values for CED_Calendar_EventCustomEvery */
  134 
  135 #define CED_Calendar_EventCustomEvery_First                 0
  136 #define CED_Calendar_EventCustomEvery_Second                1
  137 #define CED_Calendar_EventCustomEvery_Third                 2
  138 #define CED_Calendar_EventCustomEvery_Fourth                3
  139 #define CED_Calendar_EventCustomEvery_Fifth                 4
  140 #define CED_Calendar_EventCustomEvery_Last                  5
  141 
  142 /* values for CED_Calendar_EventCustomEveryType */
  143 
  144 #define CED_Calendar_EventCustomEveryType_Monday            0
  145 #define CED_Calendar_EventCustomEveryType_Tuesday           1
  146 #define CED_Calendar_EventCustomEveryType_Wednesday         2
  147 #define CED_Calendar_EventCustomEveryType_Thursday          3
  148 #define CED_Calendar_EventCustomEveryType_Friday            4
  149 #define CED_Calendar_EventCustomEveryType_Saturday          5
  150 #define CED_Calendar_EventCustomEveryType_Sunday            6
  151 #define CED_Calendar_EventCustomEveryType_Day               7
  152 #define CED_Calendar_EventCustomEveryType_Weekday           8
  153 #define CED_Calendar_EventCustomEveryType_Weekend           9
  154 
  155 /* values for CED_Calendar_WayTime */
  156 
  157 #define CED_Calendar_WayTime_None                           0
  158 #define CED_Calendar_WayTime_Minutes05                      5
  159 #define CED_Calendar_WayTime_Minutes10                     10
  160 #define CED_Calendar_WayTime_Minutes15                     15
  161 #define CED_Calendar_WayTime_Minutes30                     30
  162 #define CED_Calendar_WayTime_Minutes60                     60
  163 #define CED_Calendar_WayTime_Minutes90                     90
  164 #define CED_Calendar_WayTime_Minutes120                   120
  165 
  166 /* values for CED_Calendar_EventAlert#? */
  167 
  168 #define CED_Calendar_EventAlert_None                       0
  169 #define CED_Calendar_EventAlert_Minutes05                  5
  170 #define CED_Calendar_EventAlert_Minutes10                 10
  171 #define CED_Calendar_EventAlert_Minutes15                 15
  172 #define CED_Calendar_EventAlert_Minutes30                 30
  173 #define CED_Calendar_EventAlert_Minutes60                 60
  174 #define CED_Calendar_EventAlert_Minutes120               120
  175 #define CED_Calendar_EventAlert_Days1                   1440
  176 #define CED_Calendar_EventAlert_Days2                   2880
  177 #define CED_Calendar_EventAlert_Week1                  10080
  178 
  179 /* values for  MUIT_Calendar_ContentsColor */
  180 
  181 #define CED_Calendar_EventColor_Off               0x12345678   /* this value disables color */
  182 
  183 /* notification tag data for Calendar_NotificationAddTagList()
  184 ** NOTE: These flags are grouped. You will get CHANGEDATE and CHANGE
  185 ** in combination with ACTION related flags. So you will receive a ACTIONREMOVE
  186 ** before the removal action and ACTIONREMOVE together with CHANGEDATE and
  187 ** CHANGE after the entry got removed.
  188 ** Also note that ACTION_ADD will be send only once to avoid multiple notifications on the
  189 ** same thing. Internally it is split in ACTION_ADD and ACTION_SET, so you will receive ADD 
  190 ** followed by SET.
  191 **
  192 ** These flags are used upon hook adding and an application will only receive notification
  193 ** calls on the hook where these initial flags are set. However you will get all flags and
  194 ** they are valid. e.g. using EVENTCHANGEDATE on hook creation, will also deliver any
  195 ** ACTION or EVENT flags.
  196 **
  197 ** The ACTION type flags are just additional information and will be delivered along with
  198 ** EVENT flags anyway. When enabled you will get informed begore any change tooks place,
  199 ** which may be handy, as you get informed before any removal or adding of database nodes.
  200 ** 
  201 */
  202 
  203 
  204 #define CNH_Calendar_Hook                              (TAGBASE_LibCalendar + 1 )
  205 #define CNH_Calendar_SignalMask                        (TAGBASE_LibCalendar + 2 )
  206 #define CNH_Calendar_Task                              (TAGBASE_LibCalendar + 3 )
  207 
  208 #define CALENDARNOTIFY_EVENTCHANGEDATE            1   /* start, end or repeat changed  */
  209 #define CALENDARNOTIFY_EVENTCHANGE                2   /* non date related data changed */
  210 #define CALENDARNOTIFY_ACTIONSET               1024   /* specified event got modified */
  211 #define CALENDARNOTIFY_ACTIONADD               2048   /* specified event will be or got added */
  212 #define CALENDARNOTIFY_ACTIONREMOVE            4096   /* specified event will be or got removed */
  213 #define CALENDARNOTIFY_ACTIONREMOVEALL         8192   /* specified all events will be or got removed */
  214 
  215 /*************************************************************************/
  216 
  217 #endif /* LIBRARIES_CALENDAR_H */