📄 tkmenu.h
字号:
XColor *activeFg; /* Foreground color for active entry. */ XColor *indicatorFg; /* Color for indicators in radio and check * button entries. */ Pixmap gray; /* Bitmap for drawing disabled entries in * a stippled fashion. None means not * allocated yet. */ GC textGC; /* GC for drawing text and other features * of menu entries. */ GC disabledGC; /* Used to produce disabled effect. If * disabledFg isn't NULL, this GC is used to * draw text and icons for disabled entries. * Otherwise text and icons are drawn with * normalGC and this GC is used to stipple * background across them. */ GC activeGC; /* GC for drawing active entry. */ GC indicatorGC; /* For drawing indicators. */ GC disabledImageGC; /* Used for drawing disabled images. They * have to be stippled. This is created * when the image is about to be drawn the * first time. */ /* * Information about geometry of menu. */ int totalWidth; /* Width of entire menu */ int totalHeight; /* Height of entire menu */ /* * Miscellaneous information: */ int tearOff; /* 1 means this menu can be torn off. On some * platforms, the user can drag an outline * of the menu by just dragging outside of * the menu, and the tearoff is created where * the mouse is released. On others, an * indicator (such as a dashed stripe) is * drawn, and when the menu is selected, the * tearoff is created. */ char *title; /* The title to use when this menu is torn * off. If this is NULL, a default scheme * will be used to generate a title for * tearoff. */ char *tearOffCommand; /* If non-NULL, points to a command to * run whenever the menu is torn-off. */ char *takeFocus; /* Value of -takefocus option; not used in * the C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ Tk_Cursor cursor; /* Current cursor for window, or None. */ char *postCommand; /* Used to detect cycles in cascade hierarchy * trees when preprocessing postcommands * on some platforms. See PostMenu for * more details. */ int postCommandGeneration; /* Need to do pre-invocation post command * traversal */ int menuFlags; /* Flags for use by X; see below for definition */ TkMenuEntry *postedCascade; /* Points to menu entry for cascaded submenu * that is currently posted or NULL if no * submenu posted. */ struct TkMenu *nextInstancePtr; /* The next instance of this menu in the * chain. */ struct TkMenu *masterMenuPtr; /* A pointer to the original menu for this * clone chain. Points back to this structure * if this menu is a master menu. */ Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the * toplevel that owns the menu. Only applicable * for menubar clones. */ struct TkMenuReferences *menuRefPtr; /* Each menu is hashed into a table with the * name of the menu's window as the key. * The information in this hash table includes * a pointer to the menu (so that cascades * can find this menu), a pointer to the * list of toplevel widgets that have this * menu as its menubar, and a list of menu * entries that have this menu specified * as a cascade. */ TkMenuPlatformData platformData; /* The data for the specific type of menu. * Depends on platform and menu type what * kind of options are in this structure. */} TkMenu;/* * When the toplevel configure -menu command is executed, the menu may not * exist yet. We need to keep a linked list of windows that reference * a particular menu. */typedef struct TkMenuTopLevelList { struct TkMenuTopLevelList *nextPtr; /* The next window in the list */ Tk_Window tkwin; /* The window that has this menu as its * menubar. */} TkMenuTopLevelList;/* * The following structure is used to keep track of things which * reference a menu. It is created when: * - a menu is created. * - a cascade entry is added to a menu with a non-null name * - the "-menu" configuration option is used on a toplevel widget * with a non-null parameter. * * One of these three fields must be non-NULL, but any of the fields may * be NULL. This structure makes it easy to determine whether or not * anything like recalculating platform data or geometry is necessary * when one of the three actions above is performed. */typedef struct TkMenuReferences { struct TkMenu *menuPtr; /* The menu data structure. This is NULL * if the menu does not exist. */ TkMenuTopLevelList *topLevelListPtr; /* First in the list of all toplevels that * have this menu as its menubar. NULL if no * toplevel widgets have this menu as its * menubar. */ TkMenuEntry *parentEntryPtr;/* First in the list of all cascade menu * entries that have this menu as their child. * NULL means no cascade entries. */ Tcl_HashEntry *hashEntryPtr;/* This is needed because the pathname of the * window (which is what we hash on) may not * be around when we are deleting. */} TkMenuReferences;/* * Flag bits for menus: * * REDRAW_PENDING: Non-zero means a DoWhenIdle handler * has already been queued to redraw * this window. * RESIZE_PENDING: Non-zero means a call to ComputeMenuGeometry * has already been scheduled. * MENU_DELETION_PENDING Non-zero means that we are currently destroying * this menu. This is useful when we are in the * middle of cleaning this master menu's chain of * menus up when TkDestroyMenu was called again on * this menu (via a destroy binding or somesuch). * MENU_PLATFORM_FLAG1... Reserved for use by the platform-specific menu * code. */#define REDRAW_PENDING 1#define RESIZE_PENDING 2#define MENU_DELETION_PENDING 4#define MENU_PLATFORM_FLAG1 (1 << 30)#define MENU_PLATFORM_FLAG2 (1 << 29)#define MENU_PLATFORM_FLAG3 (1 << 28)/* * Each menu created by the user is a MASTER_MENU. When a menu is torn off, * a TEAROFF_MENU instance is created. When a menu is assigned to a toplevel * as a menu bar, a MENUBAR instance is created. All instances have the same * configuration information. If the master instance is deleted, all instances * are deleted. If one of the other instances is deleted, only that instance * is deleted. */ #define UNKNOWN_TYPE -1#define MASTER_MENU 0#define TEAROFF_MENU 1#define MENUBAR 2/* * Various geometry definitions: */#define CASCADE_ARROW_HEIGHT 10#define CASCADE_ARROW_WIDTH 8#define DECORATION_BORDER_WIDTH 2/* * Configuration specs. Needed for platform-specific default initializations. */EXTERN Tk_ConfigSpec tkMenuEntryConfigSpecs[];EXTERN Tk_ConfigSpec tkMenuConfigSpecs[];/* * Menu-related procedures that are shared among Tk modules but not exported * to the outside world: */EXTERN int TkActivateMenuEntry _ANSI_ARGS_((TkMenu *menuPtr, int index));EXTERN void TkBindMenu _ANSI_ARGS_(( Tk_Window tkwin, TkMenu *menuPtr));EXTERN TkMenuReferences * TkCreateMenuReferences _ANSI_ARGS_((Tcl_Interp *interp, char *pathName));EXTERN void TkDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkEventuallyRecomputeMenu _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkEventuallyRedrawMenu _ANSI_ARGS_(( TkMenu *menuPtr, TkMenuEntry *mePtr));EXTERN TkMenuReferences * TkFindMenuReferences _ANSI_ARGS_((Tcl_Interp *interp, char *pathName));EXTERN void TkFreeMenuReferences _ANSI_ARGS_(( TkMenuReferences *menuRefPtr));EXTERN Tcl_HashTable * TkGetMenuHashTable _ANSI_ARGS_((Tcl_Interp *interp));EXTERN int TkGetMenuIndex _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr, char *string, int lastOK, int *indexPtr));EXTERN void TkMenuInitializeDrawingFields _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkMenuInitializeEntryDrawingFields _ANSI_ARGS_(( TkMenuEntry *mePtr));EXTERN int TkInvokeMenu _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr, int index));EXTERN void TkMenuConfigureDrawOptions _ANSI_ARGS_(( TkMenu *menuPtr));EXTERN int TkMenuConfigureEntryDrawOptions _ANSI_ARGS_(( TkMenuEntry *mePtr, int index));EXTERN void TkMenuFreeDrawOptions _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkMenuEntryFreeDrawOptions _ANSI_ARGS_(( TkMenuEntry *mePtr));EXTERN void TkMenuEventProc _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));EXTERN void TkMenuImageProc _ANSI_ARGS_(( ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight));EXTERN void TkMenuInit _ANSI_ARGS_((void));EXTERN void TkMenuSelectImageProc _ANSI_ARGS_ ((ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight));EXTERN char * TkNewMenuName _ANSI_ARGS_((Tcl_Interp *interp, char *parentName, TkMenu *menuPtr));EXTERN int TkPostCommand _ANSI_ARGS_((TkMenu *menuPtr));EXTERN int TkPostSubmenu _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr, TkMenuEntry *mePtr));EXTERN int TkPostTearoffMenu _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr, int x, int y));EXTERN int TkPreprocessMenu _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkRecomputeMenu _ANSI_ARGS_((TkMenu *menuPtr));/* * These routines are the platform-dependent routines called by the * common code. */EXTERN void TkpComputeMenubarGeometry _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkpComputeStandardMenuGeometry _ANSI_ARGS_ ((TkMenu *menuPtr));EXTERN int TkpConfigureMenuEntry _ANSI_ARGS_((TkMenuEntry *mePtr));EXTERN void TkpDestroyMenu _ANSI_ARGS_((TkMenu *menuPtr));EXTERN void TkpDestroyMenuEntry _ANSI_ARGS_((TkMenuEntry *mEntryPtr));EXTERN void TkpDrawMenuEntry _ANSI_ARGS_((TkMenuEntry *mePtr, Drawable d, Tk_Font tkfont, CONST Tk_FontMetrics *menuMetricsPtr, int x, int y, int width, int height, int strictMotif, int drawArrow));EXTERN void TkpMenuInit _ANSI_ARGS_((void));EXTERN int TkpMenuNewEntry _ANSI_ARGS_((TkMenuEntry *mePtr));EXTERN int TkpNewMenu _ANSI_ARGS_((TkMenu *menuPtr));EXTERN int TkpPostMenu _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr, int x, int y));EXTERN void TkpSetWindowMenuBar _ANSI_ARGS_((Tk_Window tkwin, TkMenu *menuPtr));# undef TCL_STORAGE_CLASS# define TCL_STORAGE_CLASS DLLIMPORT#endif /* _TKMENU */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -