home *** CD-ROM | disk | FTP | other *** search
- /*
- Ghardeno: Information Gardening for PalmOS
- Copyright (C) 2000 Laurent Moussault
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- #ifndef MyTable_h
- #define MyTable_h
-
- // Must be 1 more than maximum visible rows:
- #define mtaRowNumber 13
-
- typedef void MtaLoadRecordFuncType (VoidHand h, FontID *fid, Word *yh);
- typedef MtaLoadRecordFuncType *MtaLoadRecordFuncPtr;
-
- typedef struct {
- UInt index;
- VoidHand handle;
- FontID fontID;
- RectangleType rect;
- Boolean invalid;
- } MyTableRowType;
- typedef MyTableRowType *MyTableRowPtr;
-
- typedef struct {
- Word id; // ID of the corresponding gadget
- FormType *form; // Form (cached)
- RectangleType bounds; // Bounds of the table
- int maxSize; // Maximum number of rows in the table
- int size; // Number of rows currently in the table
- int current; // Index (in the 'rows' table) of the currently selected or edited row
- Word currentIndex; // Record index of the currently selected or edited row
- Boolean isSelected; // Is 'current' (and 'currentRecord') selected ?
- Boolean isEditing; // Is 'current' (and 'currentRecord') being edited ?
- Boolean isShown; // Is 'current' visible ? (if not, only 'currentRecord' is valid)
- MyTableRowType **rows;
- DmOpenRef db; // The database.
- Word category; // The current category.
- Word categorySize; // Number of records in the current category.
- Word positionInCategory; // Position of the top row in the current category.
- MtaLoadRecordFuncType *loadRecord;
- //DrawRowFunc drawRow;
- RectangleType emptyRect;
- // Oldies
- Boolean full;
- } MyTableType;
- typedef MyTableType* MyTablePtr;
-
- void MtaInit ();
-
- VoidHand MtaNew (FormType *f, Word i, Word m, DmOpenRef d);
- void MtaSetLoadRecordProcedure (MyTableType *t, MtaLoadRecordFuncType *lrf);
-
- void MtaNewRecord (MyTableType *t);
-
- void MtaFillTableFromTop (MyTableType *t, UInt i);
-
- void MtaEditSelectedRow (MyTableType *t);
-
- void MtaRedraw (MyTableType *t);
-
- void MtaUnselect (MyTableType *t);
- void MtaChangeSelection(MyTableType *t, int i);
-
- void MtaUpdateCurrentRow (MyTableType *t);
-
- Boolean MtaHandlePenDownEvent(MyTableType *t, EventPtr ev);
-
- void MtaScrollTo(MyTableType *t, int n);
- Boolean MtaScrollDownOneRow(MyTableType *t);
- void MtaScrollDownOnePage(MyTableType *t);
- Boolean MtaScrollUpOneRow(MyTableType *t);
- void MtaScrollUpOnePage(MyTableType *t);
- void MtaScrollToRecord(MyTableType *t, Word i);
-
- void MtaClose(MyTableType *t);
-
- #endif /* MyTable_h */
-