1 |
dashley |
69 |
/* $Header$ */
|
2 |
dashley |
25 |
|
3 |
|
|
/*
|
4 |
|
|
* tkScrollbar.h --
|
5 |
|
|
*
|
6 |
|
|
* Declarations of types and functions used to implement
|
7 |
|
|
* the scrollbar widget.
|
8 |
|
|
*
|
9 |
|
|
* Copyright (c) 1996 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: tkscrollbar.h,v 1.1.1.1 2001/06/13 05:07:54 dtashley Exp $
|
15 |
|
|
*/
|
16 |
|
|
|
17 |
|
|
#ifndef _TKSCROLLBAR
|
18 |
|
|
#define _TKSCROLLBAR
|
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 |
|
|
* A data structure of the following type is kept for each scrollbar
|
31 |
|
|
* widget.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
typedef struct TkScrollbar {
|
35 |
|
|
Tk_Window tkwin; /* Window that embodies the scrollbar. NULL
|
36 |
|
|
* means that the window has been destroyed
|
37 |
|
|
* but the data structures haven't yet been
|
38 |
|
|
* cleaned up.*/
|
39 |
|
|
Display *display; /* Display containing widget. Used, among
|
40 |
|
|
* other things, so that resources can be
|
41 |
|
|
* freed even after tkwin has gone away. */
|
42 |
|
|
Tcl_Interp *interp; /* Interpreter associated with scrollbar. */
|
43 |
|
|
Tcl_Command widgetCmd; /* Token for scrollbar's widget command. */
|
44 |
|
|
int vertical; /* Non-zero means vertical orientation
|
45 |
|
|
* requested, zero means horizontal. */
|
46 |
|
|
int width; /* Desired narrow dimension of scrollbar,
|
47 |
|
|
* in pixels. */
|
48 |
|
|
char *command; /* Command prefix to use when invoking
|
49 |
|
|
* scrolling commands. NULL means don't
|
50 |
|
|
* invoke commands. Malloc'ed. */
|
51 |
|
|
int commandSize; /* Number of non-NULL bytes in command. */
|
52 |
|
|
int repeatDelay; /* How long to wait before auto-repeating
|
53 |
|
|
* on scrolling actions (in ms). */
|
54 |
|
|
int repeatInterval; /* Interval between autorepeats (in ms). */
|
55 |
|
|
int jump; /* Value of -jump option. */
|
56 |
|
|
|
57 |
|
|
/*
|
58 |
|
|
* Information used when displaying widget:
|
59 |
|
|
*/
|
60 |
|
|
|
61 |
|
|
int borderWidth; /* Width of 3-D borders. */
|
62 |
|
|
Tk_3DBorder bgBorder; /* Used for drawing background (all flat
|
63 |
|
|
* surfaces except for trough). */
|
64 |
|
|
Tk_3DBorder activeBorder; /* For drawing backgrounds when active (i.e.
|
65 |
|
|
* when mouse is positioned over element). */
|
66 |
|
|
XColor *troughColorPtr; /* Color for drawing trough. */
|
67 |
|
|
int relief; /* Indicates whether window as a whole is
|
68 |
|
|
* raised, sunken, or flat. */
|
69 |
|
|
int highlightWidth; /* Width in pixels of highlight to draw
|
70 |
|
|
* around widget when it has the focus.
|
71 |
|
|
* <= 0 means don't draw a highlight. */
|
72 |
|
|
XColor *highlightBgColorPtr;
|
73 |
|
|
/* Color for drawing traversal highlight
|
74 |
|
|
* area when highlight is off. */
|
75 |
|
|
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
|
76 |
|
|
int inset; /* Total width of all borders, including
|
77 |
|
|
* traversal highlight and 3-D border.
|
78 |
|
|
* Indicates how much interior stuff must
|
79 |
|
|
* be offset from outside edges to leave
|
80 |
|
|
* room for borders. */
|
81 |
|
|
int elementBorderWidth; /* Width of border to draw around elements
|
82 |
|
|
* inside scrollbar (arrows and slider).
|
83 |
|
|
* -1 means use borderWidth. */
|
84 |
|
|
int arrowLength; /* Length of arrows along long dimension of
|
85 |
|
|
* scrollbar, including space for a small gap
|
86 |
|
|
* between the arrow and the slider.
|
87 |
|
|
* Recomputed on window size changes. */
|
88 |
|
|
int sliderFirst; /* Pixel coordinate of top or left edge
|
89 |
|
|
* of slider area, including border. */
|
90 |
|
|
int sliderLast; /* Coordinate of pixel just after bottom
|
91 |
|
|
* or right edge of slider area, including
|
92 |
|
|
* border. */
|
93 |
|
|
int activeField; /* Names field to be displayed in active
|
94 |
|
|
* colors, such as TOP_ARROW, or 0 for
|
95 |
|
|
* no field. */
|
96 |
|
|
int activeRelief; /* Value of -activeRelief option: relief
|
97 |
|
|
* to use for active element. */
|
98 |
|
|
|
99 |
|
|
/*
|
100 |
|
|
* Information describing the application related to the scrollbar.
|
101 |
|
|
* This information is provided by the application by invoking the
|
102 |
|
|
* "set" widget command. This information can now be provided in
|
103 |
|
|
* two ways: the "old" form (totalUnits, windowUnits, firstUnit,
|
104 |
|
|
* and lastUnit), or the "new" form (firstFraction and lastFraction).
|
105 |
|
|
* FirstFraction and lastFraction will always be valid, but
|
106 |
|
|
* the old-style information is only valid if the NEW_STYLE_COMMANDS
|
107 |
|
|
* flag is 0.
|
108 |
|
|
*/
|
109 |
|
|
|
110 |
|
|
int totalUnits; /* Total dimension of application, in
|
111 |
|
|
* units. Valid only if the NEW_STYLE_COMMANDS
|
112 |
|
|
* flag isn't set. */
|
113 |
|
|
int windowUnits; /* Maximum number of units that can be
|
114 |
|
|
* displayed in the window at once. Valid
|
115 |
|
|
* only if the NEW_STYLE_COMMANDS flag isn't
|
116 |
|
|
* set. */
|
117 |
|
|
int firstUnit; /* Number of last unit visible in
|
118 |
|
|
* application's window. Valid only if the
|
119 |
|
|
* NEW_STYLE_COMMANDS flag isn't set. */
|
120 |
|
|
int lastUnit; /* Index of last unit visible in window.
|
121 |
|
|
* Valid only if the NEW_STYLE_COMMANDS
|
122 |
|
|
* flag isn't set. */
|
123 |
|
|
double firstFraction; /* Position of first visible thing in window,
|
124 |
|
|
* specified as a fraction between 0 and
|
125 |
|
|
* 1.0. */
|
126 |
|
|
double lastFraction; /* Position of last visible thing in window,
|
127 |
|
|
* specified as a fraction between 0 and
|
128 |
|
|
* 1.0. */
|
129 |
|
|
|
130 |
|
|
/*
|
131 |
|
|
* Miscellaneous information:
|
132 |
|
|
*/
|
133 |
|
|
|
134 |
|
|
Tk_Cursor cursor; /* Current cursor for window, or None. */
|
135 |
|
|
char *takeFocus; /* Value of -takefocus option; not used in
|
136 |
|
|
* the C code, but used by keyboard traversal
|
137 |
|
|
* scripts. Malloc'ed, but may be NULL. */
|
138 |
|
|
int flags; /* Various flags; see below for
|
139 |
|
|
* definitions. */
|
140 |
|
|
} TkScrollbar;
|
141 |
|
|
|
142 |
|
|
/*
|
143 |
|
|
* Legal values for "activeField" field of Scrollbar structures. These
|
144 |
|
|
* are also the return values from the ScrollbarPosition procedure.
|
145 |
|
|
*/
|
146 |
|
|
|
147 |
|
|
#define OUTSIDE 0
|
148 |
|
|
#define TOP_ARROW 1
|
149 |
|
|
#define TOP_GAP 2
|
150 |
|
|
#define SLIDER 3
|
151 |
|
|
#define BOTTOM_GAP 4
|
152 |
|
|
#define BOTTOM_ARROW 5
|
153 |
|
|
|
154 |
|
|
/*
|
155 |
|
|
* Flag bits for scrollbars:
|
156 |
|
|
*
|
157 |
|
|
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler
|
158 |
|
|
* has already been queued to redraw
|
159 |
|
|
* this window.
|
160 |
|
|
* NEW_STYLE_COMMANDS: Non-zero means the new style of commands
|
161 |
|
|
* should be used to communicate with the
|
162 |
|
|
* widget: ".t yview scroll 2 lines", instead
|
163 |
|
|
* of ".t yview 40", for example.
|
164 |
|
|
* GOT_FOCUS: Non-zero means this window has the input
|
165 |
|
|
* focus.
|
166 |
|
|
*/
|
167 |
|
|
|
168 |
|
|
#define REDRAW_PENDING 1
|
169 |
|
|
#define NEW_STYLE_COMMANDS 2
|
170 |
|
|
#define GOT_FOCUS 4
|
171 |
|
|
|
172 |
|
|
/*
|
173 |
|
|
* Declaration of scrollbar class procedures structure.
|
174 |
|
|
*/
|
175 |
|
|
|
176 |
|
|
extern TkClassProcs tkpScrollbarProcs;
|
177 |
|
|
|
178 |
|
|
/*
|
179 |
|
|
* Declaration of scrollbar configuration options.
|
180 |
|
|
*/
|
181 |
|
|
|
182 |
|
|
extern Tk_ConfigSpec tkpScrollbarConfigSpecs[];
|
183 |
|
|
|
184 |
|
|
/*
|
185 |
|
|
* Declaration of procedures used in the implementation of the scrollbar
|
186 |
|
|
* widget.
|
187 |
|
|
*/
|
188 |
|
|
|
189 |
|
|
extern void TkScrollbarEventProc _ANSI_ARGS_((
|
190 |
|
|
ClientData clientData, XEvent *eventPtr));
|
191 |
|
|
extern void TkScrollbarEventuallyRedraw _ANSI_ARGS_((
|
192 |
|
|
TkScrollbar *scrollPtr));
|
193 |
|
|
extern void TkpComputeScrollbarGeometry _ANSI_ARGS_((
|
194 |
|
|
TkScrollbar *scrollPtr));
|
195 |
|
|
extern TkScrollbar * TkpCreateScrollbar _ANSI_ARGS_((Tk_Window tkwin));
|
196 |
|
|
extern void TkpDestroyScrollbar _ANSI_ARGS_((
|
197 |
|
|
TkScrollbar *scrollPtr));
|
198 |
|
|
extern void TkpDisplayScrollbar _ANSI_ARGS_((
|
199 |
|
|
ClientData clientData));
|
200 |
|
|
extern void TkpConfigureScrollbar _ANSI_ARGS_((
|
201 |
|
|
TkScrollbar *scrollPtr));
|
202 |
|
|
extern int TkpScrollbarPosition _ANSI_ARGS_((
|
203 |
|
|
TkScrollbar *scrollPtr, int x, int y));
|
204 |
|
|
|
205 |
|
|
# undef TCL_STORAGE_CLASS
|
206 |
|
|
# define TCL_STORAGE_CLASS DLLIMPORT
|
207 |
|
|
|
208 |
|
|
#endif /* _TKSCROLLBAR */
|
209 |
|
|
|
210 |
dashley |
69 |
/* End of tkscrollbar.h */
|