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

Contents of /projs/trunk/shared_source/c_tk_base_7_5_w_mods/tkmenubutton.h

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords Header

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25