home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / happydays-src-1.37.tar.gz / happydays-src-1.37.tar / happydays-1.37 / todo.h < prev    next >
C/C++ Source or Header  |  2000-05-17  |  3KB  |  145 lines

  1. /******************************************************************************
  2.  *
  3.  * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
  4.  * All rights reserved.
  5.  *
  6.  * File: ToDoDB.h
  7.  *
  8.  * Description:
  9.  *        Header for the To Do Manager
  10.  *
  11.  * History:
  12.  *       1/19/95  rsf - Created
  13.  *        10/4/99    jmp - Added 
  14.  *
  15.  *****************************************************************************/
  16.  
  17. #ifndef __TDTODOMGR_H__
  18. #define __TDTODOMGR_H__
  19.  
  20. #include <DateTime.h>
  21.  
  22. #define LocalizedAppInfoStr    1000
  23.  
  24. #define todoLabelLength            12
  25. #define todoNumFields            16
  26.  
  27. #define toDoMaxPriority            5
  28.  
  29. // Dirty flags for to do application info
  30. #define toDoSortByPriorityDirty    0x0001
  31.  
  32. // Sort orders
  33. #define soDueDatePriority        0
  34. #define soPriorityDueDate        1
  35. #define soCategoryPriority        2
  36. #define soCategoryDueDate        3
  37.  
  38.  
  39. typedef struct {
  40.     UInt16                renamedCategories;    // bitfield of categories with a different name
  41.     char                 categoryLabels[dmRecNumCategories][dmCategoryLength];
  42.     UInt8                 categoryUniqIDs[dmRecNumCategories];
  43.     UInt8                lastUniqID;    // Uniq IDs generated by the device are between
  44.     // 0 - 127.  Those from the PC are 128 - 255.
  45.     UInt8                reserved1;    // from the compiler word aligning things
  46.     UInt16                reserved2;
  47.     UInt16                dirtyAppInfo;
  48.     UInt8                sortOrder;
  49.     UInt8                reserved3;
  50. } ToDoAppInfoType;
  51.  
  52. typedef ToDoAppInfoType * ToDoAppInfoPtr;
  53.  
  54. // ToDoDBRecord.
  55. //
  56. // All strings are null terminated and appear within the record.
  57. //
  58. typedef struct {
  59.     DateType dueDate;
  60.     UInt8 priority;        // high bit is complete flag
  61.     char description;
  62. } ToDoDBRecord;
  63.  
  64. typedef ToDoDBRecord            ToDoDBRecordType;
  65. typedef ToDoDBRecord*            ToDoDBRecordPtr;
  66.  
  67. // sizeDBRecord is the minimum size for the ToDoDBRecord structure.
  68. // It assumes empty 'description' and 'note' fields.
  69. // sizeDBRecord allocates an extra byte for the null character
  70. // for the note string.
  71. #define sizeDBRecord (sizeof (ToDoDBRecord) + 1)
  72.  
  73. // ToDoItemType
  74. //
  75. // This is the format of a to do record used by the application.  All 
  76. // pointers are either NULL or point to data within the PackedDB record.
  77. // All strings are null character terminated.
  78. //
  79. typedef struct {
  80.     DateType             dueDate;
  81.     UInt8                 priority;        // high bit is complete flag
  82.     UInt8                reserved;
  83.     Char *                description;
  84.     Char *                note;
  85. } ToDoItemType;
  86.  
  87. typedef ToDoItemType * ToDoItemPtr;
  88.  
  89.  
  90. #define completeFlag     0x80
  91. #define priorityOnly     ~completeFlag
  92. #define toDoNoDueDate    0xffff
  93.  
  94.  
  95. // Used for ToDoChangeRecord.
  96. typedef enum  { 
  97.     toDoPriority,
  98.     toDoComplete,
  99.     toDoDueDate,
  100.     toDoDescription,
  101.     toDoNote,
  102.     toDoCategory
  103. } ToDoRecordFieldType;
  104.  
  105.  
  106.  
  107. #ifdef __cplusplus
  108. extern "C" {
  109. #endif
  110.  
  111.  
  112. //-------------------------------------------------------------------
  113. // Routines
  114. //-------------------------------------------------------------------
  115. Err ToDoNewRecord(DmOpenRef dbP, ToDoItemPtr item, UInt16 category, UInt16 *index);
  116.  
  117. Err ToDoInsertNewRecord (DmOpenRef dbP, UInt16 * index);
  118.  
  119. Err ToDoChangeRecord(DmOpenRef dbP, UInt16 * index, 
  120.                      ToDoRecordFieldType changedField, void * data);
  121.  
  122. Err ToDoChangeSortOrder(DmOpenRef dbP, UInt8 sortOrder);
  123.  
  124. Err ToDoAppInfoInit(DmOpenRef dbP);
  125.  
  126. MemHandle ToDoGetAppInfo  (DmOpenRef dbP);
  127.  
  128. UInt8 ToDoGetSortOrder (DmOpenRef dbP);
  129.  
  130. void ToDoSort (DmOpenRef dbP);
  131.  
  132. Err ToDoGetDatabase (DmOpenRef *dbPP, UInt16 mode);
  133.  
  134. void ToDoSetDBBackupBit (DmOpenRef dbP);
  135.  
  136. Char* GetToDoNotePtr (ToDoDBRecordPtr recordP);
  137.  
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141.  
  142.  
  143. #endif
  144.  
  145.