tkMenu.h 21 KB

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