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