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