1 // vi:set ts=8 sts=4 sw=4 noet:
2 // MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL)
3 // Modifications Copyright 1992 by Mitch Trachtenberg
4 // Rights, permissions, and disclaimer of warranty are as in the
5 // DEC and MIT notice below.  See usage warning in .c file.
6 /*
7  * $XConsortium: ScrollbarP.h,v 1.3 94/04/17 20:12:42 jim Exp $
8  */
9 
10 
11 /***********************************************************
12 
13 Copyright (c) 1987, 1988  X Consortium
14 
15 Permission is hereby granted, free of charge, to any person obtaining a copy
16 of this software and associated documentation files (the "Software"), to deal
17 in the Software without restriction, including without limitation the rights
18 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 copies of the Software, and to permit persons to whom the Software is
20 furnished to do so, subject to the following conditions:
21 
22 The above copyright notice and this permission notice shall be included in
23 all copies or substantial portions of the Software.
24 
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
28 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
29 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 
32 Except as contained in this notice, the name of the X Consortium shall not be
33 used in advertising or otherwise to promote the sale, use or other dealings
34 in this Software without prior written authorization from the X Consortium.
35 
36 
37 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
38 
39 			All Rights Reserved
40 
41 Permission to use, copy, modify, and distribute this software and its
42 documentation for any purpose and without fee is hereby granted,
43 provided that the above copyright notice appear in all copies and that
44 both that copyright notice and this permission notice appear in
45 supporting documentation, and that the name of Digital not be
46 used in advertising or publicity pertaining to distribution of the
47 software without specific, written prior permission.
48 
49 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
50 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
51 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
52 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
53 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
54 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
55 SOFTWARE.
56 
57 ******************************************************************/
58 
59 #ifndef _Scrollbar_h
60 #define _Scrollbar_h
61 
62 /****************************************************************
63  *
64  * Scrollbar Widget
65  *
66  ****************************************************************/
67 
68 #include <X11/IntrinsicP.h>
69 #include <X11/Xaw/SimpleP.h>
70 #include <X11/Xmu/Converters.h>
71 
72 /*
73  * Most things we need are in StringDefs.h
74  */
75 #define XtCMinimumThumb		"MinimumThumb"
76 #define XtCShown		"Shown"
77 #define XtCTopOfThumb		"TopOfThumb"
78 #define XtCMaxOfThumb		"MaxOfThumb"
79 #define XtCShadowWidth		"ShadowWidth"
80 #define XtCTopShadowPixel	"TopShadowPixel"
81 #define XtCBottomShadowPixel	"BottomShadowPixel"
82 #define XtCLimitThumb		"LimitThumb"
83 
84 #define XtNminimumThumb		"minimumThumb"
85 #define XtNtopOfThumb		"topOfThumb"
86 #define XtNmaxOfThumb		"maxOfThumb"
87 #define XtNshadowWidth		"shadowWidth"
88 #define XtNtopShadowPixel	"topShadowPixel"
89 #define XtNbottomShadowPixel	"bottomShadowPixel"
90 #define XtNlimitThumb		"limitThumb"
91 
92 typedef struct _ScrollbarRec	  *ScrollbarWidget;
93 typedef struct _ScrollbarClassRec *ScrollbarWidgetClass;
94 
95 extern WidgetClass vim_scrollbarWidgetClass;
96 
97 extern void vim_XawScrollbarSetThumb(Widget, double, double, double);
98 
99 typedef struct
100 {
101      // public
102     Pixel	  foreground;	// thumb foreground color
103     XtOrientation orientation;	// horizontal or vertical
104     XtCallbackList scrollProc;	// proportional scroll
105     XtCallbackList thumbProc;	// jump (to position) scroll
106     XtCallbackList jumpProc;	// same as thumbProc but pass data by ref
107     Pixmap	  thumb;	// thumb color
108     float	  top;		// What percent is above the win's top
109     float	  shown;	// What percent is shown in the win
110     float	  max;		// Maximum value for top
111     Dimension	  length;	// either height or width
112     Dimension	  thickness;	// either width or height
113     Dimension	  min_thumb;	// minimum size for the thumb.
114 
115      // private
116     XtIntervalId  timer_id;	// autorepeat timer; remove on destruction
117     char	  scroll_mode;	// see below
118     float	  scroll_off;	// offset from event to top of thumb
119     GC		  gc;		// a (shared) gc
120     Position	  topLoc;	// Pixel that corresponds to top
121     Dimension	  shownLength;	// Num pixels corresponding to shown
122 
123     // From 3d widget
124     Dimension	shadow_width;
125     Pixel	top_shadow_pixel;
126     Pixel	bot_shadow_pixel;
127     Bool	limit_thumb;	// limit thumb to inside scrollbar
128     int		top_shadow_contrast;
129     int		bot_shadow_contrast;
130     GC		top_shadow_GC;
131     GC		bot_shadow_GC;
132 } ScrollbarPart;
133 
134 #define SMODE_NONE		0
135 #define SMODE_CONT		1
136 #define SMODE_PAGE_UP		2
137 #define SMODE_PAGE_DOWN		3
138 #define SMODE_LINE_UP		4
139 #define SMODE_LINE_DOWN		5
140 
141 #define ONE_LINE_DATA		1
142 #define ONE_PAGE_DATA		10
143 #define END_PAGE_DATA		9999
144 
145 typedef struct _ScrollbarRec {
146     CorePart		core;
147     SimplePart		simple;
148     ScrollbarPart	scrollbar;
149 } ScrollbarRec;
150 
151 typedef struct {int empty;} ScrollbarClassPart;
152 
153 typedef struct _ScrollbarClassRec {
154     CoreClassPart		core_class;
155     SimpleClassPart		simple_class;
156     ScrollbarClassPart		scrollbar_class;
157 } ScrollbarClassRec;
158 
159 extern ScrollbarClassRec vim_scrollbarClassRec;
160 
161 #endif // _Scrollbar_h
162