blob: 463bcba3cba0b7332c13a3fa3532f66815c623f2 (
plain)
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
|
(******************************************************************************
*
* Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
* All rights reserved.
*
* File: Menu.h
*
* Release: Palm OS SDK 4.0 (63220)
*
* Description:
* This file defines menu structures and routines.
*
* History:
* November 18, 1994 Created by Roger Flores
* Name Date Description
* ---- ---- -----------
* gap 09/29/99 Added gsiWasEnabled to MenuCmdBarType
*
*****************************************************************************)
unit menu_;
interface
uses palmos, coretraps, errorbase, control, event_;
// Errors returned by Menu routines
const
menuErrNoMenu = menuErrorClass or 1;
menuErrNotFound = menuErrorClass or 2;
menuErrSameId = menuErrorClass or 3;
menuErrTooManyItems = menuErrorClass or 4;
menuErrOutOfMemory = menuErrorClass or 5;
// Command bar structures
type
MenuCmdBarResultType = Enum;
const
menuCmdBarResultNone = 0; // send nothing (this'd be quite unusual but is allowed)
menuCmdBarResultChar = Succ(menuCmdBarResultNone); // char to send (with commandKeyMask bit set)
menuCmdBarResultMenuItem = Succ(menuCmdBarResultChar); // id of the menu item
menuCmdBarResultNotify = Succ(menuCmdBarResultMenuItem); // Nofication Manager notification type
// maximum length of the prompt string to display in the command bar
menuCmdBarMaxTextLength = 20;
type
MenuCmdBarButtonType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
bitmapId: UInt16;
name: array [0..menuCmdBarMaxTextLength-1] of Char;
resultType: MenuCmdBarResultType;
reserved: UInt8; // alignment padding
result: UInt32;
{$endif}
end;
MenuCmdBarButtonTag = MenuCmdBarButtonType;
MenuCmdBarType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
bitsBehind: WinHandle;
timeoutTick: Int32; // tick to disappear on
top: Coord;
numButtons: Int16;
insPtWasEnabled: Boolean;
gsiWasEnabled: Boolean;
feedbackMode: Boolean; // set when just displaying confirmation feedback
buttonsData: ^MenuCmdBarButtonType;
{$endif}
end;
// to tell MenuCmdBarAddButton where to add the button: on right or left.
const
menuCmdBarOnRight = 0;
menuCmdBarOnLeft = $ff;
////Menu-specific
noMenuSelection = -1;
noMenuItemSelection = -1;
separatorItemSelection = -2;
// cause codes for menuOpen Event
menuButtonCause = 0;
menuCommandCause = 1;
// To match Apple's ResEdit the first byte of a menu item's text can
// be a special char indicating a special menu item.
MenuSeparatorChar = '-';
type
MenuItemType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
id: UInt16; // id of the menu item
command: Char; // command key
bits: UInt8;
{
UInt8 hidden: 1; // true if menu item is hidden
UInt8 reserved: 7;
}
itemStr: PChar; // string to be displayed
{$endif}
end;
MenuItemTag = MenuItemType;
MenuPullDownType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
menuWin: WinHandle; // window of pull-down menu
bounds: RectangleType; // bounds of the pulldown
bitsBehind: WinHandle; // saving bits behind pull-down menu
titleBounds: RectangleType; // bounds of the title in menu bar
title: PChar; // menu title displayed in menu bar
bits: UInt16;
{
UInt16 hidden: 1; // true if pulldown is hidden
UInt16 numItems: 15; // number of items in the menu
}
items: ^MenuItemType; // array of menu items
{$endif}
end;
MenuPullDownTag = MenuPullDownType;
MenuPullDownPtr = ^MenuPullDownType;
MenuBarAttrType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
bits: UInt16;
{
UInt16 visible :1; // Set if menu bar is drawn
UInt16 commandPending :1; // Set if next key is a command
UInt16 insPtEnabled :1; // Set if insPt was on when menu was drawn
UInt16 needsRecalc :1; // if set then recalc menu dimensions
UInt16 attnIndicatorIsAllowed :1; // set if attn indicator was allowed when menu was drawn
UInt16 reserved :11; // reserved for future use
}
{$endif}
end;
MenuBarAttrTag = MenuBarAttrType;
MenuBarType = record
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
barWin: WinHandle; // window of menu bar
bitsBehind: WinHandle; // saving bits behind menu bar
savedActiveWin: WinHandle;
bitsBehindStatus: WinHandle;
attr: MenuBarAttrType;
curMenu: Int16; // current menu or -1 if none
curItem: Int16; // current item in curMenu, -1 if none
commandTick: Int32;
numMenus: Int16; // number of menus
menus: MenuPullDownPtr; // array of menus
{$endif}
end;
MenuBarTag = MenuBarType;
MenuBarPtr = ^MenuBarType;
function MenuInit(resourceId: UInt16): MenuBarPtr; syscall sysTrapMenuInit;
function MenuGetActiveMenu: MenuBarPtr; syscall sysTrapMenuGetActiveMenu;
function MenuSetActiveMenu(menuP: MenuBarPtr): MenuBarPtr; syscall sysTrapMenuSetActiveMenu;
procedure MenuDispose(menuP: MenuBarPtr); syscall sysTrapMenuDispose;
function MenuHandleEvent(menuP: MenuBarPtr; var event: EventType; var error: UInt16): Boolean; syscall sysTrapMenuHandleEvent;
procedure MenuDrawMenu(menuP: MenuBarPtr); syscall sysTrapMenuDrawMenu;
procedure MenuEraseStatus(menuP: MenuBarPtr); syscall sysTrapMenuEraseStatus;
procedure MenuSetActiveMenuRscID(resourceId: UInt16); syscall sysTrapMenuSetActiveMenuRscID;
function MenuCmdBarAddButton(where: UInt8; bitmapId: UInt16; resultType: MenuCmdBarResultType;
result_: UInt32; nameP: PChar): Err; syscall sysTrapMenuCmdBarAddButton;
function MenuCmdBarGetButtonData(buttonIndex: Int16; var bitmapIdP: UInt16; var resultTypeP: MenuCmdBarResultType;
var resultP: UInt32; nameP: PChar): Boolean; syscall sysTrapMenuCmdBarGetButtonData;
procedure MenuCmdBarDisplay; syscall sysTrapMenuCmdBarDisplay;
function MenuShowItem(id: UInt16): Boolean; syscall sysTrapMenuShowItem;
function MenuHideItem(id: UInt16): Boolean; syscall sysTrapMenuHideItem;
function MenuAddItem(positionId, id: UInt16; cmd: Char; const textP: PChar): Err; syscall sysTrapMenuAddItem;
implementation
end.
|