4 * Declarations of types and functions used to implement
5 * the scrollbar widget.
7 * Copyright (c) 1996 by Sun Microsystems, Inc.
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
23 # undef TCL_STORAGE_CLASS
24 # define TCL_STORAGE_CLASS DLLEXPORT
28 * A data structure of the following type is kept for each scrollbar
32 typedef struct TkScrollbar {
33 Tk_Window tkwin; /* Window that embodies the scrollbar. NULL
34 * means that the window has been destroyed
35 * but the data structures haven't yet been
37 Display *display; /* Display containing widget. Used, among
38 * other things, so that resources can be
39 * freed even after tkwin has gone away. */
40 Tcl_Interp *interp; /* Interpreter associated with scrollbar. */
41 Tcl_Command widgetCmd; /* Token for scrollbar's widget command. */
42 int vertical; /* Non-zero means vertical orientation
43 * requested, zero means horizontal. */
44 int width; /* Desired narrow dimension of scrollbar,
46 char *command; /* Command prefix to use when invoking
47 * scrolling commands. NULL means don't
48 * invoke commands. Malloc'ed. */
49 int commandSize; /* Number of non-NULL bytes in command. */
50 int repeatDelay; /* How long to wait before auto-repeating
51 * on scrolling actions (in ms). */
52 int repeatInterval; /* Interval between autorepeats (in ms). */
53 int jump; /* Value of -jump option. */
56 * Information used when displaying widget:
59 int borderWidth; /* Width of 3-D borders. */
60 Tk_3DBorder bgBorder; /* Used for drawing background (all flat
61 * surfaces except for trough). */
62 Tk_3DBorder activeBorder; /* For drawing backgrounds when active (i.e.
63 * when mouse is positioned over element). */
64 XColor *troughColorPtr; /* Color for drawing trough. */
65 int relief; /* Indicates whether window as a whole is
66 * raised, sunken, or flat. */
67 int highlightWidth; /* Width in pixels of highlight to draw
68 * around widget when it has the focus.
69 * <= 0 means don't draw a highlight. */
70 XColor *highlightBgColorPtr;
71 /* Color for drawing traversal highlight
72 * area when highlight is off. */
73 XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
74 int inset; /* Total width of all borders, including
75 * traversal highlight and 3-D border.
76 * Indicates how much interior stuff must
77 * be offset from outside edges to leave
78 * room for borders. */
79 int elementBorderWidth; /* Width of border to draw around elements
80 * inside scrollbar (arrows and slider).
81 * -1 means use borderWidth. */
82 int arrowLength; /* Length of arrows along long dimension of
83 * scrollbar, including space for a small gap
84 * between the arrow and the slider.
85 * Recomputed on window size changes. */
86 int sliderFirst; /* Pixel coordinate of top or left edge
87 * of slider area, including border. */
88 int sliderLast; /* Coordinate of pixel just after bottom
89 * or right edge of slider area, including
91 int activeField; /* Names field to be displayed in active
92 * colors, such as TOP_ARROW, or 0 for
94 int activeRelief; /* Value of -activeRelief option: relief
95 * to use for active element. */
98 * Information describing the application related to the scrollbar.
99 * This information is provided by the application by invoking the
100 * "set" widget command. This information can now be provided in
101 * two ways: the "old" form (totalUnits, windowUnits, firstUnit,
102 * and lastUnit), or the "new" form (firstFraction and lastFraction).
103 * FirstFraction and lastFraction will always be valid, but
104 * the old-style information is only valid if the NEW_STYLE_COMMANDS
108 int totalUnits; /* Total dimension of application, in
109 * units. Valid only if the NEW_STYLE_COMMANDS
111 int windowUnits; /* Maximum number of units that can be
112 * displayed in the window at once. Valid
113 * only if the NEW_STYLE_COMMANDS flag isn't
115 int firstUnit; /* Number of last unit visible in
116 * application's window. Valid only if the
117 * NEW_STYLE_COMMANDS flag isn't set. */
118 int lastUnit; /* Index of last unit visible in window.
119 * Valid only if the NEW_STYLE_COMMANDS
121 double firstFraction; /* Position of first visible thing in window,
122 * specified as a fraction between 0 and
124 double lastFraction; /* Position of last visible thing in window,
125 * specified as a fraction between 0 and
129 * Miscellaneous information:
132 Tk_Cursor cursor; /* Current cursor for window, or None. */
133 char *takeFocus; /* Value of -takefocus option; not used in
134 * the C code, but used by keyboard traversal
135 * scripts. Malloc'ed, but may be NULL. */
136 int flags; /* Various flags; see below for
141 * Legal values for "activeField" field of Scrollbar structures. These
142 * are also the return values from the ScrollbarPosition procedure.
150 #define BOTTOM_ARROW 5
153 * Flag bits for scrollbars:
155 * REDRAW_PENDING: Non-zero means a DoWhenIdle handler
156 * has already been queued to redraw
158 * NEW_STYLE_COMMANDS: Non-zero means the new style of commands
159 * should be used to communicate with the
160 * widget: ".t yview scroll 2 lines", instead
161 * of ".t yview 40", for example.
162 * GOT_FOCUS: Non-zero means this window has the input
166 #define REDRAW_PENDING 1
167 #define NEW_STYLE_COMMANDS 2
171 * Declaration of scrollbar class procedures structure.
174 extern Tk_ClassProcs tkpScrollbarProcs;
177 * Declaration of scrollbar configuration options.
180 extern Tk_ConfigSpec tkpScrollbarConfigSpecs[];
183 * Declaration of procedures used in the implementation of the scrollbar
187 EXTERN void TkScrollbarEventProc _ANSI_ARGS_((
188 ClientData clientData, XEvent *eventPtr));
189 EXTERN void TkScrollbarEventuallyRedraw _ANSI_ARGS_((
190 TkScrollbar *scrollPtr));
191 EXTERN void TkpComputeScrollbarGeometry _ANSI_ARGS_((
192 TkScrollbar *scrollPtr));
193 EXTERN TkScrollbar * TkpCreateScrollbar _ANSI_ARGS_((Tk_Window tkwin));
194 EXTERN void TkpDestroyScrollbar _ANSI_ARGS_((
195 TkScrollbar *scrollPtr));
196 EXTERN void TkpDisplayScrollbar _ANSI_ARGS_((
197 ClientData clientData));
198 EXTERN void TkpConfigureScrollbar _ANSI_ARGS_((
199 TkScrollbar *scrollPtr));
200 EXTERN int TkpScrollbarPosition _ANSI_ARGS_((
201 TkScrollbar *scrollPtr, int x, int y));
203 # undef TCL_STORAGE_CLASS
204 # define TCL_STORAGE_CLASS DLLIMPORT
206 #endif /* _TKSCROLLBAR */