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 / tkScale.h
CommitLineData
86530b38
AT
1/*
2 * tkScale.h --
3 *
4 * Declarations of types and functions used to implement
5 * the scale widget.
6 *
7 * Copyright (c) 1996 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: tkScale.h,v 1.4 1998/09/14 18:23:17 stanton Exp $
13 */
14
15#ifndef _TKSCALE
16#define _TKSCALE
17
18#ifndef _TK
19#include "tk.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 scale
30 * widget managed by this file:
31 */
32
33typedef struct TkScale {
34 Tk_Window tkwin; /* Window that embodies the scale. 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. Used, among
39 * other things, so that resources can be
40 * freed even after tkwin has gone away. */
41 Tcl_Interp *interp; /* Interpreter associated with scale. */
42 Tcl_Command widgetCmd; /* Token for scale's widget command. */
43 int vertical; /* Non-zero means vertical orientation,
44 * zero means horizontal. */
45 int width; /* Desired narrow dimension of scale,
46 * in pixels. */
47 int length; /* Desired long dimension of scale,
48 * in pixels. */
49 double value; /* Current value of scale. */
50 Var varName; /* Name of variable (malloc'ed) or NULL.
51 * If non-NULL, scale's value tracks
52 * the contents of this variable and
53 * vice versa. */
54 double fromValue; /* Value corresponding to left or top of
55 * scale. */
56 double toValue; /* Value corresponding to right or bottom
57 * of scale. */
58 double tickInterval; /* Distance between tick marks; 0 means
59 * don't display any tick marks. */
60 double resolution; /* If > 0, all values are rounded to an
61 * even multiple of this value. */
62 int digits; /* Number of significant digits to print
63 * in values. 0 means we get to choose the
64 * number based on resolution and/or the
65 * range of the scale. */
66 char format[10]; /* Sprintf conversion specifier computed from
67 * digits and other information. */
68 double bigIncrement; /* Amount to use for large increments to
69 * scale value. (0 means we pick a value). */
70 LangCallback *command; /* Command prefix to use when invoking Tcl
71 * commands because the scale value changed.
72 * NULL means don't invoke commands.
73 * Malloc'ed. */
74 int repeatDelay; /* How long to wait before auto-repeating
75 * on scrolling actions (in ms). */
76 int repeatInterval; /* Interval between autorepeats (in ms). */
77 char *label; /* Label to display above or to right of
78 * scale; NULL means don't display a
79 * label. Malloc'ed. */
80 int labelLength; /* Number of non-NULL chars. in label. */
81 Tk_State state; /* Normal or disabled. Value cannot be
82 * changed when scale is disabled. */
83
84 /*
85 * Information used when displaying widget:
86 */
87
88 int borderWidth; /* Width of 3-D border around window. */
89 Tk_3DBorder bgBorder; /* Used for drawing slider and other
90 * background areas. */
91 Tk_3DBorder activeBorder; /* For drawing the slider when active. */
92 int sliderRelief; /* Is slider to be drawn raised, sunken, etc. */
93 XColor *troughColorPtr; /* Color for drawing trough. */
94 GC troughGC; /* For drawing trough. */
95 GC copyGC; /* Used for copying from pixmap onto screen. */
96 Tk_Font tkfont; /* Information about text font, or NULL. */
97 XColor *textColorPtr; /* Color for drawing text. */
98 GC textGC; /* GC for drawing text in normal mode. */
99 int relief; /* Indicates whether window as a whole is
100 * raised, sunken, or flat. */
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 int sliderLength; /* Length of slider, measured in pixels along
114 * long dimension of scale. */
115 int showValue; /* Non-zero means to display the scale value
116 * below or to the left of the slider; zero
117 * means don't display the value. */
118
119 /*
120 * Layout information for horizontal scales, assuming that window
121 * gets the size it requested:
122 */
123
124 int horizLabelY; /* Y-coord at which to draw label. */
125 int horizValueY; /* Y-coord at which to draw value text. */
126 int horizTroughY; /* Y-coord of top of slider trough. */
127 int horizTickY; /* Y-coord at which to draw tick text. */
128 /*
129 * Layout information for vertical scales, assuming that window
130 * gets the size it requested:
131 */
132
133 int vertTickRightX; /* X-location of right side of tick-marks. */
134 int vertValueRightX; /* X-location of right side of value string. */
135 int vertTroughX; /* X-location of scale's slider trough. */
136 int vertLabelX; /* X-location of origin of label. */
137
138 /*
139 * Miscellaneous information:
140 */
141
142 Tk_Cursor cursor; /* Current cursor for window, or None. */
143 char *takeFocus; /* Value of -takefocus option; not used in
144 * the C code, but used by keyboard traversal
145 * scripts. Malloc'ed, but may be NULL. */
146 int flags; /* Various flags; see below for
147 * definitions. */
148 Tk_Tile tile, activeTile, disabledTile, troughTile;
149 GC activeTileGC;
150 Tk_TSOffset tsoffset;
151} TkScale;
152
153/*
154 * Flag bits for scales:
155 *
156 * REDRAW_SLIDER - 1 means slider (and numerical readout) need
157 * to be redrawn.
158 * REDRAW_OTHER - 1 means other stuff besides slider and value
159 * need to be redrawn.
160 * REDRAW_ALL - 1 means the entire widget needs to be redrawn.
161 * ACTIVE - 1 means the widget is active (the mouse is
162 * in its window).
163 * INVOKE_COMMAND - 1 means the scale's command needs to be
164 * invoked during the next redisplay (the
165 * value of the scale has changed since the
166 * last time the command was invoked).
167 * SETTING_VAR - 1 means that the associated variable is
168 * being set by us, so there's no need for
169 * ScaleVarProc to do anything.
170 * NEVER_SET - 1 means that the scale's value has never
171 * been set before (so must invoke -command and
172 * set associated variable even if the value
173 * doesn't appear to have changed).
174 * GOT_FOCUS - 1 means that the focus is currently in
175 * this widget.
176 */
177
178#define REDRAW_SLIDER 1
179#define REDRAW_OTHER 2
180#define REDRAW_ALL 3
181#define ACTIVE 4
182#define INVOKE_COMMAND 0x10
183#define SETTING_VAR 0x20
184#define NEVER_SET 0x40
185#define GOT_FOCUS 0x80
186
187/*
188 * Symbolic values for the active parts of a slider. These are
189 * the values that may be returned by the ScaleElement procedure.
190 */
191
192#define OTHER 0
193#define TROUGH1 1
194#define SLIDER 2
195#define TROUGH2 3
196
197/*
198 * Space to leave between scale area and text, and between text and
199 * edge of window.
200 */
201
202#define SPACING 2
203
204/*
205 * How many characters of space to provide when formatting the
206 * scale's value:
207 */
208
209#define PRINT_CHARS 150
210
211/*
212 * Declaration of procedures used in the implementation of the scrollbar
213 * widget.
214 */
215
216EXTERN void TkEventuallyRedrawScale _ANSI_ARGS_((TkScale *scalePtr,
217 int what));
218EXTERN double TkRoundToResolution _ANSI_ARGS_((TkScale *scalePtr,
219 double value));
220EXTERN TkScale * TkpCreateScale _ANSI_ARGS_((Tk_Window tkwin));
221EXTERN void TkpDestroyScale _ANSI_ARGS_((TkScale *scalePtr));
222EXTERN void TkpDisplayScale _ANSI_ARGS_((ClientData clientData));
223EXTERN double TkpPixelToValue _ANSI_ARGS_((TkScale *scalePtr,
224 int x, int y));
225EXTERN int TkpScaleElement _ANSI_ARGS_((TkScale *scalePtr,
226 int x, int y));
227EXTERN void TkpSetScaleValue _ANSI_ARGS_((TkScale *scalePtr,
228 double value, int setVar, int invokeCommand));
229EXTERN int TkpValueToPixel _ANSI_ARGS_((TkScale *scalePtr,
230 double value));
231
232# undef TCL_STORAGE_CLASS
233# define TCL_STORAGE_CLASS DLLIMPORT
234
235#endif /* _TKSCALE */