1 |
578 |
markom |
/*
|
2 |
|
|
* tkMenu.h --
|
3 |
|
|
*
|
4 |
|
|
* Declarations shared among all of the files that implement menu widgets.
|
5 |
|
|
*
|
6 |
|
|
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
|
7 |
|
|
*
|
8 |
|
|
* See the file "license.terms" for information on usage and redistribution
|
9 |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
10 |
|
|
*
|
11 |
|
|
* RCS: @(#) $Id: tkMenu.h,v 1.1.1.1 2002-01-16 10:25:52 markom Exp $
|
12 |
|
|
*/
|
13 |
|
|
|
14 |
|
|
#ifndef _TKMENU
|
15 |
|
|
#define _TKMENU
|
16 |
|
|
|
17 |
|
|
#ifndef _TK
|
18 |
|
|
#include "tk.h"
|
19 |
|
|
#endif
|
20 |
|
|
|
21 |
|
|
#ifndef _TKINT
|
22 |
|
|
#include "tkInt.h"
|
23 |
|
|
#endif
|
24 |
|
|
|
25 |
|
|
#ifndef _DEFAULT
|
26 |
|
|
#include "default.h"
|
27 |
|
|
#endif
|
28 |
|
|
|
29 |
|
|
#ifdef BUILD_tk
|
30 |
|
|
# undef TCL_STORAGE_CLASS
|
31 |
|
|
# define TCL_STORAGE_CLASS DLLEXPORT
|
32 |
|
|
#endif
|
33 |
|
|
|
34 |
|
|
/*
|
35 |
|
|
* Dummy types used by the platform menu code.
|
36 |
|
|
*/
|
37 |
|
|
|
38 |
|
|
typedef struct TkMenuPlatformData_ *TkMenuPlatformData;
|
39 |
|
|
typedef struct TkMenuPlatformEntryData_ *TkMenuPlatformEntryData;
|
40 |
|
|
|
41 |
|
|
/*
|
42 |
|
|
* One of the following data structures is kept for each entry of each
|
43 |
|
|
* menu managed by this file:
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
typedef struct TkMenuEntry {
|
47 |
|
|
int type; /* Type of menu entry; see below for
|
48 |
|
|
* valid types. */
|
49 |
|
|
struct TkMenu *menuPtr; /* Menu with which this entry is associated. */
|
50 |
|
|
char *label; /* Main text label displayed in entry (NULL
|
51 |
|
|
* if no label). Malloc'ed. */
|
52 |
|
|
int labelLength; /* Number of non-NULL characters in label. */
|
53 |
|
|
Tk_Uid state; /* State of button for display purposes:
|
54 |
|
|
* normal, active, or disabled. */
|
55 |
|
|
int underline; /* Index of character to underline. */
|
56 |
|
|
Pixmap bitmap; /* Bitmap to display in menu entry, or None.
|
57 |
|
|
* If not None then label is ignored. */
|
58 |
|
|
char *imageString; /* Name of image to display (malloc'ed), or
|
59 |
|
|
* NULL. If non-NULL, bitmap, text, and
|
60 |
|
|
* textVarName are ignored. */
|
61 |
|
|
Tk_Image image; /* Image to display in menu entry, or NULL if
|
62 |
|
|
* none. */
|
63 |
|
|
char *selectImageString; /* Name of image to display when selected
|
64 |
|
|
* (malloc'ed), or NULL. */
|
65 |
|
|
Tk_Image selectImage; /* Image to display in entry when selected,
|
66 |
|
|
* or NULL if none. Ignored if image is
|
67 |
|
|
* NULL. */
|
68 |
|
|
char *accel; /* Accelerator string displayed at right
|
69 |
|
|
* of menu entry. NULL means no such
|
70 |
|
|
* accelerator. Malloc'ed. */
|
71 |
|
|
int accelLength; /* Number of non-NULL characters in
|
72 |
|
|
* accelerator. */
|
73 |
|
|
int indicatorOn; /* True means draw indicator, false means
|
74 |
|
|
* don't draw it. */
|
75 |
|
|
/*
|
76 |
|
|
* Display attributes
|
77 |
|
|
*/
|
78 |
|
|
|
79 |
|
|
Tk_3DBorder border; /* Structure used to draw background for
|
80 |
|
|
* entry. NULL means use overall border
|
81 |
|
|
* for menu. */
|
82 |
|
|
XColor *fg; /* Foreground color to use for entry. NULL
|
83 |
|
|
* means use foreground color from menu. */
|
84 |
|
|
Tk_3DBorder activeBorder; /* Used to draw background and border when
|
85 |
|
|
* element is active. NULL means use
|
86 |
|
|
* activeBorder from menu. */
|
87 |
|
|
XColor *activeFg; /* Foreground color to use when entry is
|
88 |
|
|
* active. NULL means use active foreground
|
89 |
|
|
* from menu. */
|
90 |
|
|
XColor *indicatorFg; /* Color for indicators in radio and check
|
91 |
|
|
* button entries. NULL means use indicatorFg
|
92 |
|
|
* GC from menu. */
|
93 |
|
|
Tk_Font tkfont; /* Text font for menu entries. NULL means
|
94 |
|
|
* use overall font for menu. */
|
95 |
|
|
int columnBreak; /* If this is 0, this item appears below
|
96 |
|
|
* the item in front of it. If this is
|
97 |
|
|
* 1, this item starts a new column. */
|
98 |
|
|
int hideMargin; /* If this is 0, then the item has enough
|
99 |
|
|
* margin to accomodate a standard check
|
100 |
|
|
* mark and a default right margin. If this
|
101 |
|
|
* is 1, then the item has no such margins.
|
102 |
|
|
* and checkbuttons and radiobuttons with
|
103 |
|
|
* this set will have a rectangle drawn
|
104 |
|
|
* in the indicator around the item if
|
105 |
|
|
* the item is checked.
|
106 |
|
|
* This is useful palette menus.*/
|
107 |
|
|
int indicatorSpace; /* The width of the indicator space for this
|
108 |
|
|
* entry.
|
109 |
|
|
*/
|
110 |
|
|
int labelWidth; /* Number of pixels to allow for displaying
|
111 |
|
|
* labels in menu entries. */
|
112 |
|
|
|
113 |
|
|
/*
|
114 |
|
|
* Information used to implement this entry's action:
|
115 |
|
|
*/
|
116 |
|
|
|
117 |
|
|
char *command; /* Command to invoke when entry is invoked.
|
118 |
|
|
* Malloc'ed. */
|
119 |
|
|
char *name; /* Name of variable (for check buttons and
|
120 |
|
|
* radio buttons) or menu (for cascade
|
121 |
|
|
* entries). Malloc'ed.*/
|
122 |
|
|
char *onValue; /* Value to store in variable when selected
|
123 |
|
|
* (only for radio and check buttons).
|
124 |
|
|
* Malloc'ed. */
|
125 |
|
|
char *offValue; /* Value to store in variable when not
|
126 |
|
|
* selected (only for check buttons).
|
127 |
|
|
* Malloc'ed. */
|
128 |
|
|
|
129 |
|
|
/*
|
130 |
|
|
* Information used for drawing this menu entry.
|
131 |
|
|
*/
|
132 |
|
|
|
133 |
|
|
int width; /* Number of pixels occupied by entry in
|
134 |
|
|
* horizontal dimension. Not used except
|
135 |
|
|
* in menubars. The width of norma menus
|
136 |
|
|
* is dependent on the rest of the menu. */
|
137 |
|
|
int x; /* X-coordinate of leftmost pixel in entry */
|
138 |
|
|
int height; /* Number of pixels occupied by entry in
|
139 |
|
|
* vertical dimension, including raised
|
140 |
|
|
* border drawn around entry when active. */
|
141 |
|
|
int y; /* Y-coordinate of topmost pixel in entry. */
|
142 |
|
|
GC textGC; /* GC for drawing text in entry. NULL means
|
143 |
|
|
* use overall textGC for menu. */
|
144 |
|
|
GC activeGC; /* GC for drawing text in entry when active.
|
145 |
|
|
* NULL means use overall activeGC for
|
146 |
|
|
* menu. */
|
147 |
|
|
GC disabledGC; /* Used to produce disabled effect for entry.
|
148 |
|
|
* NULL means use overall disabledGC from
|
149 |
|
|
* menu structure. See comments for
|
150 |
|
|
* disabledFg in menu structure for more
|
151 |
|
|
* information. */
|
152 |
|
|
GC indicatorGC; /* For drawing indicators. None means use
|
153 |
|
|
* GC from menu. */
|
154 |
|
|
|
155 |
|
|
/*
|
156 |
|
|
* Miscellaneous fields.
|
157 |
|
|
*/
|
158 |
|
|
|
159 |
|
|
int entryFlags; /* Various flags. See below for
|
160 |
|
|
definitions. */
|
161 |
|
|
int index; /* Need to know which index we are. This
|
162 |
|
|
* is zero-based. This is the top-left entry
|
163 |
|
|
* of the menu. */
|
164 |
|
|
|
165 |
|
|
/*
|
166 |
|
|
* Bookeeping for master menus and cascade menus.
|
167 |
|
|
*/
|
168 |
|
|
|
169 |
|
|
struct TkMenuReferences *childMenuRefPtr;
|
170 |
|
|
/* A pointer to the hash table entry for
|
171 |
|
|
* the child menu. Stored here when the menu
|
172 |
|
|
* entry is configured so that a hash lookup
|
173 |
|
|
* is not necessary later.*/
|
174 |
|
|
struct TkMenuEntry *nextCascadePtr;
|
175 |
|
|
/* The next cascade entry that is a parent of
|
176 |
|
|
* this entry's child cascade menu. NULL
|
177 |
|
|
* end of list, this is not a cascade entry,
|
178 |
|
|
* or the menu that this entry point to
|
179 |
|
|
* does not yet exist. */
|
180 |
|
|
TkMenuPlatformEntryData platformEntryData;
|
181 |
|
|
/* The data for the specific type of menu.
|
182 |
|
|
* Depends on platform and menu type what
|
183 |
|
|
* kind of options are in this structure.
|
184 |
|
|
*/
|
185 |
|
|
} TkMenuEntry;
|
186 |
|
|
|
187 |
|
|
/*
|
188 |
|
|
* Flag values defined for menu entries:
|
189 |
|
|
*
|
190 |
|
|
* ENTRY_SELECTED: Non-zero means this is a radio or check
|
191 |
|
|
* button and that it should be drawn in
|
192 |
|
|
* the "selected" state.
|
193 |
|
|
* ENTRY_NEEDS_REDISPLAY: Non-zero means the entry should be redisplayed.
|
194 |
|
|
* ENTRY_LAST_COLUMN: Used by the drawing code. If the entry is in the
|
195 |
|
|
* last column, the space to its right needs to
|
196 |
|
|
* be filled.
|
197 |
|
|
* ENTRY_PLATFORM_FLAG1 - 4 These flags are reserved for use by the
|
198 |
|
|
* platform-dependent implementation of menus
|
199 |
|
|
* and should not be used by anything else.
|
200 |
|
|
*/
|
201 |
|
|
|
202 |
|
|
#define ENTRY_SELECTED 1
|
203 |
|
|
#define ENTRY_NEEDS_REDISPLAY 2
|
204 |
|
|
#define ENTRY_LAST_COLUMN 4
|
205 |
|
|
#define ENTRY_PLATFORM_FLAG1 (1 << 30)
|
206 |
|
|
#define ENTRY_PLATFORM_FLAG2 (1 << 29)
|
207 |
|
|
#define ENTRY_PLATFORM_FLAG3 (1 << 28)
|
208 |
|
|
#define ENTRY_PLATFORM_FLAG4 (1 << 27)
|
209 |
|
|
|
210 |
|
|
/*
|
211 |
|
|
* Types defined for MenuEntries:
|
212 |
|
|
*/
|
213 |
|
|
|
214 |
|
|
#define COMMAND_ENTRY 0
|
215 |
|
|
#define SEPARATOR_ENTRY 1
|
216 |
|
|
#define CHECK_BUTTON_ENTRY 2
|
217 |
|
|
#define RADIO_BUTTON_ENTRY 3
|
218 |
|
|
#define CASCADE_ENTRY 4
|
219 |
|
|
#define TEAROFF_ENTRY 5
|
220 |
|
|
|
221 |
|
|
/*
|
222 |
|
|
* Mask bits for above types:
|
223 |
|
|
*/
|
224 |
|
|
|
225 |
|
|
#define COMMAND_MASK TK_CONFIG_USER_BIT
|
226 |
|
|
#define SEPARATOR_MASK (TK_CONFIG_USER_BIT << 1)
|
227 |
|
|
#define CHECK_BUTTON_MASK (TK_CONFIG_USER_BIT << 2)
|
228 |
|
|
#define RADIO_BUTTON_MASK (TK_CONFIG_USER_BIT << 3)
|
229 |
|
|
#define CASCADE_MASK (TK_CONFIG_USER_BIT << 4)
|
230 |
|
|
#define TEAROFF_MASK (TK_CONFIG_USER_BIT << 5)
|
231 |
|
|
#define ALL_MASK (COMMAND_MASK | SEPARATOR_MASK \
|
232 |
|
|
| CHECK_BUTTON_MASK | RADIO_BUTTON_MASK | CASCADE_MASK | TEAROFF_MASK)
|
233 |
|
|
|
234 |
|
|
/*
|
235 |
|
|
* A data structure of the following type is kept for each
|
236 |
|
|
* menu widget:
|
237 |
|
|
*/
|
238 |
|
|
|
239 |
|
|
typedef struct TkMenu {
|
240 |
|
|
Tk_Window tkwin; /* Window that embodies the pane. NULL
|
241 |
|
|
* means that the window has been destroyed
|
242 |
|
|
* but the data structures haven't yet been
|
243 |
|
|
* cleaned up.*/
|
244 |
|
|
Display *display; /* Display containing widget. Needed, among
|
245 |
|
|
* other things, so that resources can be
|
246 |
|
|
* freed up even after tkwin has gone away. */
|
247 |
|
|
Tcl_Interp *interp; /* Interpreter associated with menu. */
|
248 |
|
|
Tcl_Command widgetCmd; /* Token for menu's widget command. */
|
249 |
|
|
TkMenuEntry **entries; /* Array of pointers to all the entries
|
250 |
|
|
* in the menu. NULL means no entries. */
|
251 |
|
|
int numEntries; /* Number of elements in entries. */
|
252 |
|
|
int active; /* Index of active entry. -1 means
|
253 |
|
|
* nothing active. */
|
254 |
|
|
int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR.
|
255 |
|
|
* See below for definitions. */
|
256 |
|
|
char *menuTypeName; /* Used to control whether created tkwin
|
257 |
|
|
* is a toplevel or not. "normal", "menubar",
|
258 |
|
|
* or "toplevel" */
|
259 |
|
|
|
260 |
|
|
/*
|
261 |
|
|
* Information used when displaying widget:
|
262 |
|
|
*/
|
263 |
|
|
|
264 |
|
|
Tk_3DBorder border; /* Structure used to draw 3-D
|
265 |
|
|
* border and background for menu. */
|
266 |
|
|
int borderWidth; /* Width of border around whole menu. */
|
267 |
|
|
Tk_3DBorder activeBorder; /* Used to draw background and border for
|
268 |
|
|
* active element (if any). */
|
269 |
|
|
int activeBorderWidth; /* Width of border around active element. */
|
270 |
|
|
int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */
|
271 |
|
|
Tk_Font tkfont; /* Text font for menu entries. */
|
272 |
|
|
XColor *fg; /* Foreground color for entries. */
|
273 |
|
|
XColor *disabledFg; /* Foreground color when disabled. NULL
|
274 |
|
|
* means use normalFg with a 50% stipple
|
275 |
|
|
* instead. */
|
276 |
|
|
XColor *activeFg; /* Foreground color for active entry. */
|
277 |
|
|
XColor *indicatorFg; /* Color for indicators in radio and check
|
278 |
|
|
* button entries. */
|
279 |
|
|
Pixmap gray; /* Bitmap for drawing disabled entries in
|
280 |
|
|
* a stippled fashion. None means not
|
281 |
|
|
* allocated yet. */
|
282 |
|
|
GC textGC; /* GC for drawing text and other features
|
283 |
|
|
* of menu entries. */
|
284 |
|
|
GC disabledGC; /* Used to produce disabled effect. If
|
285 |
|
|
* disabledFg isn't NULL, this GC is used to
|
286 |
|
|
* draw text and icons for disabled entries.
|
287 |
|
|
* Otherwise text and icons are drawn with
|
288 |
|
|
* normalGC and this GC is used to stipple
|
289 |
|
|
* background across them. */
|
290 |
|
|
GC activeGC; /* GC for drawing active entry. */
|
291 |
|
|
GC indicatorGC; /* For drawing indicators. */
|
292 |
|
|
GC disabledImageGC; /* Used for drawing disabled images. They
|
293 |
|
|
* have to be stippled. This is created
|
294 |
|
|
* when the image is about to be drawn the
|
295 |
|
|
* first time. */
|
296 |
|
|
|
297 |
|
|
/*
|
298 |
|
|
* Information about geometry of menu.
|
299 |
|
|
*/
|
300 |
|
|
|
301 |
|
|
int totalWidth; /* Width of entire menu */
|
302 |
|
|
int totalHeight; /* Height of entire menu */
|
303 |
|
|
|
304 |
|
|
/*
|
305 |
|
|
* Miscellaneous information:
|
306 |
|
|
*/
|
307 |
|
|
|
308 |
|
|
int tearOff; /* 1 means this menu can be torn off. On some
|
309 |
|
|
* platforms, the user can drag an outline
|
310 |
|
|
* of the menu by just dragging outside of
|
311 |
|
|
* the menu, and the tearoff is created where
|
312 |
|
|
* the mouse is released. On others, an
|
313 |
|
|
* indicator (such as a dashed stripe) is
|
314 |
|
|
* drawn, and when the menu is selected, the
|
315 |
|
|
* tearoff is created. */
|
316 |
|
|
char *title; /* The title to use when this menu is torn
|
317 |
|
|
* off. If this is NULL, a default scheme
|
318 |
|
|
* will be used to generate a title for
|
319 |
|
|
* tearoff. */
|
320 |
|
|
char *tearOffCommand; /* If non-NULL, points to a command to
|
321 |
|
|
* run whenever the menu is torn-off. */
|
322 |
|
|
char *takeFocus; /* Value of -takefocus option; not used in
|
323 |
|
|
* the C code, but used by keyboard traversal
|
324 |
|
|
* scripts. Malloc'ed, but may be NULL. */
|
325 |
|
|
Tk_Cursor cursor; /* Current cursor for window, or None. */
|
326 |
|
|
char *postCommand; /* Used to detect cycles in cascade hierarchy
|
327 |
|
|
* trees when preprocessing postcommands
|
328 |
|
|
* on some platforms. See PostMenu for
|
329 |
|
|
* more details. */
|
330 |
|
|
int postCommandGeneration; /* Need to do pre-invocation post command
|
331 |
|
|
* traversal */
|
332 |
|
|
int menuFlags; /* Flags for use by X; see below for
|
333 |
|
|
definition */
|
334 |
|
|
TkMenuEntry *postedCascade; /* Points to menu entry for cascaded submenu
|
335 |
|
|
* that is currently posted or NULL if no
|
336 |
|
|
* submenu posted. */
|
337 |
|
|
struct TkMenu *nextInstancePtr;
|
338 |
|
|
/* The next instance of this menu in the
|
339 |
|
|
* chain. */
|
340 |
|
|
struct TkMenu *masterMenuPtr;
|
341 |
|
|
/* A pointer to the original menu for this
|
342 |
|
|
* clone chain. Points back to this structure
|
343 |
|
|
* if this menu is a master menu. */
|
344 |
|
|
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
|
345 |
|
|
* toplevel that owns the menu. Only applicable
|
346 |
|
|
* for menubar clones.
|
347 |
|
|
*/
|
348 |
|
|
struct TkMenuReferences *menuRefPtr;
|
349 |
|
|
/* Each menu is hashed into a table with the
|
350 |
|
|
* name of the menu's window as the key.
|
351 |
|
|
* The information in this hash table includes
|
352 |
|
|
* a pointer to the menu (so that cascades
|
353 |
|
|
* can find this menu), a pointer to the
|
354 |
|
|
* list of toplevel widgets that have this
|
355 |
|
|
* menu as its menubar, and a list of menu
|
356 |
|
|
* entries that have this menu specified
|
357 |
|
|
* as a cascade. */
|
358 |
|
|
TkMenuPlatformData platformData;
|
359 |
|
|
/* The data for the specific type of menu.
|
360 |
|
|
* Depends on platform and menu type what
|
361 |
|
|
* kind of options are in this structure.
|
362 |
|
|
*/
|
363 |
|
|
} TkMenu;
|
364 |
|
|
|
365 |
|
|
/*
|
366 |
|
|
* When the toplevel configure -menu command is executed, the menu may not
|
367 |
|
|
* exist yet. We need to keep a linked list of windows that reference
|
368 |
|
|
* a particular menu.
|
369 |
|
|
*/
|
370 |
|
|
|
371 |
|
|
typedef struct TkMenuTopLevelList {
|
372 |
|
|
struct TkMenuTopLevelList *nextPtr;
|
373 |
|
|
/* The next window in the list */
|
374 |
|
|
Tk_Window tkwin; /* The window that has this menu as its
|
375 |
|
|
* menubar. */
|
376 |
|
|
} TkMenuTopLevelList;
|
377 |
|
|
|
378 |
|
|
/*
|
379 |
|
|
* The following structure is used to keep track of things which
|
380 |
|
|
* reference a menu. It is created when:
|
381 |
|
|
* - a menu is created.
|
382 |
|
|
* - a cascade entry is added to a menu with a non-null name
|
383 |
|
|
* - the "-menu" configuration option is used on a toplevel widget
|
384 |
|
|
* with a non-null parameter.
|
385 |
|
|
*
|
386 |
|
|
* One of these three fields must be non-NULL, but any of the fields may
|
387 |
|
|
* be NULL. This structure makes it easy to determine whether or not
|
388 |
|
|
* anything like recalculating platform data or geometry is necessary
|
389 |
|
|
* when one of the three actions above is performed.
|
390 |
|
|
*/
|
391 |
|
|
|
392 |
|
|
typedef struct TkMenuReferences {
|
393 |
|
|
struct TkMenu *menuPtr; /* The menu data structure. This is NULL
|
394 |
|
|
* if the menu does not exist. */
|
395 |
|
|
TkMenuTopLevelList *topLevelListPtr;
|
396 |
|
|
/* First in the list of all toplevels that
|
397 |
|
|
* have this menu as its menubar. NULL if no
|
398 |
|
|
* toplevel widgets have this menu as its
|
399 |
|
|
* menubar. */
|
400 |
|
|
TkMenuEntry *parentEntryPtr;/* First in the list of all cascade menu
|
401 |
|
|
* entries that have this menu as their child.
|
402 |
|
|
* NULL means no cascade entries. */
|
403 |
|
|
Tcl_HashEntry *hashEntryPtr;/* This is needed because the pathname of the
|
404 |
|
|
* window (which is what we hash on) may not
|
405 |
|
|
* be around when we are deleting.
|
406 |
|
|
*/
|
407 |
|
|
} TkMenuReferences;
|
408 |
|
|
|
409 |
|
|
/*
|
410 |
|
|
* Flag bits for menus:
|
411 |
|
|
*
|
412 |
|
|
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler
|
413 |
|
|
* has already been queued to redraw
|
414 |
|
|
* this window.
|
415 |
|
|
* RESIZE_PENDING: Non-zero means a call to ComputeMenuGeometry
|
416 |
|
|
* has already been scheduled.
|
417 |
|
|
* MENU_DELETION_PENDING Non-zero means that we are currently destroying
|
418 |
|
|
* this menu. This is useful when we are in the
|
419 |
|
|
* middle of cleaning this master menu's chain of
|
420 |
|
|
* menus up when TkDestroyMenu was called again on
|
421 |
|
|
* this menu (via a destroy binding or somesuch).
|
422 |
|
|
* MENU_PLATFORM_FLAG1... Reserved for use by the platform-specific menu
|
423 |
|
|
* code.
|
424 |
|
|
*/
|
425 |
|
|
|
426 |
|
|
#define REDRAW_PENDING 1
|
427 |
|
|
#define RESIZE_PENDING 2
|
428 |
|
|
#define MENU_DELETION_PENDING 4
|
429 |
|
|
#define MENU_PLATFORM_FLAG1 (1 << 30)
|
430 |
|
|
#define MENU_PLATFORM_FLAG2 (1 << 29)
|
431 |
|
|
#define MENU_PLATFORM_FLAG3 (1 << 28)
|
432 |
|
|
|
433 |
|
|
/*
|
434 |
|
|
* Each menu created by the user is a MASTER_MENU. When a menu is torn off,
|
435 |
|
|
* a TEAROFF_MENU instance is created. When a menu is assigned to a toplevel
|
436 |
|
|
* as a menu bar, a MENUBAR instance is created. All instances have the same
|
437 |
|
|
* configuration information. If the master instance is deleted, all instances
|
438 |
|
|
* are deleted. If one of the other instances is deleted, only that instance
|
439 |
|
|
* is deleted.
|
440 |
|
|
*/
|
441 |
|
|
|
442 |
|
|
#define UNKNOWN_TYPE -1
|
443 |
|
|
#define MASTER_MENU 0
|
444 |
|
|
#define TEAROFF_MENU 1
|
445 |
|
|
#define MENUBAR 2
|
446 |
|
|
|
447 |
|
|
/*
|
448 |
|
|
* Various geometry definitions:
|
449 |
|
|
*/
|
450 |
|
|
|
451 |
|
|
#define CASCADE_ARROW_HEIGHT 10
|
452 |
|
|
#define CASCADE_ARROW_WIDTH 8
|
453 |
|
|
#define DECORATION_BORDER_WIDTH 2
|
454 |
|
|
|
455 |
|
|
/*
|
456 |
|
|
* Configuration specs. Needed for platform-specific default initializations.
|
457 |
|
|
*/
|
458 |
|
|
|
459 |
|
|
EXTERN Tk_ConfigSpec tkMenuEntryConfigSpecs[];
|
460 |
|
|
EXTERN Tk_ConfigSpec tkMenuConfigSpecs[];
|
461 |
|
|
|
462 |
|
|
/*
|
463 |
|
|
* Menu-related procedures that are shared among Tk modules but not exported
|
464 |
|
|
* to the outside world:
|
465 |
|
|
*/
|
466 |
|
|
|
467 |
|
|
EXTERN int TkActivateMenuEntry _ANSI_ARGS_((TkMenu *menuPtr,
|
468 |
|
|
int index));
|
469 |
|
|
EXTERN void TkBindMenu _ANSI_ARGS_((
|
470 |
|
|
Tk_Window tkwin, TkMenu *menuPtr));
|
471 |
|
|
EXTERN TkMenuReferences *
|
472 |
|
|
TkCreateMenuReferences _ANSI_ARGS_((Tcl_Interp *interp,
|
473 |
|
|
char *pathName));
|
474 |
|
|
EXTERN void TkDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
475 |
|
|
EXTERN void TkEventuallyRecomputeMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
476 |
|
|
EXTERN void TkEventuallyRedrawMenu _ANSI_ARGS_((
|
477 |
|
|
TkMenu *menuPtr, TkMenuEntry *mePtr));
|
478 |
|
|
EXTERN TkMenuReferences *
|
479 |
|
|
TkFindMenuReferences _ANSI_ARGS_((Tcl_Interp *interp,
|
480 |
|
|
char *pathName));
|
481 |
|
|
EXTERN void TkFreeMenuReferences _ANSI_ARGS_((
|
482 |
|
|
TkMenuReferences *menuRefPtr));
|
483 |
|
|
EXTERN Tcl_HashTable * TkGetMenuHashTable _ANSI_ARGS_((Tcl_Interp *interp));
|
484 |
|
|
EXTERN int TkGetMenuIndex _ANSI_ARGS_((Tcl_Interp *interp,
|
485 |
|
|
TkMenu *menuPtr, char *string, int lastOK,
|
486 |
|
|
int *indexPtr));
|
487 |
|
|
EXTERN void TkMenuInitializeDrawingFields _ANSI_ARGS_((TkMenu *menuPtr));
|
488 |
|
|
EXTERN void TkMenuInitializeEntryDrawingFields _ANSI_ARGS_((
|
489 |
|
|
TkMenuEntry *mePtr));
|
490 |
|
|
EXTERN int TkInvokeMenu _ANSI_ARGS_((Tcl_Interp *interp,
|
491 |
|
|
TkMenu *menuPtr, int index));
|
492 |
|
|
EXTERN void TkMenuConfigureDrawOptions _ANSI_ARGS_((
|
493 |
|
|
TkMenu *menuPtr));
|
494 |
|
|
EXTERN int TkMenuConfigureEntryDrawOptions _ANSI_ARGS_((
|
495 |
|
|
TkMenuEntry *mePtr, int index));
|
496 |
|
|
EXTERN void TkMenuFreeDrawOptions _ANSI_ARGS_((TkMenu *menuPtr));
|
497 |
|
|
EXTERN void TkMenuEntryFreeDrawOptions _ANSI_ARGS_((
|
498 |
|
|
TkMenuEntry *mePtr));
|
499 |
|
|
EXTERN void TkMenuEventProc _ANSI_ARGS_((ClientData clientData,
|
500 |
|
|
XEvent *eventPtr));
|
501 |
|
|
EXTERN void TkMenuImageProc _ANSI_ARGS_((
|
502 |
|
|
ClientData clientData, int x, int y, int width,
|
503 |
|
|
int height, int imgWidth, int imgHeight));
|
504 |
|
|
EXTERN void TkMenuInit _ANSI_ARGS_((void));
|
505 |
|
|
EXTERN void TkMenuSelectImageProc _ANSI_ARGS_
|
506 |
|
|
((ClientData clientData, int x, int y,
|
507 |
|
|
int width, int height, int imgWidth,
|
508 |
|
|
int imgHeight));
|
509 |
|
|
EXTERN char * TkNewMenuName _ANSI_ARGS_((Tcl_Interp *interp,
|
510 |
|
|
char *parentName, TkMenu *menuPtr));
|
511 |
|
|
EXTERN int TkPostCommand _ANSI_ARGS_((TkMenu *menuPtr));
|
512 |
|
|
EXTERN int TkPostSubmenu _ANSI_ARGS_((Tcl_Interp *interp,
|
513 |
|
|
TkMenu *menuPtr, TkMenuEntry *mePtr));
|
514 |
|
|
EXTERN int TkPostTearoffMenu _ANSI_ARGS_((Tcl_Interp *interp,
|
515 |
|
|
TkMenu *menuPtr, int x, int y));
|
516 |
|
|
EXTERN int TkPreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
517 |
|
|
EXTERN void TkRecomputeMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
518 |
|
|
|
519 |
|
|
/*
|
520 |
|
|
* These routines are the platform-dependent routines called by the
|
521 |
|
|
* common code.
|
522 |
|
|
*/
|
523 |
|
|
|
524 |
|
|
EXTERN void TkpComputeMenubarGeometry _ANSI_ARGS_((TkMenu *menuPtr));
|
525 |
|
|
EXTERN void TkpComputeStandardMenuGeometry _ANSI_ARGS_
|
526 |
|
|
((TkMenu *menuPtr));
|
527 |
|
|
EXTERN int TkpConfigureMenuEntry
|
528 |
|
|
_ANSI_ARGS_((TkMenuEntry *mePtr));
|
529 |
|
|
EXTERN void TkpDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
530 |
|
|
EXTERN void TkpDestroyMenuEntry
|
531 |
|
|
_ANSI_ARGS_((TkMenuEntry *mEntryPtr));
|
532 |
|
|
EXTERN void TkpDrawMenuEntry _ANSI_ARGS_((TkMenuEntry *mePtr,
|
533 |
|
|
Drawable d, Tk_Font tkfont,
|
534 |
|
|
CONST Tk_FontMetrics *menuMetricsPtr, int x,
|
535 |
|
|
int y, int width, int height, int strictMotif,
|
536 |
|
|
int drawArrow));
|
537 |
|
|
EXTERN void TkpMenuInit _ANSI_ARGS_((void));
|
538 |
|
|
EXTERN int TkpMenuNewEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
|
539 |
|
|
EXTERN int TkpNewMenu _ANSI_ARGS_((TkMenu *menuPtr));
|
540 |
|
|
EXTERN int TkpPostMenu _ANSI_ARGS_((Tcl_Interp *interp,
|
541 |
|
|
TkMenu *menuPtr, int x, int y));
|
542 |
|
|
EXTERN void TkpSetWindowMenuBar _ANSI_ARGS_((Tk_Window tkwin,
|
543 |
|
|
TkMenu *menuPtr));
|
544 |
|
|
|
545 |
|
|
# undef TCL_STORAGE_CLASS
|
546 |
|
|
# define TCL_STORAGE_CLASS DLLIMPORT
|
547 |
|
|
|
548 |
|
|
#endif /* _TKMENU */
|
549 |
|
|
|