home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / hobby / ghardeno / ghardeno.EXE / MyTable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-26  |  3.0 KB  |  92 lines

  1. /*
  2.     Ghardeno: Information Gardening for PalmOS
  3.     Copyright (C) 2000 Laurent Moussault
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #ifndef MyTable_h
  21. #define MyTable_h
  22.  
  23. // Must be 1 more than maximum visible rows:
  24. #define mtaRowNumber 13
  25.  
  26. typedef void MtaLoadRecordFuncType (VoidHand h, FontID *fid, Word *yh);
  27. typedef MtaLoadRecordFuncType *MtaLoadRecordFuncPtr;
  28.  
  29. typedef struct {
  30.   UInt index;
  31.   VoidHand handle;
  32.   FontID fontID;
  33.   RectangleType rect;
  34.   Boolean invalid;
  35. } MyTableRowType;
  36. typedef MyTableRowType *MyTableRowPtr;
  37.  
  38. typedef struct {
  39.   Word id; // ID of the corresponding gadget
  40.   FormType *form; // Form (cached)
  41.   RectangleType bounds; // Bounds of the table
  42.   int maxSize; // Maximum number of rows in the table
  43.   int size; // Number of rows currently in the table
  44.   int current; // Index (in the 'rows' table) of the currently selected or edited row
  45.   Word currentIndex; // Record index of the currently selected or edited row
  46.   Boolean isSelected; // Is 'current' (and 'currentRecord') selected ?
  47.   Boolean isEditing; // Is 'current' (and 'currentRecord') being edited ?
  48.   Boolean isShown; // Is 'current' visible ? (if not, only 'currentRecord' is valid)
  49.   MyTableRowType **rows;
  50.   DmOpenRef db; // The database.
  51.   Word category; // The current category.
  52.   Word categorySize; // Number of records in the current category.
  53.   Word positionInCategory; // Position of the top row in the current category.
  54.   MtaLoadRecordFuncType *loadRecord;
  55.   //DrawRowFunc drawRow;
  56.   RectangleType emptyRect;
  57.   // Oldies
  58.   Boolean full;
  59. } MyTableType;
  60. typedef MyTableType* MyTablePtr;
  61.  
  62. void MtaInit ();
  63.  
  64. VoidHand MtaNew (FormType *f, Word i, Word m, DmOpenRef d);
  65. void MtaSetLoadRecordProcedure (MyTableType *t, MtaLoadRecordFuncType *lrf);
  66.  
  67. void MtaNewRecord (MyTableType *t);
  68.  
  69. void MtaFillTableFromTop (MyTableType *t, UInt i);
  70.  
  71. void MtaEditSelectedRow (MyTableType *t);
  72.  
  73. void MtaRedraw (MyTableType *t);
  74.   
  75. void MtaUnselect (MyTableType *t);
  76. void MtaChangeSelection(MyTableType *t, int i);
  77.  
  78. void MtaUpdateCurrentRow (MyTableType *t);
  79.  
  80. Boolean MtaHandlePenDownEvent(MyTableType *t, EventPtr ev);
  81.  
  82. void MtaScrollTo(MyTableType *t, int n);
  83. Boolean MtaScrollDownOneRow(MyTableType *t);
  84. void MtaScrollDownOnePage(MyTableType *t);
  85. Boolean MtaScrollUpOneRow(MyTableType *t);
  86. void MtaScrollUpOnePage(MyTableType *t);
  87. void MtaScrollToRecord(MyTableType *t, Word i);
  88.  
  89. void MtaClose(MyTableType *t);
  90.  
  91. #endif /* MyTable_h */
  92.