home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _c37cc603eba75ba7c835106be5025b71 < prev    next >
Encoding:
Text File  |  2004-06-01  |  22.1 KB  |  589 lines

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