diff options
Diffstat (limited to 'generic/tkMenu.h')
-rw-r--r-- | generic/tkMenu.h | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/generic/tkMenu.h b/generic/tkMenu.h index ccc365a..ffe6770 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -4,7 +4,7 @@ * Declarations shared among all of the files that implement menu * widgets. * - * Copyright (c) 1996-1998 Sun Microsystems, Inc. + * Copyright © 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -64,11 +64,11 @@ typedef struct TkMenuEntry { Tk_OptionTable optionTable; /* Option table for this menu entry. */ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if * no label). */ - int labelLength; /* Number of non-NULL characters in label. */ + Tcl_Size labelLength; /* Number of non-NULL characters in label. */ int state; /* State of button for display purposes: * normal, active, or disabled. */ int underline; /* Value of -underline option: specifies index - * of character to underline (<0 means don't + * of character to underline (-1 means don't * underline anything). */ Tcl_Obj *underlinePtr; /* Index of character to underline. */ Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL. @@ -85,7 +85,7 @@ typedef struct TkMenuEntry { Tcl_Obj *accelPtr; /* Accelerator string displayed at right of * menu entry. NULL means no such accelerator. * Malloc'ed. */ - int accelLength; /* Number of non-NULL characters in + Tcl_Size accelLength; /* Number of non-NULL characters in * accelerator. */ int indicatorOn; /* True means draw indicator, false means * don't draw it. This field is ignored unless @@ -183,6 +183,7 @@ typedef struct TkMenuEntry { int index; /* Need to know which index we are. This is * zero-based. This is the top-left entry of * the menu. */ + Tcl_HashEntry *entryPtr; /* Back-pointer to hash table entry */ /* * Bookeeping for main menus and cascade menus. @@ -244,8 +245,8 @@ typedef struct TkMenuEntry { */ #define ENTRY_ACTIVE 0 -#define ENTRY_NORMAL 1 -#define ENTRY_DISABLED 2 +#define ENTRY_DISABLED 1 +#define ENTRY_NORMAL 2 /* * A data structure of the following type is kept for each menu widget: @@ -263,9 +264,9 @@ typedef struct TkMenu { Tcl_Command widgetCmd; /* Token for menu's widget command. */ TkMenuEntry **entries; /* Array of pointers to all the entries in the * menu. NULL means no entries. */ - int numEntries; /* Number of elements in entries. */ - int active; /* Index of active entry. -1 means nothing - * active. */ + Tcl_Size numEntries; /* Number of elements in entries. */ + Tcl_Size active; /* Index of active entry. TCL_INDEX_NONE means + * nothing active. */ int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See * below for definitions. */ Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a @@ -351,7 +352,7 @@ typedef struct TkMenu { struct TkMenu *nextInstancePtr; /* The next instance of this menu in the * chain. */ - struct TkMenu *masterMenuPtr; + struct TkMenu *mainMenuPtr; /* A pointer to the original menu for this * clone chain. Points back to this structure * if this menu is a main menu. */ @@ -378,6 +379,9 @@ typedef struct TkMenu { /* We actually have to allocate these because * multiple menus get changed during one * ConfigureMenu call. */ + Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */ + Tcl_HashTable items; /* Map: id -> entry */ + int serial; /* Next item # for autogenerated ids */ } TkMenu; /* @@ -460,10 +464,9 @@ typedef struct TkMenuReferences { */ #define UNKNOWN_TYPE -1 -#define MAIN_MENU 0 -#define MASTER_MENU 0 -#define TEAROFF_MENU 1 -#define MENUBAR 2 +#define MENUBAR 0 +#define MAIN_MENU 1 +#define TEAROFF_MENU 2 /* * Various geometry definitions: @@ -478,7 +481,7 @@ typedef struct TkMenuReferences { * the outside world: */ -MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, int index); +MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, Tcl_Size index); MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu *menuPtr); MODULE_SCOPE TkMenuReferences*TkCreateMenuReferences(Tcl_Interp *interp, const char *name); @@ -491,24 +494,22 @@ MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp, Tcl_Obj *namePtr); MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr); MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp); -MODULE_SCOPE int TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr, - Tcl_Obj *objPtr, int lastOK, int *indexPtr); MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr); MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr); MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int index); + Tcl_Size index); MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu *menuPtr); MODULE_SCOPE int TkMenuConfigureEntryDrawOptions( - TkMenuEntry *mePtr, int index); + TkMenuEntry *mePtr, Tcl_Size index); MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu *menuPtr); MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry *mePtr); -MODULE_SCOPE void TkMenuEventProc(ClientData clientData, +MODULE_SCOPE void TkMenuEventProc(void *clientData, XEvent *eventPtr); -MODULE_SCOPE void TkMenuImageProc(ClientData clientData, int x, int y, +MODULE_SCOPE void TkMenuImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); MODULE_SCOPE void TkMenuInit(void); -MODULE_SCOPE void TkMenuSelectImageProc(ClientData clientData, int x, +MODULE_SCOPE void TkMenuSelectImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); MODULE_SCOPE Tcl_Obj * TkNewMenuName(Tcl_Interp *interp, @@ -540,9 +541,9 @@ MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int index); + int x, int y, Tcl_Size index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int index); + int x, int y, Tcl_Size index); MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu *menuPtr); #endif /* _TKMENU */ |