blob: 38aa4411e28130c520d097191443e7929b9cb499 [file] [log] [blame]
Bram Moolenaar9bf703d2019-11-30 19:44:38 +01001// 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.
Bram Moolenaar071d4272004-06-13 20:20:40 +00006/*
7 * $XConsortium: ScrollbarP.h,v 1.3 94/04/17 20:12:42 jim Exp $
8 */
9
10
11/***********************************************************
12
13Copyright (c) 1987, 1988 X Consortium
14
15Permission is hereby granted, free of charge, to any person obtaining a copy
16of this software and associated documentation files (the "Software"), to deal
17in the Software without restriction, including without limitation the rights
18to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19copies of the Software, and to permit persons to whom the Software is
20furnished to do so, subject to the following conditions:
21
22The above copyright notice and this permission notice shall be included in
23all copies or substantial portions of the Software.
24
25THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
29AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
32Except as contained in this notice, the name of the X Consortium shall not be
33used in advertising or otherwise to promote the sale, use or other dealings
34in this Software without prior written authorization from the X Consortium.
35
36
37Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
38
39 All Rights Reserved
40
41Permission to use, copy, modify, and distribute this software and its
42documentation for any purpose and without fee is hereby granted,
43provided that the above copyright notice appear in all copies and that
44both that copyright notice and this permission notice appear in
45supporting documentation, and that the name of Digital not be
46used in advertising or publicity pertaining to distribution of the
47software without specific, written prior permission.
48
49DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
50ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
51DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
52ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
53WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
54ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
55SOFTWARE.
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
92typedef struct _ScrollbarRec *ScrollbarWidget;
93typedef struct _ScrollbarClassRec *ScrollbarWidgetClass;
94
95extern WidgetClass vim_scrollbarWidgetClass;
96
Bram Moolenaard99df422016-01-29 23:20:40 +010097extern void vim_XawScrollbarSetThumb(Widget, double, double, double);
Bram Moolenaar071d4272004-06-13 20:20:40 +000098
99typedef struct
100{
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100101 // 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.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100115 // 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100123 // From 3d widget
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124 Dimension shadow_width;
125 Pixel top_shadow_pixel;
126 Pixel bot_shadow_pixel;
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100127 Bool limit_thumb; // limit thumb to inside scrollbar
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128 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
145typedef struct _ScrollbarRec {
146 CorePart core;
147 SimplePart simple;
148 ScrollbarPart scrollbar;
149} ScrollbarRec;
150
151typedef struct {int empty;} ScrollbarClassPart;
152
153typedef struct _ScrollbarClassRec {
154 CoreClassPart core_class;
155 SimpleClassPart simple_class;
156 ScrollbarClassPart scrollbar_class;
157} ScrollbarClassRec;
158
159extern ScrollbarClassRec vim_scrollbarClassRec;
160
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100161#endif // _Scrollbar_h