Debian Codegraph @

pTk/mTk/generic/tkMenubutton.h

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