1
(******************************************************************************
3
* Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
8
* Release: Palm OS SDK 4.0 (63220)
11
* This file defines field structures and routines.
14
* August 29, 1994 Created by Art Lamb
16
*****************************************************************************)
21
uses palmos, coretraps, rect, font, window, control;
24
maxFieldTextLen = $7fff;
26
// default maximun number of line the a dynamicly sizing field will expand to.
27
// Can be changed with FldSetMaxVisibleLines
31
// kind alignment values
33
justifications = Enum;
37
centerAlign = Succ(leftAlign);
38
rightAlign = Succ(centerAlign);
41
JustificationType = justifications;
51
undoTyping = Succ(undoNone);
52
undoBackspace = Succ(undoTyping);
53
undoDelete = Succ(undoBackspace);
54
undoPaste = Succ(undoDelete);
55
undoCut = Succ(undoPaste);
56
undoInput = Succ(undoCut);
59
FieldUndoType = record
60
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
69
FieldUndoTag = FieldUndoType;
71
FieldAttrType = record
74
UInt16 usable :1; // Set if part of ui
75
UInt16 visible :1; // Set if drawn, used internally
76
UInt16 editable :1; // Set if editable
77
UInt16 singleLine :1; // Set if only a single line is displayed
78
UInt16 hasFocus :1; // Set if the field has the focus
79
UInt16 dynamicSize :1; // Set if height expands as text is entered
80
UInt16 insPtVisible :1; // Set if the ins pt is scolled into view
81
UInt16 dirty :1; // Set if user modified
82
UInt16 underlined :2; // text underlined mode
83
UInt16 justification :2; // text alignment
84
UInt16 autoShift :1; // Set if auto case shift
85
UInt16 hasScrollBar :1; // Set if the field has a scroll bar
86
UInt16 numeric :1; // Set if numeric, digits and secimal separator only
87
UInt16 reserved :1; // Reserved for future use
90
FieldAttrTag = FieldAttrType;
91
FieldAttrPtr = ^FieldAttrType;
94
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
95
start: UInt16; // position in text string of first char.
96
length: UInt16; // number of character in the line
99
LineInfoTag = LineInfoType;
100
LineInfoPtr = ^LineInfoType;
103
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
107
text: PChar; // pointer to the start of text string
108
textHandle: MemHandle; // block the contains the text string
111
textBlockSize: UInt16;
118
maxVisibleLines: UInt8; // added in 4.0 to support FldSetMaxVisibleLines
122
FieldPtr = ^FieldType; // deprecated, use FieldType *
124
//---------------------------------------------------------------------
126
//---------------------------------------------------------------------
128
procedure FldCopy(const fldP: FieldPtr); syscall sysTrapFldCopy;
130
procedure FldCut(fldP: FieldPtr); syscall sysTrapFldCut;
132
procedure FldDrawField(fldP: FieldPtr); syscall sysTrapFldDrawField;
134
procedure FldEraseField(fldP: FieldPtr); syscall sysTrapFldEraseField;
136
procedure FldFreeMemory(fldP: FieldPtr); syscall sysTrapFldFreeMemory;
138
procedure FldGetBounds(const fldP: FieldPtr; rect: RectanglePtr); syscall sysTrapFldGetBounds;
140
function FldGetFont(const fldP: FieldPtr): FontID; syscall sysTrapFldGetFont;
142
procedure FldGetSelection(const fldP: FieldPtr; var startPosition, endPosition: UInt16); syscall sysTrapFldGetSelection;
144
function FldGetTextHandle(const fldP: FieldPtr): MemHandle; syscall sysTrapFldGetTextHandle;
146
function FldGetTextPtr(const fldP: FieldPtr): PChar; syscall sysTrapFldGetTextPtr;
148
function FldHandleEvent(fldP: FieldPtr; eventP: EventPtr): Boolean; syscall sysTrapFldHandleEvent;
150
procedure FldPaste(fldP: FieldPtr); syscall sysTrapFldPaste;
152
procedure FldRecalculateField(fldP: FieldPtr; redraw: Boolean); syscall sysTrapFldRecalculateField;
154
procedure FldSetBounds(fldP: FieldPtr; const rP: RectanglePtr); syscall sysTrapFldSetBounds;
156
procedure FldSetFont(fldP: FieldPtr; fontID: FontID); syscall sysTrapFldSetFont;
158
procedure FldSetText(fldP: FieldPtr; textHandle: MemHandle; offset, size: UInt16); syscall sysTrapFldSetText;
160
procedure FldSetTextHandle(fldP: FieldPtr; textHandle: MemHandle); syscall sysTrapFldSetTextHandle;
162
procedure FldSetTextPtr(fldP: FieldPtr; textP: PChar); syscall sysTrapFldSetTextPtr;
164
procedure FldSetUsable(fldP: FieldPtr; usable: Boolean); syscall sysTrapFldSetUsable;
166
procedure FldSetSelection(fldP: FieldPtr; startPosition, endPosition: UInt16); syscall sysTrapFldSetSelection;
168
procedure FldGrabFocus(fldP: FieldPtr); syscall sysTrapFldGrabFocus;
170
procedure FldReleaseFocus(fldP: FieldPtr); syscall sysTrapFldReleaseFocus;
172
function FldGetInsPtPosition(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetInsPtPosition;
174
procedure FldSetInsPtPosition(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetInsPtPosition;
176
procedure FldSetInsertionPoint(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetInsertionPoint;
178
function FldGetScrollPosition(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetScrollPosition;
180
procedure FldSetScrollPosition(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetScrollPosition;
182
procedure FldGetScrollValues(const fldP: FieldPtr; var scrollPosP, textHeightP, fieldHeightP: UInt16); syscall sysTrapFldGetScrollValues;
184
function FldGetTextLength(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextLength;
186
procedure FldScrollField(fldP: FieldPtr; linesToScroll: UInt16; direction: WinDirectionType); syscall sysTrapFldScrollField;
188
function FldScrollable(const fldP: FieldPtr; direction: WinDirectionType): Boolean; syscall sysTrapFldScrollable;
190
function FldGetVisibleLines(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetVisibleLines;
192
function FldGetTextHeight(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextHeight;
194
function FldCalcFieldHeight(const chars: PChar; maxWidth: UInt16): UInt16; syscall sysTrapFldCalcFieldHeight;
196
function FldWordWrap(const chars: PChar; maxWidth: Int16): UInt16; syscall sysTrapFldWordWrap;
198
procedure FldCompactText(fldP: FieldPtr); syscall sysTrapFldCompactText;
200
function FldDirty(const fldP: FieldPtr): Boolean; syscall sysTrapFldDirty;
202
procedure FldSetDirty(fldP: FieldPtr; dirty: Boolean); syscall sysTrapFldSetDirty;
204
function FldGetMaxChars(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetMaxChars;
206
procedure FldSetMaxChars(fldP: FieldPtr; maxChars: UInt16); syscall sysTrapFldSetMaxChars;
208
function FldInsert(fldP: FieldPtr; const insertChars: PChar; insertLen: UInt16): Boolean; syscall sysTrapFldInsert;
210
procedure FldDelete(fldP: FieldPtr; start, end_: UInt16); syscall sysTrapFldDelete;
212
procedure FldUndo(fldP: FieldPtr); syscall sysTrapFldUndo;
214
function FldGetTextAllocatedSize(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextAllocatedSize;
216
procedure FldSetTextAllocatedSize(fldP: FieldPtr; allocatedSize: UInt16); syscall sysTrapFldSetTextAllocatedSize;
218
procedure FldGetAttributes(const fldP: FieldPtr; attrP: FieldAttrPtr); syscall sysTrapFldGetAttributes;
220
procedure FldSetAttributes(fldP: FieldPtr; const attrP: FieldAttrPtr); syscall sysTrapFldSetAttributes;
222
procedure FldSendChangeNotification(const fldP: FieldPtr); syscall sysTrapFldSendChangeNotification;
224
procedure FldSendHeightChangeNotification(const fldP: FieldPtr; pos: UInt16; numLines: Int16); syscall sysTrapFldSendHeightChangeNotification;
226
function FldMakeFullyVisible(fldP: FieldPtr): Boolean; syscall sysTrapFldMakeFullyVisible;
228
function FldGetNumberOfBlankLines(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetNumberOfBlankLines;
230
function FldNewField(formPP: PointerPtr; id: UInt16; x, y, width, height: Coord;
231
font: FontID; maxChars: UInt32; editable, underlined, singleLine, dynamicSize: Boolean;
232
justification: JustificationType; autoShift, hasScrollBar, numeric: Boolean): FieldPtr; syscall sysTrapFldNewField;
235
procedure FldSetMaxVisibleLines(fldP: FieldPtr; maxLines: UInt8); syscall sysTrapFldSetMaxVisibleLines;