Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tkButton.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 * tkButton.h -- | |
3 * | |
4 * Declarations of types and functions used to implement button-like | |
5 * widgets. | |
6 * | |
7 * Copyright (c) 1996-1998 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 _TKBUTTON | |
14 #define _TKBUTTON | |
15 | |
16 #ifndef _TKINT | |
17 #include "tkInt.h" | |
18 #endif | |
19 | |
20 /* | |
21 * Legal values for the "compound" field of TkButton records. | |
22 */ | |
23 | |
24 enum compound { | |
25 COMPOUND_BOTTOM, COMPOUND_CENTER, COMPOUND_LEFT, COMPOUND_NONE, | |
26 COMPOUND_RIGHT, COMPOUND_TOP | |
27 }; | |
28 | |
29 /* | |
30 * Legal values for the "state" field of TkButton records. | |
31 */ | |
32 | |
33 enum state { | |
34 STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL | |
35 }; | |
36 | |
37 /* | |
38 * Legal values for the "defaultState" field of TkButton records. | |
39 */ | |
40 | |
41 enum defaultState { | |
42 DEFAULT_ACTIVE, DEFAULT_DISABLED, DEFAULT_NORMAL | |
43 }; | |
44 | |
45 /* | |
46 * A data structure of the following type is kept for each widget managed by | |
47 * this file: | |
48 */ | |
49 | |
50 typedef struct { | |
51 Tk_Window tkwin; /* Window that embodies the button. NULL means | |
52 * that the window has been destroyed. */ | |
53 Display *display; /* Display containing widget. Needed to free | |
54 * up resources after tkwin is gone. */ | |
55 Tcl_Interp *interp; /* Interpreter associated with button. */ | |
56 Tcl_Command widgetCmd; /* Token for button's widget command. */ | |
57 int type; /* Type of widget, such as TYPE_LABEL: | |
58 * restricts operations that may be performed | |
59 * on widget. See below for legal values. */ | |
60 Tk_OptionTable optionTable; /* Table that defines configuration options | |
61 * available for this widget. */ | |
62 | |
63 /* | |
64 * Information about what's in the button. | |
65 */ | |
66 | |
67 Tcl_Obj *textPtr; /* Value of -text option: specifies text to | |
68 * display in button. */ | |
69 int underline; /* Value of -underline option: specifies index | |
70 * of character to underline. < 0 means don't | |
71 * underline anything. */ | |
72 Tcl_Obj *textVarNamePtr; /* Value of -textvariable option: specifies | |
73 * name of variable or NULL. If non-NULL, | |
74 * button displays the contents of this | |
75 * variable. */ | |
76 Pixmap bitmap; /* Value of -bitmap option. If not None, | |
77 * specifies bitmap to display and text and | |
78 * textVar are ignored. */ | |
79 Tcl_Obj *imagePtr; /* Value of -image option: specifies image to | |
80 * display in window, or NULL if none. If | |
81 * non-NULL, bitmap, text, and textVarName are | |
82 * ignored.*/ | |
83 Tk_Image image; /* Derived from imagePtr by calling | |
84 * Tk_GetImage, or NULL if imagePtr is | |
85 * NULL. */ | |
86 Tcl_Obj *selectImagePtr; /* Value of -selectimage option: specifies | |
87 * image to display in window when selected, | |
88 * or NULL if none. Ignored if imagePtr is | |
89 * NULL. */ | |
90 Tk_Image selectImage; /* Derived from selectImagePtr by calling | |
91 * Tk_GetImage, or NULL if selectImagePtr is | |
92 * NULL. */ | |
93 Tcl_Obj *tristateImagePtr; /* Value of -tristateimage option: specifies | |
94 * image to display in window when selected, | |
95 * or NULL if none. Ignored if imagePtr is | |
96 * NULL. */ | |
97 Tk_Image tristateImage; /* Derived from tristateImagePtr by calling | |
98 * Tk_GetImage, or NULL if tristateImagePtr is | |
99 * NULL. */ | |
100 | |
101 /* | |
102 * Information used when displaying widget: | |
103 */ | |
104 | |
105 enum state state; /* Value of -state option: specifies state of | |
106 * button for display purposes.*/ | |
107 Tk_3DBorder normalBorder; /* Value of -background option: specifies | |
108 * color for background (and border) when | |
109 * window isn't active. */ | |
110 Tk_3DBorder activeBorder; /* Value of -activebackground option: this is | |
111 * the color used to draw 3-D border and | |
112 * background when widget is active. */ | |
113 Tcl_Obj *borderWidthPtr; /* Value of -borderWidth option: specifies | |
114 * width of border in pixels. */ | |
115 int borderWidth; /* Integer value corresponding to | |
116 * borderWidthPtr. Always >= 0. */ | |
117 int relief; /* Value of -relief option: specifies 3-d | |
118 * effect for border, such as | |
119 * TK_RELIEF_RAISED. */ | |
120 int overRelief; /* Value of -overrelief option: specifies a | |
121 * 3-d effect for the border, such as | |
122 * TK_RELIEF_RAISED, to be used when the mouse | |
123 * is over the button. */ | |
124 int offRelief; /* Value of -offrelief option: specifies a 3-d | |
125 * effect for the border, such as | |
126 * TK_RELIEF_RAISED, to be used when a | |
127 * checkbutton or radiobutton without | |
128 * indicator is off. */ | |
129 Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option: | |
130 * specifies width in pixels of highlight to | |
131 * draw around widget when it has the focus. | |
132 * <= 0 means don't draw a highlight. */ | |
133 int highlightWidth; /* Integer value corresponding to | |
134 * highlightWidthPtr. Always >= 0. */ | |
135 Tk_3DBorder highlightBorder;/* Value of -highlightbackground option: | |
136 * specifies background with which to draw 3-D | |
137 * default ring and focus highlight area when | |
138 * highlight is off. */ | |
139 XColor *highlightColorPtr; /* Value of -highlightcolor option: specifies | |
140 * color for drawing traversal highlight. */ | |
141 int inset; /* Total width of all borders, including | |
142 * traversal highlight and 3-D border. | |
143 * Indicates how much interior stuff must be | |
144 * offset from outside edges to leave room for | |
145 * borders. */ | |
146 Tk_Font tkfont; /* Value of -font option: specifies font to | |
147 * use for display text. */ | |
148 XColor *normalFg; /* Value of -font option: specifies foreground | |
149 * color in normal mode. */ | |
150 XColor *activeFg; /* Value of -activeforeground option: | |
151 * foreground color in active mode. NULL means | |
152 * use -foreground instead. */ | |
153 XColor *disabledFg; /* Value of -disabledforeground option: | |
154 * foreground color when disabled. NULL means | |
155 * use normalFg with a 50% stipple instead. */ | |
156 GC normalTextGC; /* GC for drawing text in normal mode. Also | |
157 * used to copy from off-screen pixmap onto | |
158 * screen. */ | |
159 GC activeTextGC; /* GC for drawing text in active mode (NULL | |
160 * means use normalTextGC). */ | |
161 GC disabledGC; /* Used to produce disabled effect for text | |
162 * and check/radio marks. */ | |
163 GC stippleGC; /* Used to produce disabled stipple effect for | |
164 * images when disabled. */ | |
165 Pixmap gray; /* Pixmap for displaying disabled text if | |
166 * disabledFg is NULL. */ | |
167 GC copyGC; /* Used for copying information from an | |
168 * off-screen pixmap to the screen. */ | |
169 Tcl_Obj *widthPtr; /* Value of -width option. */ | |
170 int width; /* Integer value corresponding to widthPtr. */ | |
171 Tcl_Obj *heightPtr; /* Value of -height option. */ | |
172 int height; /* Integer value corresponding to heightPtr. */ | |
173 Tcl_Obj *wrapLengthPtr; /* Value of -wraplength option: specifies line | |
174 * length (in pixels) at which to wrap onto | |
175 * next line. <= 0 means don't wrap except at | |
176 * newlines. */ | |
177 int wrapLength; /* Integer value corresponding to | |
178 * wrapLengthPtr. */ | |
179 Tcl_Obj *padXPtr; /* Value of -padx option: specifies how many | |
180 * pixels of extra space to leave on left and | |
181 * right of text. Ignored for bitmaps and | |
182 * images. */ | |
183 int padX; /* Integer value corresponding to padXPtr. */ | |
184 Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many | |
185 * pixels of extra space to leave above and | |
186 * below text. Ignored for bitmaps and | |
187 * images. */ | |
188 int padY; /* Integer value corresponding to padYPtr. */ | |
189 Tk_Anchor anchor; /* Value of -anchor option: specifies where | |
190 * text/bitmap should be displayed inside | |
191 * button region. */ | |
192 Tk_Justify justify; /* Value of -justify option: specifies how to | |
193 * align lines of multi-line text. */ | |
194 int indicatorOn; /* Value of -indicatoron option: 1 means draw | |
195 * indicator in checkbuttons and radiobuttons, | |
196 * 0 means don't draw it. */ | |
197 Tk_3DBorder selectBorder; /* Value of -selectcolor option: specifies | |
198 * color for drawing indicator background, or | |
199 * perhaps widget background, when | |
200 * selected. */ | |
201 int textWidth; /* Width needed to display text as requested, | |
202 * in pixels. */ | |
203 int textHeight; /* Height needed to display text as requested, | |
204 * in pixels. */ | |
205 Tk_TextLayout textLayout; /* Saved text layout information. */ | |
206 int indicatorSpace; /* Horizontal space (in pixels) allocated for | |
207 * display of indicator. */ | |
208 int indicatorDiameter; /* Diameter of indicator, in pixels. */ | |
209 enum defaultState defaultState; | |
210 /* Value of -default option, such as | |
211 * DEFAULT_NORMAL: specifies state of default | |
212 * ring for buttons (normal, active, or | |
213 * disabled). NULL for other classes. */ | |
214 | |
215 /* | |
216 * For check and radio buttons, the fields below are used to manage the | |
217 * variable indicating the button's state. | |
218 */ | |
219 | |
220 Tcl_Obj *selVarNamePtr; /* Value of -variable option: specifies name | |
221 * of variable used to control selected state | |
222 * of button. */ | |
223 Tcl_Obj *onValuePtr; /* Value of -offvalue option: specifies value | |
224 * to store in variable when this button is | |
225 * selected. */ | |
226 Tcl_Obj *offValuePtr; /* Value of -offvalue option: specifies value | |
227 * to store in variable when this button isn't | |
228 * selected. Used only by checkbuttons. */ | |
229 Tcl_Obj *tristateValuePtr; /* Value of -tristatevalue option: specifies | |
230 * value to display Tristate or Multivalue | |
231 * mode when variable matches this value. | |
232 * Used by check- buttons. */ | |
233 | |
234 /* | |
235 * Miscellaneous information: | |
236 */ | |
237 | |
238 Tk_Cursor cursor; /* Value of -cursor option: if not NULL, | |
239 * specifies current cursor for window. */ | |
240 Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the | |
241 * C code, but used by keyboard traversal | |
242 * scripts. */ | |
243 Tcl_Obj *commandPtr; /* Value of -command option: specifies script | |
244 * to execute when button is invoked. If | |
245 * widget is label or has no command, this is | |
246 * NULL. */ | |
247 int compound; /* Value of -compound option; specifies | |
248 * whether the button should show both an | |
249 * image and text, and, if so, how. */ | |
250 int repeatDelay; /* Value of -repeatdelay option; specifies the | |
251 * number of ms after which the button will | |
252 * start to auto-repeat its command. */ | |
253 int repeatInterval; /* Value of -repeatinterval option; specifies | |
254 * the number of ms between auto-repeat | |
255 * invocataions of the button command. */ | |
256 int flags; /* Various flags; see below for | |
257 * definitions. */ | |
258 } TkButton; | |
259 | |
260 /* | |
261 * Possible "type" values for buttons. These are the kinds of widgets | |
262 * supported by this file. The ordering of the type numbers is significant: | |
263 * greater means more features and is used in the code. | |
264 */ | |
265 | |
266 #define TYPE_LABEL 0 | |
267 #define TYPE_BUTTON 1 | |
268 #define TYPE_CHECK_BUTTON 2 | |
269 #define TYPE_RADIO_BUTTON 3 | |
270 | |
271 /* | |
272 * Flag bits for buttons: | |
273 * | |
274 * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has | |
275 * already been queued to redraw this window. | |
276 * SELECTED: Non-zero means this button is selected, so | |
277 * special highlight should be drawn. | |
278 * GOT_FOCUS: Non-zero means this button currently has the | |
279 * input focus. | |
280 * BUTTON_DELETED: Non-zero needs that this button has been | |
281 * deleted, or is in the process of being deleted | |
282 */ | |
283 | |
284 #define REDRAW_PENDING (1 << 0) | |
285 #define SELECTED (1 << 1) | |
286 #define GOT_FOCUS (1 << 2) | |
287 #define BUTTON_DELETED (1 << 3) | |
288 #define TRISTATED (1 << 4) | |
289 | |
290 /* | |
291 * Declaration of button class functions structure | |
292 * and button/label defaults, for use in optionSpecs. | |
293 */ | |
294 | |
295 MODULE_SCOPE const Tk_ClassProcs tkpButtonProcs; | |
296 MODULE_SCOPE char tkDefButtonHighlightWidth[TCL_INTEGER_SPACE]; | |
297 MODULE_SCOPE char tkDefButtonPadx[TCL_INTEGER_SPACE]; | |
298 MODULE_SCOPE char tkDefButtonPady[TCL_INTEGER_SPACE]; | |
299 MODULE_SCOPE char tkDefButtonBorderWidth[TCL_INTEGER_SPACE]; | |
300 MODULE_SCOPE char tkDefLabelHighlightWidth[TCL_INTEGER_SPACE]; | |
301 MODULE_SCOPE char tkDefLabelPadx[TCL_INTEGER_SPACE]; | |
302 MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE]; | |
303 | |
304 /* | |
305 * Declaration of functions used in the implementation of the button widget. | |
306 */ | |
307 | |
308 #ifndef TkpButtonSetDefaults | |
309 MODULE_SCOPE void TkpButtonSetDefaults(void); | |
310 #endif | |
311 MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData); | |
312 MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr); | |
313 MODULE_SCOPE TkButton *TkpCreateButton(Tk_Window tkwin); | |
314 #ifndef TkpDestroyButton | |
315 MODULE_SCOPE void TkpDestroyButton(TkButton *butPtr); | |
316 #endif | |
317 #ifndef TkpDisplayButton | |
318 MODULE_SCOPE void TkpDisplayButton(ClientData clientData); | |
319 #endif | |
320 MODULE_SCOPE int TkInvokeButton(TkButton *butPtr); | |
321 | |
322 #endif /* _TKBUTTON */ |