1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
(******************************************************************************
*
* Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
* All rights reserved.
*
* File: Table.h
*
* Release: Palm OS SDK 4.0 (63220)
*
* Description:
* This file defines table structures and routines.
*
* History:
* September 1, 1994 Created by Art Lamb
*
*****************************************************************************)
unit table;
interface
uses palmos, coretraps, rect, font, field, control;
//-------------------------------------------------------------------
// Table structures
//-------------------------------------------------------------------
const
tableDefaultColumnSpacing = 1;
tableNoteIndicatorWidth = 7;
tableNoteIndicatorHeight = 11;
tableMaxTextItemSize = 255; // does not incude terminating null
tblUnusableRow = $ffff;
// Display style of a table item
//
type
tableItemStyles = Enum;
const
checkboxTableItem = 0;
customTableItem = Succ(checkboxTableItem);
dateTableItem = Succ(customTableItem);
labelTableItem = Succ(dateTableItem);
numericTableItem = Succ(labelTableItem);
popupTriggerTableItem = Succ(numericTableItem);
textTableItem = Succ(popupTriggerTableItem);
textWithNoteTableItem = Succ(textTableItem);
timeTableItem = Succ(textWithNoteTableItem);
narrowTextTableItem = Succ(timeTableItem);
tallCustomTableItem = Succ(narrowTextTableItem);
type
TableItemStyleType = tableItemStyles;
TableItemType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
itemType: TableItemStyleType;
fontID: FontID; // font for drawing text
intValue: Int16;
ptr: PChar;
{$endif}
end;
TableItemTag = TableItemType;
TableItemPtr = ^TableItemType;
// Draw item callback routine prototype, used only by customTableItem.
TableDrawItemFuncType = procedure(tableP: Pointer; row, column: Int16; var bounds: RectangleType);
TableDrawItemFuncPtr = TableDrawItemFuncType;
// Load data callback routine prototype
TableLoadDataFuncType = function(tableP: Pointer; row, column: Int16; editable: Boolean;
var dataH: MemHandle; var dataOffset, dataSize: Int16; fld: FieldPtr): Err;
TableLoadDataFuncPtr = TableLoadDataFuncType;
// Save data callback routine prototype
TableSaveDataFuncType = function(tableP: Pointer; row, column: Int16): Boolean;
TableSaveDataFuncPtr = TableSaveDataFuncType;
TableColumnAttrType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
width: Coord; // width in pixels
Bits: UInt16;
{
UInt16 reserved1 : 5;
UInt16 masked : 1; // if both row + column masked, draw only grey box
UInt16 editIndicator : 1;
UInt16 usable : 1;
UInt16 reserved2 : 8;
}
spacing: Coord; // space after column
drawCallback: TableDrawItemFuncPtr;
loadDataCallback: TableLoadDataFuncPtr;
saveDataCallback: TableSaveDataFuncPtr;
{$endif}
end;
TableColumnAttrTag = TableColumnAttrType;
TableRowAttrType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
id: UInt16;
height: Coord; // row height in pixels
data: UInt32;
Bits: UInt16;
{
UInt16 reserved1 : 7;
UInt16 usable : 1;
UInt16 reserved2 : 4;
UInt16 masked : 1; // if both row + column masked, draw only grey box
UInt16 invalid : 1; // true if redraw needed
UInt16 staticHeight : 1; // Set if height does not expands as text is entered
UInt16 selectable : 1;
}
reserved3: UInt16;
{$endif}
end;
TableRowAttrTag = TableRowAttrType;
TableAttrType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
Bits: UInt16;
{
UInt16 visible:1; // Set if drawn, used internally
UInt16 editable:1; // Set if editable
UInt16 editing:1; // Set if in edit mode
UInt16 selected:1; // Set if the current item is selected
UInt16 hasScrollBar:1; // Set if the table has a scroll bar
UInt16 usable:1; // Set if in table is visible in the current form
UInt16 reserved:10;
}
{$endif}
end;
TableAttrTag = TableAttrType;
TableType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
id: UInt16;
bounds: RectangleType;
attr: TableAttrType;
numColumns: Int16;
numRows: Int16;
currentRow: Int16;
currentColumn: Int16;
topRow: Int16;
columnAttrs: ^TableColumnAttrType;
rowAttrs: ^TableRowAttrType;
items: TableItemPtr;
currentField: FieldType;
{$endif}
end;
TablePtr = ^TableType;
//-------------------------------------------------------------------
// Table routines
//-------------------------------------------------------------------
procedure TblDrawTable(tableP: TablePtr); syscall sysTrapTblDrawTable;
procedure TblRedrawTable(tableP: TablePtr); syscall sysTrapTblRedrawTable;
procedure TblEraseTable(tableP: TablePtr); syscall sysTrapTblEraseTable;
function TblHandleEvent(tableP: TablePtr; event: EventPtr): Boolean; syscall sysTrapTblHandleEvent;
procedure TblGetItemBounds(const tableP: TablePtr; row, column: Int16; var rP: RectangleType); syscall sysTrapTblGetItemBounds;
procedure TblSelectItem(tableP: TablePtr; row, column: Int16); syscall sysTrapTblSelectItem;
function TblGetItemInt(const tableP: TablePtr; row, column: Int16): Int16; syscall sysTrapTblGetItemInt;
procedure TblSetItemInt(tableP: TablePtr; row, column, value: Int16); syscall sysTrapTblSetItemInt;
procedure TblSetItemPtr(tableP: TablePtr; row, column: Int16; value: Pointer); syscall sysTrapTblSetItemPtr;
procedure TblSetItemStyle(tableP: TablePtr; row, column: Int16; type_: TableItemStyleType); syscall sysTrapTblSetItemStyle;
procedure TblUnhighlightSelection(tableP: TablePtr); syscall sysTrapTblUnhighlightSelection;
function TblRowUsable(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowUsable;
procedure TblSetRowUsable(tableP: TablePtr; row: Int16; usable: Boolean); syscall sysTrapTblSetRowUsable;
function TblGetLastUsableRow(const tableP: TablePtr): Int16; syscall sysTrapTblGetLastUsableRow;
procedure TblSetColumnUsable(tableP: TablePtr; column: Int16; usable: Boolean); syscall sysTrapTblSetColumnUsable;
procedure TblSetRowSelectable(tableP: TablePtr; row: Int16; selectable: Boolean); syscall sysTrapTblSetRowSelectable;
function TblRowSelectable(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowSelectable;
function TblGetNumberOfRows(const tableP: TablePtr): Int16; syscall sysTrapTblGetNumberOfRows;
procedure TblSetCustomDrawProcedure(tableP: TablePtr; column: Int16; drawCallback: TableDrawItemFuncPtr); syscall sysTrapTblSetCustomDrawProcedure;
procedure TblSetLoadDataProcedure(tableP: TablePtr; column: Int16; loadDataCallback: TableLoadDataFuncPtr); syscall sysTrapTblSetLoadDataProcedure;
procedure TblSetSaveDataProcedure(tableP: TablePtr; column: Int16; saveDataCallback: TableSaveDataFuncPtr); syscall sysTrapTblSetSaveDataProcedure;
procedure TblGetBounds(const tableP: TablePtr; var rP: RectangleType); syscall sysTrapTblGetBounds;
procedure TblSetBounds(tableP: TablePtr; {const} var rP: RectangleType); syscall sysTrapTblSetBounds;
function TblGetRowHeight(const tableP: TablePtr; row: Int16): Coord; syscall sysTrapTblGetRowHeight;
procedure TblSetRowHeight(tableP: TablePtr; row: Int16; height: Coord); syscall sysTrapTblSetRowHeight;
function TblGetColumnWidth(const tableP: TablePtr; column: Int16): Coord; syscall sysTrapTblGetColumnWidth;
procedure TblSetColumnWidth(tableP: TablePtr; column: Int16; width: Coord); syscall sysTrapTblSetColumnWidth;
function TblGetColumnSpacing(const tableP: TablePtr; column: Int16): Coord; syscall sysTrapTblGetColumnSpacing;
procedure TblSetColumnSpacing(tableP: TablePtr; column: Int16; spacing: Coord); syscall sysTrapTblSetColumnSpacing;
function TblFindRowID(const tableP: TablePtr; id: UInt16; var rowP: Int16): Boolean; syscall sysTrapTblFindRowID;
function TblFindRowData(const tableP: TablePtr; data: UInt32; var rowP: Int16): Boolean; syscall sysTrapTblFindRowData;
function TblGetRowID(const tableP: TablePtr; row: Int16): UInt16; syscall sysTrapTblGetRowID;
procedure TblSetRowID(tableP: TablePtr; row, id: Int16); syscall sysTrapTblSetRowID;
function TblGetRowData(const tableP: TablePtr; row: Int16): UInt32; syscall sysTrapTblGetRowData;
procedure TblSetRowData(tableP: TablePtr; row: Int16; data: UInt32); syscall sysTrapTblSetRowData;
function TblRowInvalid(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowInvalid;
procedure TblMarkRowInvalid(tableP: TablePtr; row: Int16); syscall sysTrapTblMarkRowInvalid;
procedure TblMarkTableInvalid(tableP: TablePtr); syscall sysTrapTblMarkTableInvalid;
function TblGetSelection(const tableP: TablePtr; var rowP, columnP: Int16): Boolean; syscall sysTrapTblGetSelection;
procedure TblInsertRow(tableP: TablePtr; row: Int16); syscall sysTrapTblInsertRow;
procedure TblRemoveRow(tableP: TablePtr; row: Int16); syscall sysTrapTblRemoveRow;
procedure TblReleaseFocus(tableP: TablePtr); syscall sysTrapTblReleaseFocus;
function TblEditing(const tableP: TablePtr): Boolean; syscall sysTrapTblEditing;
function TblGetCurrentField(const tableP: TablePtr): FieldPtr; syscall sysTrapTblGetCurrentField;
procedure TblGrabFocus(tableP: TablePtr; row, column: Int16); syscall sysTrapTblGrabFocus;
procedure TblSetColumnEditIndicator(tableP: TablePtr; column: Int16; editIndicator: Boolean); syscall sysTrapTblSetColumnEditIndicator;
procedure TblSetRowStaticHeight(tableP: TablePtr; row: Int16; staticHeight: Boolean); syscall sysTrapTblSetRowStaticHeight;
procedure TblHasScrollBar(tableP: TablePtr; hasScrollBar: Boolean); syscall sysTrapTblHasScrollBar;
function TblGetItemFont(const tableP: TablePtr; row, column: Int16): FontID; syscall sysTrapTblGetItemFont;
procedure TblSetItemFont(tableP: TablePtr; row, column: Int16; fontID: FontID); syscall sysTrapTblSetItemFont;
function TblGetItemPtr(const tableP: TablePtr; row, column: Int16): Pointer; syscall sysTrapTblGetItemPtr;
function TblRowMasked(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowMasked;
procedure TblSetRowMasked(tableP: TablePtr; row: Int16; masked: Boolean); syscall sysTrapTblSetRowMasked;
procedure TblSetColumnMasked(tableP: TablePtr; column: Int16; masked: Boolean); syscall sysTrapTblSetColumnMasked;
function TblGetNumberOfColumns(const tableP: TablePtr): Int16; syscall sysTrapTblGetNumberOfColumns;
function TblGetTopRow(const tableP: TablePtr): Int16; syscall sysTrapTblGetTopRow;
procedure TblSetSelection(tableP: TablePtr; row, column: Int16); syscall sysTrapTblSetSelection;
implementation
end.
|