/[dtapublic]/projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkmenubutton.h
ViewVC logotype

Diff of /projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkmenubutton.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 70 by dashley, Sat Nov 5 10:54:17 2016 UTC revision 71 by dashley, Sat Nov 5 11:07:06 2016 UTC
# Line 1  Line 1 
1  /* $Header$ */  /* $Header$ */
2    
3  /*  /*
4   * tkMenubutton.h --   * tkMenubutton.h --
5   *   *
6   *      Declarations of types and functions used to implement   *      Declarations of types and functions used to implement
7   *      the menubutton widget.   *      the menubutton widget.
8   *   *
9   * Copyright (c) 1996-1997 by Sun Microsystems, Inc.   * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
10   *   *
11   * See the file "license.terms" for information on usage and redistribution   * See the file "license.terms" for information on usage and redistribution
12   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13   *   *
14   * RCS: @(#) $Id: tkmenubutton.h,v 1.1.1.1 2001/06/13 05:05:58 dtashley Exp $   * RCS: @(#) $Id: tkmenubutton.h,v 1.1.1.1 2001/06/13 05:05:58 dtashley Exp $
15   */   */
16    
17  #ifndef _TKMENUBUTTON  #ifndef _TKMENUBUTTON
18  #define _TKMENUBUTTON  #define _TKMENUBUTTON
19    
20  #ifndef _TKINT  #ifndef _TKINT
21  #include "tkInt.h"  #include "tkInt.h"
22  #endif  #endif
23    
24  #ifdef BUILD_tk  #ifdef BUILD_tk
25  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
26  # define TCL_STORAGE_CLASS DLLEXPORT  # define TCL_STORAGE_CLASS DLLEXPORT
27  #endif  #endif
28    
29  /*  /*
30   * Legal values for the "orient" field of TkMenubutton records.   * Legal values for the "orient" field of TkMenubutton records.
31   */   */
32    
33  enum direction {  enum direction {
34      DIRECTION_ABOVE, DIRECTION_BELOW, DIRECTION_FLUSH,      DIRECTION_ABOVE, DIRECTION_BELOW, DIRECTION_FLUSH,
35      DIRECTION_LEFT, DIRECTION_RIGHT      DIRECTION_LEFT, DIRECTION_RIGHT
36  };  };
37    
38  /*  /*
39   * Legal values for the "state" field of TkMenubutton records.   * Legal values for the "state" field of TkMenubutton records.
40   */   */
41    
42  enum state {  enum state {
43      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL
44  };  };
45    
46  /*  /*
47   * A data structure of the following type is kept for each   * A data structure of the following type is kept for each
48   * widget managed by this file:   * widget managed by this file:
49   */   */
50    
51  typedef struct {  typedef struct {
52      Tk_Window tkwin;            /* Window that embodies the widget.  NULL      Tk_Window tkwin;            /* Window that embodies the widget.  NULL
53                                   * means that the window has been destroyed                                   * means that the window has been destroyed
54                                   * but the data structures haven't yet been                                   * but the data structures haven't yet been
55                                   * cleaned up.*/                                   * cleaned up.*/
56      Display *display;           /* Display containing widget.  Needed, among      Display *display;           /* Display containing widget.  Needed, among
57                                   * other things, so that resources can bee                                   * other things, so that resources can bee
58                                   * freed up even after tkwin has gone away. */                                   * freed up even after tkwin has gone away. */
59      Tcl_Interp *interp;         /* Interpreter associated with menubutton. */      Tcl_Interp *interp;         /* Interpreter associated with menubutton. */
60      Tcl_Command widgetCmd;      /* Token for menubutton's widget command. */      Tcl_Command widgetCmd;      /* Token for menubutton's widget command. */
61      Tk_OptionTable optionTable; /* Table that defines configuration options      Tk_OptionTable optionTable; /* Table that defines configuration options
62                                   * available for this widget. */                                   * available for this widget. */
63      char *menuName;             /* Name of menu associated with widget.      char *menuName;             /* Name of menu associated with widget.
64                                   * Malloc-ed. */                                   * Malloc-ed. */
65    
66      /*      /*
67       * Information about what's displayed in the menu button:       * Information about what's displayed in the menu button:
68       */       */
69    
70      char *text;                 /* Text to display in button (malloc'ed)      char *text;                 /* Text to display in button (malloc'ed)
71                                   * or NULL. */                                   * or NULL. */
72      int underline;              /* Index of character to underline. */      int underline;              /* Index of character to underline. */
73      char *textVarName;          /* Name of variable (malloc'ed) or NULL.      char *textVarName;          /* Name of variable (malloc'ed) or NULL.
74                                   * If non-NULL, button displays the contents                                   * If non-NULL, button displays the contents
75                                   * of this variable. */                                   * of this variable. */
76      Pixmap bitmap;              /* Bitmap to display or None.  If not None      Pixmap bitmap;              /* Bitmap to display or None.  If not None
77                                   * then text and textVar and underline                                   * then text and textVar and underline
78                                   * are ignored. */                                   * are ignored. */
79      char *imageString;          /* Name of image to display (malloc'ed), or      char *imageString;          /* Name of image to display (malloc'ed), or
80                                   * NULL.  If non-NULL, bitmap, text, and                                   * NULL.  If non-NULL, bitmap, text, and
81                                   * textVarName are ignored. */                                   * textVarName are ignored. */
82      Tk_Image image;             /* Image to display in window, or NULL if      Tk_Image image;             /* Image to display in window, or NULL if
83                                   * none. */                                   * none. */
84    
85      /*      /*
86       * Information used when displaying widget:       * Information used when displaying widget:
87       */       */
88    
89      enum state state;           /* State of button for display purposes:      enum state state;           /* State of button for display purposes:
90                                   * normal, active, or disabled. */                                   * normal, active, or disabled. */
91      Tk_3DBorder normalBorder;   /* Structure used to draw 3-D      Tk_3DBorder normalBorder;   /* Structure used to draw 3-D
92                                   * border and background when window                                   * border and background when window
93                                   * isn't active.  NULL means no such                                   * isn't active.  NULL means no such
94                                   * border exists. */                                   * border exists. */
95      Tk_3DBorder activeBorder;   /* Structure used to draw 3-D      Tk_3DBorder activeBorder;   /* Structure used to draw 3-D
96                                   * border and background when window                                   * border and background when window
97                                   * is active.  NULL means no such                                   * is active.  NULL means no such
98                                   * border exists. */                                   * border exists. */
99      int borderWidth;            /* Width of border. */      int borderWidth;            /* Width of border. */
100      int relief;                 /* 3-d effect: TK_RELIEF_RAISED, etc. */      int relief;                 /* 3-d effect: TK_RELIEF_RAISED, etc. */
101      int highlightWidth;         /* Width in pixels of highlight to draw      int highlightWidth;         /* Width in pixels of highlight to draw
102                                   * around widget when it has the focus.                                   * around widget when it has the focus.
103                                   * <= 0 means don't draw a highlight. */                                   * <= 0 means don't draw a highlight. */
104      XColor *highlightBgColorPtr;      XColor *highlightBgColorPtr;
105                                  /* Color for drawing traversal highlight                                  /* Color for drawing traversal highlight
106                                   * area when highlight is off. */                                   * area when highlight is off. */
107      XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */      XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */
108      int inset;                  /* Total width of all borders, including      int inset;                  /* Total width of all borders, including
109                                   * traversal highlight and 3-D border.                                   * traversal highlight and 3-D border.
110                                   * Indicates how much interior stuff must                                   * Indicates how much interior stuff must
111                                   * be offset from outside edges to leave                                   * be offset from outside edges to leave
112                                   * room for borders. */                                   * room for borders. */
113      Tk_Font tkfont;             /* Information about text font, or NULL. */      Tk_Font tkfont;             /* Information about text font, or NULL. */
114      XColor *normalFg;           /* Foreground color in normal mode. */      XColor *normalFg;           /* Foreground color in normal mode. */
115      XColor *activeFg;           /* Foreground color in active mode.  NULL      XColor *activeFg;           /* Foreground color in active mode.  NULL
116                                   * means use normalFg instead. */                                   * means use normalFg instead. */
117      XColor *disabledFg;         /* Foreground color when disabled.  NULL      XColor *disabledFg;         /* Foreground color when disabled.  NULL
118                                   * means use normalFg with a 50% stipple                                   * means use normalFg with a 50% stipple
119                                   * instead. */                                   * instead. */
120      GC normalTextGC;            /* GC for drawing text in normal mode. */      GC normalTextGC;            /* GC for drawing text in normal mode. */
121      GC activeTextGC;            /* GC for drawing text in active mode (NULL      GC activeTextGC;            /* GC for drawing text in active mode (NULL
122                                   * means use normalTextGC). */                                   * means use normalTextGC). */
123      Pixmap gray;                /* Pixmap for displaying disabled text/icon if      Pixmap gray;                /* Pixmap for displaying disabled text/icon if
124                                   * disabledFg is NULL. */                                   * disabledFg is NULL. */
125      GC disabledGC;              /* Used to produce disabled effect.  If      GC disabledGC;              /* Used to produce disabled effect.  If
126                                   * disabledFg isn't NULL, this GC is used to                                   * disabledFg isn't NULL, this GC is used to
127                                   * draw button text or icon.  Otherwise                                   * draw button text or icon.  Otherwise
128                                   * text or icon is drawn with normalGC and                                   * text or icon is drawn with normalGC and
129                                   * this GC is used to stipple background                                   * this GC is used to stipple background
130                                   * across it. */                                   * across it. */
131      int leftBearing;            /* Distance from text origin to leftmost drawn      int leftBearing;            /* Distance from text origin to leftmost drawn
132                                   * pixel (positive means to right). */                                   * pixel (positive means to right). */
133      int rightBearing;           /* Amount text sticks right from its origin. */      int rightBearing;           /* Amount text sticks right from its origin. */
134      char *widthString;          /* Value of -width option.  Malloc'ed. */      char *widthString;          /* Value of -width option.  Malloc'ed. */
135      char *heightString;         /* Value of -height option.  Malloc'ed. */      char *heightString;         /* Value of -height option.  Malloc'ed. */
136      int width, height;          /* If > 0, these specify dimensions to request      int width, height;          /* If > 0, these specify dimensions to request
137                                   * for window, in characters for text and in                                   * for window, in characters for text and in
138                                   * pixels for bitmaps.  In this case the actual                                   * pixels for bitmaps.  In this case the actual
139                                   * size of the text string or bitmap is                                   * size of the text string or bitmap is
140                                   * ignored in computing desired window size. */                                   * ignored in computing desired window size. */
141      int wrapLength;             /* Line length (in pixels) at which to wrap      int wrapLength;             /* Line length (in pixels) at which to wrap
142                                   * onto next line.  <= 0 means don't wrap                                   * onto next line.  <= 0 means don't wrap
143                                   * except at newlines. */                                   * except at newlines. */
144      int padX, padY;             /* Extra space around text or bitmap (pixels      int padX, padY;             /* Extra space around text or bitmap (pixels
145                                   * on each side). */                                   * on each side). */
146      Tk_Anchor anchor;           /* Where text/bitmap should be displayed      Tk_Anchor anchor;           /* Where text/bitmap should be displayed
147                                   * inside window region. */                                   * inside window region. */
148      Tk_Justify justify;         /* Justification to use for multi-line text. */      Tk_Justify justify;         /* Justification to use for multi-line text. */
149      int textWidth;              /* Width needed to display text as requested,      int textWidth;              /* Width needed to display text as requested,
150                                   * in pixels. */                                   * in pixels. */
151      int textHeight;             /* Height needed to display text as requested,      int textHeight;             /* Height needed to display text as requested,
152                                   * in pixels. */                                   * in pixels. */
153      Tk_TextLayout textLayout;   /* Saved text layout information. */      Tk_TextLayout textLayout;   /* Saved text layout information. */
154      int indicatorOn;            /* Non-zero means display indicator;  0 means      int indicatorOn;            /* Non-zero means display indicator;  0 means
155                                   * don't display. */                                   * don't display. */
156      int indicatorHeight;        /* Height of indicator in pixels.  This same      int indicatorHeight;        /* Height of indicator in pixels.  This same
157                                   * amount of extra space is also left on each                                   * amount of extra space is also left on each
158                                   * side of the indicator. 0 if no indicator. */                                   * side of the indicator. 0 if no indicator. */
159      int indicatorWidth;         /* Width of indicator in pixels, including      int indicatorWidth;         /* Width of indicator in pixels, including
160                                   * indicatorHeight in padding on each side.                                   * indicatorHeight in padding on each side.
161                                   * 0 if no indicator. */                                   * 0 if no indicator. */
162    
163      /*      /*
164       * Miscellaneous information:       * Miscellaneous information:
165       */       */
166    
167      enum direction direction;   /* Direction for where to pop the menu.      enum direction direction;   /* Direction for where to pop the menu.
168                                   * Valid directions are "above", "below",                                   * Valid directions are "above", "below",
169                                   * "left", "right", and "flush". "flush"                                   * "left", "right", and "flush". "flush"
170                                   * means that the upper left corner of the                                   * means that the upper left corner of the
171                                   * menubutton is where the menu pops up.                                   * menubutton is where the menu pops up.
172                                   * "above" and "below" will attempt to pop                                   * "above" and "below" will attempt to pop
173                                   * the menu compleletly above or below                                   * the menu compleletly above or below
174                                   * the menu respectively.                                   * the menu respectively.
175                                   * "left" and "right" will pop the menu                                   * "left" and "right" will pop the menu
176                                   * left or right, and the active item                                   * left or right, and the active item
177                                   * will be next to the button. */                                   * will be next to the button. */
178      Tk_Cursor cursor;           /* Current cursor for window, or None. */      Tk_Cursor cursor;           /* Current cursor for window, or None. */
179      char *takeFocus;            /* Value of -takefocus option;  not used in      char *takeFocus;            /* Value of -takefocus option;  not used in
180                                   * the C code, but used by keyboard traversal                                   * the C code, but used by keyboard traversal
181                                   * scripts.  Malloc'ed, but may be NULL. */                                   * scripts.  Malloc'ed, but may be NULL. */
182      int flags;                  /* Various flags;  see below for      int flags;                  /* Various flags;  see below for
183                                   * definitions. */                                   * definitions. */
184  } TkMenuButton;  } TkMenuButton;
185    
186  /*  /*
187   * Flag bits for buttons:   * Flag bits for buttons:
188   *   *
189   * REDRAW_PENDING:              Non-zero means a DoWhenIdle handler   * REDRAW_PENDING:              Non-zero means a DoWhenIdle handler
190   *                              has already been queued to redraw   *                              has already been queued to redraw
191   *                              this window.   *                              this window.
192   * POSTED:                      Non-zero means that the menu associated   * POSTED:                      Non-zero means that the menu associated
193   *                              with this button has been posted (typically   *                              with this button has been posted (typically
194   *                              because of an active button press).   *                              because of an active button press).
195   * GOT_FOCUS:                   Non-zero means this button currently   * GOT_FOCUS:                   Non-zero means this button currently
196   *                              has the input focus.   *                              has the input focus.
197   */   */
198    
199  #define REDRAW_PENDING          1  #define REDRAW_PENDING          1
200  #define POSTED                  2  #define POSTED                  2
201  #define GOT_FOCUS               4  #define GOT_FOCUS               4
202    
203  /*  /*
204   * The following constants define the dimensions of the cascade indicator,   * The following constants define the dimensions of the cascade indicator,
205   * which is displayed if the "-indicatoron" option is true.  The units for   * which is displayed if the "-indicatoron" option is true.  The units for
206   * these options are 1/10 millimeters.   * these options are 1/10 millimeters.
207   */   */
208    
209  #define INDICATOR_WIDTH         40  #define INDICATOR_WIDTH         40
210  #define INDICATOR_HEIGHT        17  #define INDICATOR_HEIGHT        17
211    
212  /*  /*
213   * Declaration of variables shared between the files in the button module.   * Declaration of variables shared between the files in the button module.
214   */   */
215    
216  extern TkClassProcs tkpMenubuttonClass;  extern TkClassProcs tkpMenubuttonClass;
217    
218  /*  /*
219   * Declaration of procedures used in the implementation of the button   * Declaration of procedures used in the implementation of the button
220   * widget.   * widget.
221   */   */
222    
223  extern void             TkpComputeMenuButtonGeometry _ANSI_ARGS_((  extern void             TkpComputeMenuButtonGeometry _ANSI_ARGS_((
224                              TkMenuButton *mbPtr));                              TkMenuButton *mbPtr));
225  extern TkMenuButton *   TkpCreateMenuButton _ANSI_ARGS_((Tk_Window tkwin));  extern TkMenuButton *   TkpCreateMenuButton _ANSI_ARGS_((Tk_Window tkwin));
226  extern void             TkpDisplayMenuButton _ANSI_ARGS_((  extern void             TkpDisplayMenuButton _ANSI_ARGS_((
227                              ClientData clientData));                              ClientData clientData));
228  extern void             TkpDestroyMenuButton _ANSI_ARGS_((  extern void             TkpDestroyMenuButton _ANSI_ARGS_((
229                              TkMenuButton *mbPtr));                              TkMenuButton *mbPtr));
230  extern void             TkMenuButtonWorldChanged _ANSI_ARGS_((  extern void             TkMenuButtonWorldChanged _ANSI_ARGS_((
231                              ClientData instanceData));                              ClientData instanceData));
232    
233  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
234  # define TCL_STORAGE_CLASS DLLIMPORT  # define TCL_STORAGE_CLASS DLLIMPORT
235    
236  #endif /* _TKMENUBUTTON */  #endif /* _TKMENUBUTTON */
237    
238  /* End of tkmenubutton.h */  /* End of tkmenubutton.h */

Legend:
Removed from v.70  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25