annotate src/gui_at_sb.c @ 7450:e159dff12e40 v7.4.1028

commit https://github.com/vim/vim/commit/92c23d8ab82e723e5fa2e0c5ee06348d72b8e444 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 2 18:08:01 2016 +0100 patch 7.4.1028 Problem: Nsis version file missing from the distribution. Solution: Add the file to the list.
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Jan 2016 18:15:04 +0100
parents e5265e4d4725
children 4635a259ecc0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * Modifications Copyright 1992 by Mitch Trachtenberg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Rights, permissions, and disclaimer of warranty are as in the DEC and MIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * notice below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * $XConsortium: Scrollbar.c,v 1.72 94/04/17 20:12:40 kaleb Exp $
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * Modified for Vim by Bill Foster and Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 Copyright (c) 1987, 1988, 1994 X Consortium
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 Permission is hereby granted, free of charge, to any person obtaining a copy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 of this software and associated documentation files (the "Software"), to deal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 in the Software without restriction, including without limitation the rights
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 copies of the Software, and to permit persons to whom the Software is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 furnished to do so, subject to the following conditions:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 The above copyright notice and this permission notice shall be included in all
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 copies or substantial portions of the Software.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 Except as contained in this notice, the name of the X Consortium shall not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 used in advertising or otherwise to promote the sale, use or other dealings in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 this Software without prior written authorization from the X Consortium.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 All Rights Reserved
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 Permission to use, copy, modify, and distribute this software and its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 documentation for any purpose and without fee is hereby granted, provided that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 the above copyright notice appear in all copies and that both that copyright
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 notice and this permission notice appear in supporting documentation, and that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 the name of Digital not be used in advertising or publicity pertaining to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 distribution of the software without specific, written prior permission.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 /* ScrollBar.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 /* created by weissman, Mon Jul 7 13:20:03 1986 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 /* converted by swick, Thu Aug 27 1987 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 #include <X11/IntrinsicP.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #include <X11/StringDefs.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #include <X11/Xaw/XawInit.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 #include "gui_at_sb.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 #include <X11/Xmu/Drawing.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 /* Private definitions. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 static char defaultTranslations[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 "<Btn1Down>: NotifyScroll()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 <Btn2Down>: MoveThumb() NotifyThumb()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 <Btn3Down>: NotifyScroll()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 <Btn4Down>: ScrollOneLineUp()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 Shift<Btn4Down>: ScrollPageUp()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 <Btn5Down>: ScrollOneLineDown()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 Shift<Btn5Down>: ScrollPageDown()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 <Btn1Motion>: HandleThumb()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 <Btn3Motion>: HandleThumb()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 <Btn2Motion>: MoveThumb() NotifyThumb()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 <BtnUp>: EndScroll()";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 static float floatZero = 0.0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 #define Offset(field) XtOffsetOf(ScrollbarRec, field)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 static XtResource resources[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 {XtNlength, XtCLength, XtRDimension, sizeof(Dimension),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 Offset(scrollbar.length), XtRImmediate, (XtPointer) 1},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 {XtNthickness, XtCThickness, XtRDimension, sizeof(Dimension),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 Offset(scrollbar.thickness), XtRImmediate, (XtPointer) 14},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 Offset(scrollbar.orientation), XtRImmediate, (XtPointer) XtorientVertical},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 {XtNscrollProc, XtCCallback, XtRCallback, sizeof(XtPointer),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 Offset(scrollbar.scrollProc), XtRCallback, NULL},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 {XtNthumbProc, XtCCallback, XtRCallback, sizeof(XtPointer),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 Offset(scrollbar.thumbProc), XtRCallback, NULL},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 {XtNjumpProc, XtCCallback, XtRCallback, sizeof(XtPointer),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 Offset(scrollbar.jumpProc), XtRCallback, NULL},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 {XtNthumb, XtCThumb, XtRBitmap, sizeof(Pixmap),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 Offset(scrollbar.thumb), XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 Offset(scrollbar.foreground), XtRString, XtDefaultForeground},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 {XtNshown, XtCShown, XtRFloat, sizeof(float),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 Offset(scrollbar.shown), XtRFloat, (XtPointer)&floatZero},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 {XtNtopOfThumb, XtCTopOfThumb, XtRFloat, sizeof(float),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 Offset(scrollbar.top), XtRFloat, (XtPointer)&floatZero},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 {XtNmaxOfThumb, XtCMaxOfThumb, XtRFloat, sizeof(float),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 Offset(scrollbar.max), XtRFloat, (XtPointer)&floatZero},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 {XtNminimumThumb, XtCMinimumThumb, XtRDimension, sizeof(Dimension),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 Offset(scrollbar.min_thumb), XtRImmediate, (XtPointer) 7},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 Offset(scrollbar.shadow_width), XtRImmediate, (XtPointer) 1},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 {XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 Offset(scrollbar.top_shadow_pixel), XtRString, XtDefaultBackground},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 {XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 Offset(scrollbar.bot_shadow_pixel), XtRString, XtDefaultForeground},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 {XtNlimitThumb, XtCLimitThumb, XtRBool, sizeof(Bool),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 Offset(scrollbar.limit_thumb), XtRImmediate, (XtPointer)0}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 #undef Offset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 static void ClassInitialize __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 static void Initialize __ARGS((Widget, Widget, ArgList, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 static void Destroy __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 static void Realize __ARGS((Widget, Mask *, XSetWindowAttributes *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 static void Resize __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 static void Redisplay __ARGS((Widget, XEvent *, Region));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 static Boolean SetValues __ARGS((Widget, Widget, Widget, ArgList, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 static void HandleThumb __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 static void MoveThumb __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 static void NotifyThumb __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 static void NotifyScroll __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 static void EndScroll __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 static void ScrollOneLineUp __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 static void ScrollOneLineDown __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 static void ScrollPageUp __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static void ScrollPageDown __ARGS((Widget, XEvent *, String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 static void ScrollSome __ARGS((Widget w, XEvent *event, int call_data));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 static void _Xaw3dDrawShadows __ARGS((Widget, XEvent *, Region, int));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 static void AllocTopShadowGC __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 static void AllocBotShadowGC __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 static XtActionsRec actions[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 {"HandleThumb", HandleThumb},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 {"MoveThumb", MoveThumb},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 {"NotifyThumb", NotifyThumb},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 {"NotifyScroll", NotifyScroll},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 {"EndScroll", EndScroll},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 {"ScrollOneLineUp", ScrollOneLineUp},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 {"ScrollOneLineDown", ScrollOneLineDown},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 {"ScrollPageUp", ScrollPageUp},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 {"ScrollPageDown", ScrollPageDown}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 ScrollbarClassRec vim_scrollbarClassRec =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 { /* core fields */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 /* superclass */ (WidgetClass) &simpleClassRec,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 /* class_name */ "Scrollbar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 /* size */ sizeof(ScrollbarRec),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 /* class_initialize */ ClassInitialize,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 /* class_part_init */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 /* class_inited */ FALSE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 /* initialize */ Initialize,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 /* initialize_hook */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 /* realize */ Realize,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 /* actions */ actions,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 /* num_actions */ XtNumber(actions),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 /* resources */ resources,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 /* num_resources */ XtNumber(resources),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 /* xrm_class */ NULLQUARK,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 /* compress_motion */ TRUE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 /* compress_exposure*/ TRUE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 /* compress_enterleave*/ TRUE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 /* visible_interest */ FALSE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 /* destroy */ Destroy,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 /* resize */ Resize,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 /* expose */ Redisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 /* set_values */ SetValues,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 /* set_values_hook */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 /* set_values_almost */ XtInheritSetValuesAlmost,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 /* get_values_hook */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 /* accept_focus */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 /* version */ XtVersion,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 /* callback_private */ NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 /* tm_table */ defaultTranslations,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 /* query_geometry */ XtInheritQueryGeometry,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 /* display_accelerator*/ XtInheritDisplayAccelerator,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 /* extension */ NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 { /* simple fields */
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
201 /* change_sensitive */ XtInheritChangeSensitive,
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
202 #ifndef OLDXAW
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
203 /* extension */ NULL
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
204 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 { /* scrollbar fields */
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
207 /* empty */ 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 WidgetClass vim_scrollbarWidgetClass = (WidgetClass)&vim_scrollbarClassRec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 #define NoButton -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 #define PICKLENGTH(widget, x, y) \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 ((widget->scrollbar.orientation == XtorientHorizontal) ? (x) : (y))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 #define AT_MIN(x,y) ((x) < (y) ? (x) : (y))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 #define AT_MAX(x,y) ((x) > (y) ? (x) : (y))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 #define LINE_DELAY 300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 #define PAGE_DELAY 300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 #define LINE_REPEAT 50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 #define PAGE_REPEAT 250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 ClassInitialize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 XawInitializeWidgetSet();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 (XtConvertArgList)NULL, (Cardinal)0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 #define MARGIN(sbw) (sbw)->scrollbar.thickness + (sbw)->scrollbar.shadow_width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 FillArea(sbw, top, bottom, fill, draw_shadow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 ScrollbarWidget sbw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 Position top, bottom;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 int fill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 int draw_shadow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 int tlen = bottom - top; /* length of thumb in pixels */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 int sw, margin, floor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 int lx, ly, lw, lh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 if (bottom <= 0 || bottom <= top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 return;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
247 sw = sbw->scrollbar.shadow_width;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
248 if (sw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 sw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 margin = MARGIN (sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 floor = sbw->scrollbar.length - margin + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 if (sbw->scrollbar.orientation == XtorientHorizontal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 lx = ((top < margin) ? margin : top);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 ly = sw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 lw = (((top + tlen) > floor) ? floor - top : tlen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 lh = sbw->core.height - 2 * sw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 lx = sw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 ly = ((top < margin) ? margin : top);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 lw = sbw->core.width - 2 * sw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 lh = (((top + tlen) > floor) ? floor - top : tlen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 if (lh <= 0 || lw <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 if (draw_shadow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 if (!(sbw->scrollbar.orientation == XtorientHorizontal))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 /* Top border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 lx, ly, lx + lw - 1, ly);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 /* Bottom border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 /* Left border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 lx, ly, lx, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 /* Right border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 if (fill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 sbw->scrollbar.gc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 lx, ly, (unsigned int) lw, (unsigned int) lh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 if (!(sbw->scrollbar.orientation == XtorientHorizontal))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 /* Left border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 lx, ly, lx, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 /* Right border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 /* Top border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 lx, ly, lx + lw - 1, ly);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 /* Bottom border */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 XClearArea(XtDisplay((Widget) sbw), XtWindow((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 lx, ly, (unsigned int) lw, (unsigned int) lh, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 /* Paint the thumb in the area specified by sbw->top and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 sbw->shown. The old area is erased. The painting and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 erasing is done cleverly so that no flickering will occur.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 PaintThumb(sbw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 ScrollbarWidget sbw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 Position oldtop, oldbot, newtop, newbot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 Dimension margin, tzl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 margin = MARGIN (sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 tzl = sbw->scrollbar.length - 2 * margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 newtop = margin + (int)(tzl * sbw->scrollbar.top);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 newbot = newtop + (int)(tzl * sbw->scrollbar.shown) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 if (newbot < newtop + (int)sbw->scrollbar.min_thumb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 newbot = newtop + sbw->scrollbar.min_thumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 oldtop = sbw->scrollbar.topLoc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 oldbot = oldtop + sbw->scrollbar.shownLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 sbw->scrollbar.topLoc = newtop;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 sbw->scrollbar.shownLength = newbot - newtop;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 if (XtIsRealized ((Widget) sbw))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 if (newtop < oldtop)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 FillArea(sbw, newtop, AT_MIN(newbot, oldtop+1),1,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 if (newtop > oldtop)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 FillArea(sbw, oldtop, AT_MIN(newtop, oldbot ),0,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 if (newbot < oldbot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 FillArea(sbw, AT_MAX(newbot, oldtop), oldbot, 0,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 if (newbot > oldbot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 FillArea(sbw, AT_MAX(newtop, oldbot-1), newbot, 1,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 /* Only draw the missing shadows */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 FillArea(sbw, newtop, newbot, 0, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 PaintArrows(sbw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 ScrollbarWidget sbw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 XPoint point[6];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 Dimension thickness = sbw->scrollbar.thickness - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 Dimension size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 Dimension off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 if (XtIsRealized((Widget) sbw))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 if ((int)thickness * 2 > (int)sbw->scrollbar.length)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 size = sbw->scrollbar.length / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 off = (int)(thickness - size) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 size = thickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 off = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 point[0].x = off + sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 point[0].y = size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 point[1].x = thickness - off - sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 point[1].y = size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 point[2].x = thickness / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 point[2].y = sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 point[3].x = off + sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 point[3].y = sbw->scrollbar.length - size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 point[4].x = thickness - off - sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 point[4].y = sbw->scrollbar.length - size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 point[5].x = thickness / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 point[5].y = sbw->scrollbar.length - sbw->scrollbar.shadow_width - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 /* horizontal arrows require that x and y coordinates be swapped */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 if (sbw->scrollbar.orientation == XtorientHorizontal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 int swap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 for (n = 0; n < 6; n++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 swap = point[n].x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 point[n].x = point[n].y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 point[n].y = swap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 /* draw the up/left arrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 sbw->scrollbar.gc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 point, 3,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 Convex, CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 XDrawLines (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 point, 3,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 point[0].x, point[0].y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 point[2].x, point[2].y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 /* draw the down/right arrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 sbw->scrollbar.gc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 point+3, 3,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 Convex, CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 point[3].x, point[3].y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 point[4].x, point[4].y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 sbw->scrollbar.top_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 point[3].x, point[3].y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 point[5].x, point[5].y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 sbw->scrollbar.bot_shadow_GC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 point[4].x, point[4].y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 point[5].x, point[5].y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 Destroy(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 if (sbw->scrollbar.timer_id != (XtIntervalId) 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 XtRemoveTimeOut (sbw->scrollbar.timer_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 XtReleaseGC(w, sbw->scrollbar.gc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 XtReleaseGC(w, sbw->scrollbar.top_shadow_GC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 XtReleaseGC(w, sbw->scrollbar.bot_shadow_GC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 CreateGC(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 XGCValues gcValues;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 XtGCMask mask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 unsigned int depth = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 if (sbw->scrollbar.thumb == XtUnspecifiedPixmap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 (Pixel) 1, (Pixel) 0, depth);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 else if (sbw->scrollbar.thumb != None)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 Window root;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 unsigned int width, height, bw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 if (XGetGeometry (XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 &width, &height, &bw, &depth) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 EMSG(_("Scrollbar Widget: Could not get geometry of thumb pixmap."));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 gcValues.foreground = sbw->scrollbar.foreground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 gcValues.background = sbw->core.background_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 mask = GCForeground | GCBackground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 if (sbw->scrollbar.thumb != None)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 gcValues.fill_style = FillSolid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 mask |= GCFillStyle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 /* the creation should be non-caching, because */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 /* we now set and clear clip masks on the gc returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 SetDimensions(sbw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 ScrollbarWidget sbw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 if (sbw->scrollbar.orientation == XtorientVertical)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 sbw->scrollbar.length = sbw->core.height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 sbw->scrollbar.thickness = sbw->core.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 sbw->scrollbar.length = sbw->core.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 sbw->scrollbar.thickness = sbw->core.height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 Initialize(request, new, args, num_args)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
525 Widget request UNUSED; /* what the client asked for */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 Widget new; /* what we're going to give him */
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
527 ArgList args UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
528 Cardinal *num_args UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 ScrollbarWidget sbw = (ScrollbarWidget) new;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 CreateGC(new);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 AllocTopShadowGC(new);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 AllocBotShadowGC(new);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 if (sbw->core.width == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 sbw->core.width = (sbw->scrollbar.orientation == XtorientVertical)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 ? sbw->scrollbar.thickness : sbw->scrollbar.length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 if (sbw->core.height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 sbw->core.height = (sbw->scrollbar.orientation == XtorientHorizontal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 ? sbw->scrollbar.thickness : sbw->scrollbar.length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 SetDimensions(sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 sbw->scrollbar.scroll_mode = SMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 sbw->scrollbar.timer_id = (XtIntervalId)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 sbw->scrollbar.topLoc = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 sbw->scrollbar.shownLength = sbw->scrollbar.min_thumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 Realize(w, valueMask, attributes)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 Mask *valueMask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 XSetWindowAttributes *attributes;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 /* The Simple widget actually stuffs the value in the valuemask. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 (w, valueMask, attributes);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 SetValues(current, request, desired, args, num_args)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
564 Widget current; /* what I am */
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
565 Widget request UNUSED; /* what he wants me to be */
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
566 Widget desired; /* what I will become */
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
567 ArgList args UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
568 Cardinal *num_args UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 ScrollbarWidget sbw = (ScrollbarWidget) current;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 ScrollbarWidget dsbw = (ScrollbarWidget) desired;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 Boolean redraw = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 * If these values are outside the acceptable range ignore them...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 if (dsbw->scrollbar.top < 0.0 || dsbw->scrollbar.top > 1.0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 dsbw->scrollbar.top = sbw->scrollbar.top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 if (dsbw->scrollbar.shown < 0.0 || dsbw->scrollbar.shown > 1.0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 dsbw->scrollbar.shown = sbw->scrollbar.shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 * Change colors and stuff...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 if (XtIsRealized(desired))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 if (sbw->scrollbar.foreground != dsbw->scrollbar.foreground ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 sbw->core.background_pixel != dsbw->core.background_pixel ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 sbw->scrollbar.thumb != dsbw->scrollbar.thumb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 XtReleaseGC(desired, sbw->scrollbar.gc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 CreateGC (desired);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 redraw = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 if (sbw->scrollbar.top != dsbw->scrollbar.top ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 sbw->scrollbar.shown != dsbw->scrollbar.shown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 redraw = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 return redraw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 Resize(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 /* ForgetGravity has taken care of background, but thumb may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 * have to move as a result of the new size. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 SetDimensions ((ScrollbarWidget) w);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 Redisplay(w, (XEvent*) NULL, (Region)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 Redisplay(w, event, region)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 Region region;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 unsigned int width, height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 _Xaw3dDrawShadows(w, event, region, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 if (sbw->scrollbar.orientation == XtorientHorizontal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 x = sbw->scrollbar.topLoc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 y = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 width = sbw->scrollbar.shownLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 height = sbw->core.height - 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 x = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 y = sbw->scrollbar.topLoc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 width = sbw->core.width - 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 height = sbw->scrollbar.shownLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 if (region == NULL ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 XRectInRegion (region, x, y, width, height) != RectangleOut)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 /* Forces entire thumb to be painted. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 PaintThumb (sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 /* we'd like to be region aware here!!!! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 PaintArrows(sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 CompareEvents(oldEvent, newEvent)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 XEvent *oldEvent, *newEvent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 #define Check(field) if (newEvent->field != oldEvent->field) return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 Check(xany.display);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 Check(xany.type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 Check(xany.window);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 switch (newEvent->type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 case MotionNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 Check(xmotion.state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 case ButtonPress:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 case ButtonRelease:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669 Check(xbutton.state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 Check(xbutton.button);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 case KeyPress:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 case KeyRelease:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 Check(xkey.state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 Check(xkey.keycode);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 case EnterNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 case LeaveNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 Check(xcrossing.mode);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 Check(xcrossing.detail);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 Check(xcrossing.state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 #undef Check
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 struct EventData
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 XEvent *oldEvent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 int count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 static Bool
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 PeekNotifyEvent(dpy, event, args)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 Display *dpy;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 char *args;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 struct EventData *eventData = (struct EventData*)args;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 || CompareEvents(event, eventData->oldEvent));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 LookAhead(w, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 XEvent newEvent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 struct EventData eventData;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 if (QLength (XtDisplay (w)) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 eventData.count = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 eventData.oldEvent = event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 XPeekIfEvent (XtDisplay (w), &newEvent, PeekNotifyEvent, (char*)&eventData);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 return CompareEvents (event, &newEvent);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 ExtractPosition(event, x, y, state)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 Position *x, *y; /* RETURN */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 unsigned int *state; /* RETURN */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 switch (event->type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 case MotionNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 *x = event->xmotion.x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 *y = event->xmotion.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 if (state != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 *state = event->xmotion.state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 case ButtonPress:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 case ButtonRelease:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 *x = event->xbutton.x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 *y = event->xbutton.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 if (state != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 *state = event->xbutton.state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 case KeyPress:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 case KeyRelease:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 *x = event->xkey.x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 *y = event->xkey.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 if (state != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 *state = event->xkey.state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 case EnterNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 case LeaveNotify:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 *x = event->xcrossing.x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 *y = event->xcrossing.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 if (state != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 *state = event->xcrossing.state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 *x = 0; *y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 if (state != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 *state = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 HandleThumb(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 String *params;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 Cardinal *num_params;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 Position x, y, loc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 ExtractPosition(event, &x, &y, (unsigned int *)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 loc = PICKLENGTH(sbw, x, y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 /* if the motion event puts the pointer in thumb, call Move and Notify */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 /* also call Move and Notify if we're already in continuous scroll mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 if (sbw->scrollbar.scroll_mode == SMODE_CONT ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 (loc >= sbw->scrollbar.topLoc &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 loc <= sbw->scrollbar.topLoc + (int)sbw->scrollbar.shownLength))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 XtCallActionProc(w, "MoveThumb", event, params, *num_params);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 XtCallActionProc(w, "NotifyThumb", event, params, *num_params);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 RepeatNotify(client_data, idp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 XtPointer client_data;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
796 XtIntervalId *idp UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 ScrollbarWidget sbw = (ScrollbarWidget) client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 int call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 char mode = sbw->scrollbar.scroll_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 unsigned long rep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 if (mode == SMODE_NONE || mode == SMODE_CONT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 sbw->scrollbar.timer_id = (XtIntervalId)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 if (mode == SMODE_LINE_DOWN || mode == SMODE_LINE_UP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 call_data = ONE_LINE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 rep = LINE_REPEAT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 call_data = ONE_PAGE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 rep = PAGE_REPEAT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 if (mode == SMODE_PAGE_UP || mode == SMODE_LINE_UP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 call_data = -call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
823 XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer)(long_u)call_data);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 sbw->scrollbar.timer_id =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)sbw),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 rep,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 RepeatNotify,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 client_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 * Same as above, but for floating numbers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 static float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 FloatInRange(num, small, big)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 float num, small, big;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 return (num < small) ? small : ((num > big) ? big : num);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 ScrollOneLineUp(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
846 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
847 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 ScrollSome(w, event, -ONE_LINE_DATA);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 ScrollOneLineDown(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
856 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
857 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 ScrollSome(w, event, ONE_LINE_DATA);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 ScrollPageDown(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
866 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
867 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 ScrollSome(w, event, ONE_PAGE_DATA);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 ScrollPageUp(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
876 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
877 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 ScrollSome(w, event, -ONE_PAGE_DATA);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 ScrollSome(w, event, call_data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 int call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 if (LookAhead(w, event))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 sbw->scrollbar.scroll_mode = SMODE_LINE_UP;
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
897 XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 NotifyScroll(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
904 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
905 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 Position x, y, loc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 Dimension arrow_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 unsigned long delay = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 int call_data = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 unsigned int state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 if (LookAhead (w, event))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 ExtractPosition(event, &x, &y, &state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 loc = PICKLENGTH(sbw, x, y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 if ((int)sbw->scrollbar.thickness * 2 > (int)sbw->scrollbar.length)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 arrow_size = sbw->scrollbar.length / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 arrow_size = sbw->scrollbar.thickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 * handle CTRL modifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 if (state & ControlMask)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 if (loc > sbw->scrollbar.topLoc + (Position)sbw->scrollbar.shownLength)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 call_data = END_PAGE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 call_data = -END_PAGE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 sbw->scrollbar.scroll_mode = SMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 * handle first arrow zone
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 else if (loc < (Position)arrow_size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 call_data = -ONE_LINE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 sbw->scrollbar.scroll_mode = SMODE_LINE_UP;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 delay = LINE_DELAY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 * handle last arrow zone
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 else if (loc > (Position)(sbw->scrollbar.length - arrow_size))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 call_data = ONE_LINE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 sbw->scrollbar.scroll_mode = SMODE_LINE_DOWN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 delay = LINE_DELAY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 * handle zone "above" the thumb
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 else if (loc < sbw->scrollbar.topLoc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 call_data = -ONE_PAGE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 sbw->scrollbar.scroll_mode = SMODE_PAGE_UP;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 delay = PAGE_DELAY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 * handle zone "below" the thumb
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 else if (loc > sbw->scrollbar.topLoc + (Position)sbw->scrollbar.shownLength)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 call_data = ONE_PAGE_DATA;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 sbw->scrollbar.scroll_mode = SMODE_PAGE_DOWN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 delay = PAGE_DELAY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 if (call_data)
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
980 XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 /* establish autoscroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 if (delay)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 sbw->scrollbar.timer_id =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 XtAppAddTimeOut(XtWidgetToApplicationContext(w),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 delay, RepeatNotify, (XtPointer)w);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 EndScroll(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 Widget w;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
992 XEvent *event UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
993 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
994 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 sbw->scrollbar.scroll_mode = SMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 /* no need to remove any autoscroll timeout; it will no-op */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 /* because the scroll_mode is SMODE_NONE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 /* but be sure to remove timeout in destroy proc */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 static float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 FractionLoc(sbw, x, y)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 ScrollbarWidget sbw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 int margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 float height, width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 margin = MARGIN(sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 x -= margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 y -= margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 height = (float)sbw->core.height - 2 * margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016 width = (float)sbw->core.width - 2 * margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 return PICKLENGTH(sbw, x / width, y / height);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 MoveThumb(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
1024 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
1025 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 ScrollbarWidget sbw = (ScrollbarWidget)w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 Position x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 float top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 char old_mode = sbw->scrollbar.scroll_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 sbw->scrollbar.scroll_mode = SMODE_CONT; /* indicate continuous scroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 if (LookAhead(w, event))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 if (!event->xmotion.same_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 ExtractPosition(event, &x, &y, (unsigned int *)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 top = FractionLoc(sbw, x, y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 if (old_mode != SMODE_CONT) /* start dragging: set offset */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 if (event->xbutton.button == Button2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 sbw->scrollbar.scroll_off = sbw->scrollbar.shown / 2.;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 sbw->scrollbar.scroll_off = top - sbw->scrollbar.top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 top -= sbw->scrollbar.scroll_off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 if (sbw->scrollbar.limit_thumb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 top = FloatInRange(top, 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 sbw->scrollbar.max - sbw->scrollbar.shown + 0.000001);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 top = FloatInRange(top, 0.0, sbw->scrollbar.max);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 sbw->scrollbar.top = top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 PaintThumb(sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 XFlush(XtDisplay(w)); /* re-draw it before Notifying */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 NotifyThumb(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
1069 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
1070 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 ScrollbarWidget sbw = (ScrollbarWidget)w;
1757
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1073 /* Use a union to avoid a warning for the weird conversion from float to
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1074 * XtPointer. Comes from Xaw/Scrollbar.c. */
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1075 union {
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1076 XtPointer xtp;
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1077 float xtf;
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1078 } xtpf;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 if (LookAhead(w, event))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 /* thumbProc is not pretty, but is necessary for backwards
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 compatibility on those architectures for which it work{s,ed};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 the intent is to pass a (truncated) float by value. */
1757
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1086 xtpf.xtf = sbw->scrollbar.top;
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 7
diff changeset
1087 XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 AllocTopShadowGC(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 XtGCMask valuemask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 XGCValues myXGCV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 valuemask = GCForeground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 myXGCV.foreground = sbw->scrollbar.top_shadow_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 sbw->scrollbar.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 AllocBotShadowGC(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 XtGCMask valuemask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 XGCValues myXGCV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 valuemask = GCForeground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 myXGCV.foreground = sbw->scrollbar.bot_shadow_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 sbw->scrollbar.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 _Xaw3dDrawShadows(gw, event, region, out)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 Widget gw;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1757
diff changeset
1120 XEvent *event UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 Region region;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 int out;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 XPoint pt[6];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 ScrollbarWidget sbw = (ScrollbarWidget) gw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 Dimension s = sbw->scrollbar.shadow_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 * draw the shadows using the core part width and height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 * and the scrollbar part shadow_width.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 * no point to do anything if the shadow_width is 0 or the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 * widget has not been realized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 if (s > 0 && XtIsRealized(gw))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 Dimension h = sbw->core.height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 Dimension w = sbw->core.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 Dimension wms = w - s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 Dimension hms = h - s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 Display *dpy = XtDisplay (gw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 Window win = XtWindow (gw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 GC top, bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 if (out)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 top = sbw->scrollbar.top_shadow_GC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 bot = sbw->scrollbar.bot_shadow_GC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 top = sbw->scrollbar.bot_shadow_GC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 bot = sbw->scrollbar.top_shadow_GC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 /* top-left shadow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 if ((region == NULL) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 (XRectInRegion (region, 0, 0, s, h) != RectangleOut))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 pt[0].x = 0; pt[0].y = h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 pt[1].x = pt[1].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 pt[2].x = w; pt[2].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 pt[3].x = wms; pt[3].y = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 pt[4].x = pt[4].y = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 pt[5].x = s; pt[5].y = hms;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 XFillPolygon (dpy, win, top, pt, 6, Complex, CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 /* bottom-right shadow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 if ((region == NULL) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 (XRectInRegion (region, wms, 0, s, h) != RectangleOut))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 pt[0].x = 0; pt[0].y = h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 pt[1].x = w; pt[1].y = h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 pt[2].x = w; pt[2].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 pt[3].x = wms; pt[3].y = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 pt[4].x = wms; pt[4].y = hms;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 pt[5].x = s; pt[5].y = hms;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 XFillPolygon (dpy, win, bot, pt, 6, Complex, CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 * Set the scroll bar to the given location.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 vim_XawScrollbarSetThumb(w, top, shown, max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 double top, shown, max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 ScrollbarWidget sbw = (ScrollbarWidget) w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if still thumbing */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 sbw->scrollbar.max = (max > 1.0) ? 1.0 :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 (max >= 0.0) ? max : sbw->scrollbar.max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 sbw->scrollbar.top = (top > sbw->scrollbar.max) ? sbw->scrollbar.max :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 (top >= 0.0) ? top : sbw->scrollbar.top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 sbw->scrollbar.shown = (shown > 1.0) ? 1.0 :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 (shown >= 0.0) ? shown : sbw->scrollbar.shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 PaintThumb(sbw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 }