home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / progect-src-0.20.tar.gz / progect-src-0.20.tar / progect-0.20 / ToDoDB.h < prev    next >
C/C++ Source or Header  |  2000-10-26  |  4KB  |  146 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 } ToDoRecordFieldType;
  103.  
  104.  
  105.  
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109.  
  110.  
  111. //-------------------------------------------------------------------
  112. // Routines
  113. //-------------------------------------------------------------------
  114. // sections support added by L. Burgbacher for progect
  115. #define TODOSECT __attribute__ ((section ("todosect")))
  116.  
  117. Err ToDoNewRecord(DmOpenRef dbP, ToDoItemPtr item, UInt16 category, UInt16 *index) TODOSECT;
  118.  
  119. Err ToDoInsertNewRecord (DmOpenRef dbP, UInt16 * index) TODOSECT;
  120.  
  121. Err ToDoChangeRecord(DmOpenRef dbP, UInt16 * index, 
  122.     ToDoRecordFieldType changedField, void * data) TODOSECT;
  123.  
  124. Err ToDoChangeSortOrder(DmOpenRef dbP, UInt8 sortOrder) TODOSECT;
  125.  
  126. Err ToDoAppInfoInit(DmOpenRef dbP) TODOSECT;
  127.  
  128. MemHandle ToDoGetAppInfo  (DmOpenRef dbP) TODOSECT;
  129.  
  130. UInt8 ToDoGetSortOrder (DmOpenRef dbP) TODOSECT;
  131.  
  132. void ToDoSort (DmOpenRef dbP) TODOSECT;
  133.  
  134. Err ToDoGetDatabase (DmOpenRef *dbPP, UInt16 mode) TODOSECT;
  135.  
  136. void ToDoSetDBBackupBit (DmOpenRef dbP) TODOSECT;
  137.  
  138.  
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142.  
  143.  
  144. #endif
  145.  
  146.