annotate lwlib/xlwscrollbar.c @ 10:49a24b4fd526 r19-15b6

Import from CVS: tag r19-15b6
author cvs
date Mon, 13 Aug 2007 08:47:52 +0200
parents ac2d302a0011
children 9ee227acff29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Implements a lightweight scrollbar widget.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Lucid, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of the Lucid Widget Library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 The Lucid Widget Library is free software; you can redistribute it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 modify it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 The Lucid Widget Library is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
19 Boston, MA 02111-1307, USA. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Created by Douglas Keller <dkeller@vnet.ibm.com> */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 * Athena-style scrollbar button bindings added on Sun Dec 24 22:03:57 1995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 * by Jonathan Stigelman <Stig@hackvan.com>... Ho ho ho!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * To use them, put this resource in your .Xdefaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Emacs*XlwScrollBar.translations: #override \n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 * <Btn1Down>: PageDownOrRight() \n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * <Btn3Down>: PageUpOrLeft()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 * Resources Supported:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 * XmNforeground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 * XmNbackground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 * XmNtopShadowColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 * XmNtopShadowPixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 * XmNbottomShadowColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 * XmNbottomShadowPixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 * XmNtroughColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 * XmNshadowThickness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 * XmNshowArrows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 * XmNorientation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 * XmNborderWidth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 * XmNminimum
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 * XmNmaximum
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 * XmNvalue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 * XmNincrement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 * XmNpageIncrement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 * XmNvalueChangedCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 * XmNincrementCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 * XmNdecrementCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 * XmNpageIncrementCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 * XmNpageDecrementCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 * XmNtoTopCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 * XmNtoBottomCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 * XmNdragCallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 * XmNknobStyle - values can be: "plain" or "dimple"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 * XmNarrowPosition - values can be: "opposite" or "same"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 #include <limits.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #include <X11/IntrinsicP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #include <X11/bitmaps/gray>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #include "xlwscrollbarP.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 #include "xlwscrollbar.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 #define DBUG(x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
83 ? ((unsigned long) (x)) : ((unsigned long) (y)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
85 #define VERT(w) ((w)->sb.orientation == XmVERTICAL)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 #define SS_MIN 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 #define ARROW_UP 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 #define ARROW_DOWN 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 #define ARROW_LEFT 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 #define ARROW_RIGHT 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 #define ARM_NONE 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 #define ARM_KNOB 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 #define ARM_UP 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 #define ARM_DOWN 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 #define ARM_PAGEUP 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 #define ARM_PAGEDOWN 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 #define BUTTON_NONE 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #define BUTTON_KNOB 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 #define BUTTON_UP_ARROW 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 #define BUTTON_DOWN_ARROW 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 #define BUTTON_TROUGH_ABOVE 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 #define BUTTON_TROUGH_BELOW 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 #define KNOB_PLAIN 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 #define KNOB_DIMPLE 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ** Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 #define offset(field) XtOffset(XlwScrollBarWidget, field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 static XtResource resources[] = {
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
119 { (String) XmNforeground, (String) XmCForeground, XtRPixel, sizeof(Pixel),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
120 offset(sb.foreground), XtRImmediate, (XtPointer) XtDefaultForeground },
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
121
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
122 { (String) XmNtopShadowColor, (String) XmCTopShadowColor, XtRPixel,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
123 sizeof(Pixel), offset(sb.topShadowColor), XtRImmediate, (XtPointer) ~0 },
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
124 { (String) XmNbottomShadowColor, (String) XmCBottomShadowColor, XtRPixel,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
125 sizeof(Pixel), offset(sb.bottomShadowColor), XtRImmediate,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
126 (XtPointer)~0 },
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
128 { (String) XmNtopShadowPixmap, (String) XmCTopShadowPixmap, XtRPixmap,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
129 sizeof (Pixmap), offset(sb.topShadowPixmap), XtRImmediate,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
130 (XtPointer)None},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
131 { (String) XmNbottomShadowPixmap, (String) XmCBottomShadowPixmap,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
132 XtRPixmap, sizeof (Pixmap), offset(sb.bottomShadowPixmap),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
133 XtRImmediate, (XtPointer)None},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
135 { (String)XmNtroughColor, (String)XmCTroughColor, XtRPixel, sizeof(Pixel),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 offset(sb.troughColor), XtRImmediate, (XtPointer)~0 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
138 { (String)XmNshadowThickness, (String)XmCShadowThickness, XtRInt,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
139 sizeof(int), offset(sb.shadowThickness), XtRImmediate, (XtPointer)2 },
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
141 { (String) XmNborderWidth, (String) XmCBorderWidth, XtRDimension,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
142 sizeof(Dimension), offset(core.border_width), XtRImmediate,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
143 (XtPointer)0 },
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
145 { (String) XmNshowArrows, (String) XmCShowArrows, XtRBoolean,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
146 sizeof(Boolean), offset(sb.showArrows), XtRImmediate, (XtPointer)True },
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
148 { (String) XmNinitialDelay, (String) XmCInitialDelay, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 offset(sb.initialDelay), XtRImmediate, (XtPointer) 250 },
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
150 { (String) XmNrepeatDelay, (String) XmCRepeatDelay, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 offset(sb.repeatDelay), XtRImmediate, (XtPointer) 50 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
153 { (String) XmNorientation, (String) XmCOrientation, XtROrientation,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
154 sizeof(unsigned char), offset(sb.orientation), XtRImmediate,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
155 (XtPointer) XmVERTICAL },
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
157 { (String) XmNminimum, (String) XmCMinimum, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 offset(sb.minimum), XtRImmediate, (XtPointer) 0},
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
159 { (String) XmNmaximum, (String) XmCMaximum, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 offset(sb.maximum), XtRImmediate, (XtPointer) 100},
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
161 { (String) XmNvalue, (String) XmCValue, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 offset(sb.value), XtRImmediate, (XtPointer) 0},
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
163 { (String) XmNsliderSize, (String) XmCSliderSize, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 offset(sb.sliderSize), XtRImmediate, (XtPointer) 10},
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
165 { (String) XmNincrement, (String) XmCIncrement, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 offset(sb.increment), XtRImmediate, (XtPointer) 1},
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
167 { (String)XmNpageIncrement, (String)XmCPageIncrement, XtRInt, sizeof(int),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 offset(sb.pageIncrement), XtRImmediate, (XtPointer) 10},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
170 { (String) XmNvalueChangedCallback, (String) XmCValueChangedCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
171 XtRCallback, sizeof(XtPointer), offset(sb.valueChangedCBL),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
172 XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
173 { (String) XmNincrementCallback, (String) XmCIncrementCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
174 XtRCallback, sizeof(XtPointer), offset(sb.incrementCBL),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
175 XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
176 { (String) XmNdecrementCallback, (String) XmCDecrementCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
177 XtRCallback, sizeof(XtPointer), offset(sb.decrementCBL),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
178 XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
179 { (String) XmNpageIncrementCallback, (String) XmCPageIncrementCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
180 XtRCallback, sizeof(XtPointer), offset(sb.pageIncrementCBL),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
181 XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
182 { (String) XmNpageDecrementCallback, (String) XmCPageDecrementCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
183 XtRCallback, sizeof(XtPointer), offset(sb.pageDecrementCBL),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
184 XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
185 { (String) XmNtoTopCallback, (String) XmCToTopCallback, XtRCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
186 sizeof(XtPointer), offset(sb.toTopCBL), XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
187 { (String) XmNtoBottomCallback, (String) XmCToBottomCallback, XtRCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
188 sizeof(XtPointer), offset(sb.toBottomCBL), XtRCallback, NULL},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
189 { (String) XmNdragCallback, (String) XmCDragCallback, XtRCallback,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
190 sizeof(XtPointer), offset(sb.dragCBL), XtRCallback, NULL},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
192 { (String) XmNknobStyle, (String) XmCKnobStyle, XtRString, sizeof(char *),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 offset(sb.knobStyle), XtRImmediate, NULL},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
195 { (String) XmNarrowPosition, (String) XmCArrowPosition, XtRString,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
196 sizeof(char *), offset(sb.arrowPosition), XtRImmediate, NULL},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ** Prototypes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ** Actions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 static void Select(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 static void PageUpOrLeft(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 static void PageDownOrRight(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 static void Drag(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 static void Release(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 static void Jump(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 static void Abort(Widget w, XEvent *event, String *parms, Cardinal *num_parms);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ** Methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 static void Initialize(Widget treq, Widget tnew, ArgList args, Cardinal *num_args);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 static Boolean SetValues(Widget current, Widget request, Widget nw, ArgList args, Cardinal *num_args);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 static void Destroy(Widget widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 static void Redisplay(Widget widget, XEvent *event, Region region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 static void Resize(Widget widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 static void Realize(Widget widget, XtValueMask *valuemask, XSetWindowAttributes *attr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ** Private
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ** Actions Table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 static XtActionsRec actions[] = {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
237 {(String) "Select", Select},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
238 {(String) "PageDownOrRight",PageDownOrRight},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
239 {(String) "PageUpOrLeft", PageUpOrLeft},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
240 {(String) "Drag", Drag},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
241 {(String) "Release", Release},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
242 {(String) "Jump", Jump},
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
243 {(String) "Abort", Abort},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ** Default Translation Table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 static char default_translations[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "<Btn1Down>: Select()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "<Btn1Motion>: Drag()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "<Btn1Up>: Release()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 "<Btn2Down>: Jump()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 "<Btn2Motion>: Drag()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "<Btn2Up>: Release()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 "<Key>Delete: Abort()"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ** Class record initalization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 XlwScrollBarClassRec xlwScrollBarClassRec = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 /* core_class fields */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 /* superclass */ (WidgetClass) &coreClassRec,
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
270 /* class_name */ (String) "XlwScrollBar",
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 /* widget_size */ sizeof(XlwScrollBarRec),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 /* class_initialize */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 /* class_part_init */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 /* class_inited */ False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 /* initialize */ Initialize,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 /* initialize_hook */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 /* realize */ Realize,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 /* actions */ actions,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 /* num_actions */ XtNumber(actions),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 /* resources */ resources,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 /* num_resources */ XtNumber(resources),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 /* xrm_class */ NULLQUARK,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 /* compress_motion */ True,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 /* compress_exposure */ XtExposeCompressMultiple,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 /* compress_enterleave */ True,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 /* visible_interest */ False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 /* destroy */ Destroy,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 /* resize */ Resize,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 /* expose */ Redisplay,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 /* set_values */ SetValues,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 /* set_values_hook */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 /* set_values_almost */ XtInheritSetValuesAlmost,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 /* get_values_hook */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 /* accept_focus */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 /* version */ XtVersionDontCheck,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 /* callback_private */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 /* tm_table */ default_translations,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 /* query_geometry */ NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 /* scrollbar_class fields */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 /* dummy_field */ 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 WidgetClass xlwScrollBarWidgetClass = (WidgetClass) &xlwScrollBarClassRec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 **
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
310 ** Debug functions
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 #ifdef SHOW_CLEAR
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
315 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
316 myXClearArea(Display *dpy, Drawable d, int x, int y, int w, int h,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
317 Boolean exp, XlwScrollBarWidget widget)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
319 XFillRectangle (dpy, d, widget->sb.topShadowGC, x, y, w, h);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
320 XSync (dpy, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
321 sleep (2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
322 XClearArea (dpy, d, x, y, w, h, exp);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 #define XClearArea(dpy,win,x,y,width,height,exp) myXClearArea(dpy,win,x,y,width,height,exp,w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 #ifdef CHECK_VALUES
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
329 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
330 check(XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 int height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
334 height= widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
335 if (w->sb.showArrows) height -= (2 * arrow_h (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
337 if ((w->sb.above + w->sb.ss + w->sb.below > height) ||
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (w->sb.value < w->sb.minimum) ||
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
339 (w->sb.value > w->sb.maximum - w->sb.sliderSize)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 )
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
341 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 printf("above=%d ss=%d below=%d height=%d\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 w->sb.above, w->sb.ss, w->sb.below, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 printf("value=%d min=%d max=%d ss=%d max-ss=%d\n",
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
345 w->sb.value, w->sb.minimum, w->sb.maximum,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
346 w->sb.sliderSize, w->sb.maximum - w->sb.sliderSize);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 abort();
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
348 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 # define CHECK(w) check(w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 # define CHECK(w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 **
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
358 ** Static functions
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
362 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
363 call_callbacks (XlwScrollBarWidget w, int reason,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
364 int value, int pixel, XEvent *event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 XlwScrollBarCallbackStruct cbs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 Boolean called_anything;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
369 cbs.reason = reason;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
370 cbs.event = event;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
371 cbs.value = value;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
372 cbs.pixel = pixel;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 called_anything = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
376 switch (reason)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
377 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
378 case XmCR_VALUE_CHANGED:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
379 XtCallCallbackList ((Widget) w, w->sb.valueChangedCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
380 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
381 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
382 case XmCR_INCREMENT:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
383 if (w->sb.incrementCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
384 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
385 XtCallCallbackList ((Widget) w, w->sb.incrementCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
386 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
387 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
388 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
389 case XmCR_DECREMENT:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
390 if (w->sb.decrementCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
391 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
392 XtCallCallbackList ((Widget) w, w->sb.decrementCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
393 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
394 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
395 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
396 case XmCR_PAGE_INCREMENT:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
397 if (w->sb.incrementCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
398 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
399 XtCallCallbackList ((Widget) w, w->sb.pageIncrementCBL, &cbs);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 called_anything = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
401 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
402 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
403 case XmCR_PAGE_DECREMENT:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
404 if (w->sb.decrementCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
405 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
406 XtCallCallbackList ((Widget) w, w->sb.pageDecrementCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
407 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
408 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
409 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
410 case XmCR_TO_TOP:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
411 if (w->sb.toTopCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
412 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
413 XtCallCallbackList ((Widget) w, w->sb.toTopCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
414 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
415 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
416 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
417 case XmCR_TO_BOTTOM:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
418 if (w->sb.toBottomCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
419 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
420 XtCallCallbackList ((Widget) w, w->sb.toBottomCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
421 called_anything = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
422 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
423 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
424 case XmCR_DRAG:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
425 if (w->sb.dragCBL)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
426 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
427 XtCallCallbackList ((Widget) w, w->sb.dragCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
428 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
429 called_anything = True; /* Special Case */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
430 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
431 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
433 if (!called_anything)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
434 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 cbs.reason = XmCR_VALUE_CHANGED;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
436 XtCallCallbackList ((Widget) w, w->sb.valueChangedCBL, &cbs);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
437 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ** Widget sizes minus the shadow and highlight area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
443 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
444 widget_x (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
446 return w->sb.shadowThickness;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
449 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
450 widget_y (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
452 return w->sb.shadowThickness;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
455 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
456 widget_w (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 int width, x = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
460 width = VERT (w) ? w->core.width : w->core.height;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
462 if (width <= (2 * x))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
463 return 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
465 return width - (2 * x);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
468 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
469 widget_h (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 int height, y = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
473 height = VERT (w) ? w->core.height : w->core.width;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
475 if (height <= (2 * y))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
476 return 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
478 return height - (2 * y);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
481 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
482 arrow_h (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 int width, height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
486 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
487 height= widget_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
489 if (width > ((height / 2) - (SS_MIN / 2) - 1))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
490 return (height / 2) - (SS_MIN / 2) - 1 ;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
492 return width;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
495 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
496 event_x (XlwScrollBarWidget w, XEvent *event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
498 return VERT (w) ? event->xbutton.x : event->xbutton.y;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
501 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
502 event_y (XlwScrollBarWidget w, XEvent *event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
504 return VERT (w) ? event->xbutton.y : event->xbutton.x;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ** Safe addition and subtraction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
510 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
511 safe_add (int a, int b)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
513 if (a > 0 && INT_MAX - a < b) return INT_MAX;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
514 else return a + b;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
517 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
518 safe_subtract (int a, int b)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
520 if (a < 0 && -(INT_MIN - a) < b) return INT_MIN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
521 else return a - b;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
524 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
525 knob_style (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
527 return w->sb.knobStyle && w->sb.knobStyle[0] == 'd' ?
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
528 KNOB_DIMPLE :
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
529 KNOB_PLAIN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
530 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
531
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
532 static Boolean
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
533 arrow_same_end (XlwScrollBarWidget w)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
534 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
535 return w->sb.arrowPosition && w->sb.arrowPosition[0] == 's' ? True : False;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ** GC and Pixel allocation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
541 static GC
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
542 get_gc (XlwScrollBarWidget w, Pixel fg, Pixel bg, Pixmap pm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 XGCValues values;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 XtGCMask mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
547 if (pm == w->sb.grayPixmap)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
548 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 /* If we're using the gray pixmap, guarantee white on black ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 * otherwise, we could end up with something odd like grey on white
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 * when we're on a color display that ran out of color cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
554 fg = WhitePixelOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
555 bg = BlackPixelOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
556 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 values.foreground = fg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 values.background = bg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 values.fill_style = FillOpaqueStippled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 values.stipple = pm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 mask = GCForeground | GCBackground |
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
563 (pm == None ? 0 : GCStipple | GCFillStyle);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
564 return XtGetGC((Widget) w, mask, &values);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 /* Replacement for XAllocColor() that tries to return the nearest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 available color if the colormap is full. From FSF Emacs. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 allocate_nearest_color (Display *display, Colormap screen_colormap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 XColor *color_def)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
574 int status = XAllocColor (display, screen_colormap, color_def);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
575 if (status)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
576 return status;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 /* If we got to this point, the colormap is full, so we're
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
580 going to try to get the next closest color.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 The algorithm used is a least-squares matching, which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 what X uses for closest color matching with StaticColor visuals. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
584 int nearest, x;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
585 unsigned long nearest_delta, trial_delta;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
587 int no_cells = XDisplayCells (display, XDefaultScreen (display));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 /* Don't use alloca here because lwlib doesn't have the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 necessary configuration information that src does. */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
590 XColor *cells = (XColor *) malloc (sizeof (XColor) * no_cells);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 for (x = 0; x < no_cells; x++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 cells[x].pixel = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 XQueryColors (display, screen_colormap, cells, no_cells);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
596
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
597 for (x = 0; x < no_cells; x++)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
599 long dred = (color_def->red >> 8) - (cells[x].red >> 8);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
600 long dgreen = (color_def->green >> 8) - (cells[x].green >> 8);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
601 long dblue = (color_def->blue >> 8) - (cells[x].blue >> 8);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
602 trial_delta = dred * dred + dgreen * dgreen + dblue * dblue;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
603
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
604 if (x == 0 || trial_delta < nearest_delta)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 nearest = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 nearest_delta = trial_delta;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 }
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
610 color_def->red = cells[nearest].red;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 color_def->green = cells[nearest].green;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
612 color_def->blue = cells[nearest].blue;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 free (cells);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
614 return XAllocColor (display, screen_colormap, color_def);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
618 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
619 make_shadow_pixels (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 Display *dpy = XtDisplay((Widget) w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 Colormap cmap = w->core.colormap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 XColor topc, botc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 int top_frobbed, bottom_frobbed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 Pixel bg, fg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 top_frobbed = bottom_frobbed = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 bg = w->core.background_pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 fg = w->sb.foreground;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
632 if (w->sb.topShadowColor == (Pixel)~0) w->sb.topShadowColor = bg;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
633 if (w->sb.bottomShadowColor == (Pixel)~0) w->sb.bottomShadowColor = fg;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
635 if (w->sb.topShadowColor == bg || w->sb.topShadowColor == fg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
636 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 topc.pixel = bg;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
638 XQueryColor (dpy, cmap, &topc);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 /* don't overflow/wrap! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 topc.red = MINL(65535, topc.red * 1.2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 topc.green = MINL(65535, topc.green * 1.2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 topc.blue = MINL(65535, topc.blue * 1.2);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
643 if (allocate_nearest_color (dpy, cmap, &topc))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
644 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
645 if (topc.pixel == bg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
646 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
647 XFreeColors (dpy, cmap, &topc.pixel, 1, 0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 topc.red = MINL(65535, topc.red + 0x8000);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 topc.green = MINL(65535, topc.green + 0x8000);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 topc.blue = MINL(65535, topc.blue + 0x8000);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
651 if (allocate_nearest_color (dpy, cmap, &topc))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
652 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 w->sb.topShadowColor = topc.pixel;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
654 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
655 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
657 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 w->sb.topShadowColor = topc.pixel;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
659 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 top_frobbed = 1;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
662 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
663 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
665 if (w->sb.bottomShadowColor == fg || w->sb.bottomShadowColor == bg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
666 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 botc.pixel = bg;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
668 XQueryColor (dpy, cmap, &botc);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 botc.red *= 0.6;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 botc.green *= 0.6;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 botc.blue *= 0.6;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
672 if (allocate_nearest_color (dpy, cmap, &botc))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
673 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
674 if (botc.pixel == bg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
675 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
676 XFreeColors (dpy, cmap, &botc.pixel, 1, 0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 botc.red = MINL(65535, botc.red + 0x4000);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 botc.green = MINL(65535, botc.green + 0x4000);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 botc.blue = MINL(65535, botc.blue + 0x4000);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
680 if (allocate_nearest_color (dpy, cmap, &botc))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
681 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 w->sb.bottomShadowColor = botc.pixel;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
683 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
684 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
686 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 w->sb.bottomShadowColor = botc.pixel;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
688 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 bottom_frobbed = 1;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
690 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
691 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
693 if (top_frobbed && bottom_frobbed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
694 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 int top_avg = ((topc.red / 3) + (topc.green / 3) + (topc.blue / 3));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 int bot_avg = ((botc.red / 3) + (botc.green / 3) + (botc.blue / 3));
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
697 if (bot_avg > top_avg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
698 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 Pixel tmp = w->sb.topShadowColor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 w->sb.topShadowColor = w->sb.bottomShadowColor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 w->sb.bottomShadowColor = tmp;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
702 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
703 else if (topc.pixel == botc.pixel)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
704 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
705 if (botc.pixel == bg)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
706 w->sb.topShadowColor = bg;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
708 w->sb.bottomShadowColor = fg;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
709 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
710 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
712 if (w->sb.topShadowColor == w->core.background_pixel ||
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
713 w->sb.bottomShadowColor == w->core.background_pixel)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
714 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 /* Assume we're in mono. This code should be okay even if we're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 * really in color but just short on color cells -- We want the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 * following behavior, which has been empirically determined to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 * work well for all fg/bg combinations in mono: If the trough
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 * and thumb are BOTH black, then use a white top shadow and a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 * grey bottom shadow, otherwise use a grey top shadow and a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 * black bottom shadow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
724 Pixel white = WhitePixelOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
725 Pixel black = BlackPixelOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 /* Note: core.background_pixel is the color of the thumb ... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 if (w->core.background_pixel == black &&
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
730 w->sb.troughColor == black)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
731 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
732 w->sb.topShadowColor = white;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
733 w->sb.bottomShadowPixmap = w->sb.grayPixmap;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
734 } else {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
735 w->sb.topShadowPixmap = w->sb.grayPixmap;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
736 w->sb.bottomShadowColor = black;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
737 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
738 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
741 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
742 make_trough_pixel (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 Display *dpy = XtDisplay((Widget) w);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
745 Colormap cmap = DefaultColormapOfScreen (XtScreen ((Widget) w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 XColor troughC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
748 if (w->sb.troughColor == (Pixel)~0) w->sb.troughColor = w->core.background_pixel;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
750 if (w->sb.troughColor == w->core.background_pixel)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
751 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 troughC.pixel = w->core.background_pixel;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
753 XQueryColor (dpy, cmap, &troughC);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 troughC.red *= 0.8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 troughC.green *= 0.8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 troughC.blue *= 0.8;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
757 if (allocate_nearest_color (dpy, cmap, &troughC))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
758 w->sb.troughColor = troughC.pixel;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
759 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 ** Draw 3d border
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
765 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
766 draw_shadows (Display *dpy, Drawable d, GC shine_gc, GC shadow_gc,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
767 int x, int y, int width, int height, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
769 XSegment shine[10], shadow[10];
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
770 int i;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
772 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
773 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
774 if (shadowT <= 0) return;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
776 for (i = 0; i < shadowT; i++)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
777 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
778 /* Top segments */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
779 shine[i].x1 = x;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
780 shine[i].y2 = shine[i].y1 = y + i;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
781 shine[i].x2 = x + width - i - 1;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
782 /* Left segments */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
783 shine[i + shadowT].x2 = shine[i + shadowT].x1 = x + i;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
784 shine[i + shadowT].y1 = y + shadowT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
785 shine[i + shadowT].y2 = y + height - i - 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
787 /* Bottom segments */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
788 shadow[i].x1 = x + i;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
789 shadow[i].y2 = shadow[i].y1 = y + height - i - 1;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
790 shadow[i].x2 = x + width - 1 ;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
791 /* Right segments */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
792 shadow[i + shadowT].x2 = shadow[i + shadowT].x1 = x + width - i - 1;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
793 shadow[i + shadowT].y1 = y + i + 1;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
794 shadow[i + shadowT].y2 = y + height - 1 ;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
795 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
797 XDrawSegments (dpy, d, shine_gc, shine, shadowT * 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
798 XDrawSegments (dpy, d, shadow_gc, shadow, shadowT * 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 ** Draw 3d arrows, left, up, down, and right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
804 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
805 make_vert_seg (XSegment *seg, int x1, int y1, int x2, int y2, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
809 for (i=0; i<shadowT; i++)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
810 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 seg[i].x1 = x1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 seg[i].y1 = y1 + i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 seg[i].x2 = x2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 seg[i].y2 = y2 + i;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
815 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
816 return shadowT;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
819 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
820 make_hor_seg (XSegment *seg, int x1, int y1, int x2, int y2, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
824 for (i=0; i<shadowT; i++)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
825 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 seg[i].x1 = x1 + i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 seg[i].y1 = y1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 seg[i].x2 = x2 + i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 seg[i].y2 = y2;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
830 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
831 return shadowT;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
834 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
835 draw_arrow_up (Display *dpy, Drawable win, GC bgGC, GC shineGC, GC shadowGC,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
836 int x, int y, int width, int height, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 XSegment shine[10], shadow[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 XPoint triangle[3];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 int mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 mid = width / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
844 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
845 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
846 if (shadowT <= 0) shadowT = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 /* / */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
849 make_vert_seg (shine,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 x, y + height - shadowT - 1,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
851 x + mid, y, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 /* _\ */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
853 make_vert_seg (shadow,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 x, y + height - shadowT - 1,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
855 x + width - 1, y + height - shadowT - 1, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
856 make_vert_seg (shadow + shadowT,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 x + mid, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
858 x + width - 1, y + height - shadowT - 1, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 triangle[0].x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 triangle[0].y = y + height - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 triangle[1].x = x + mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 triangle[1].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 triangle[2].x = x + width - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 triangle[2].y = y + height - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
867 XFillPolygon (dpy, win, bgGC, triangle, 3, Convex, ArcChord);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
869 XDrawSegments (dpy, win, shadowGC, shadow, shadowT * 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
870 XDrawSegments (dpy, win, shineGC, shine, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
873 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
874 draw_arrow_left (Display *dpy, Drawable win, GC bgGC, GC shineGC, GC shadowGC,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
875 int x, int y, int width, int height, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 XSegment shine[10], shadow[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 XPoint triangle[3];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 int mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 mid = width / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
883 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
884 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
885 if (shadowT <= 0) shadowT = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 /* / */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
888 make_hor_seg (shine,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
889 x, y + mid,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
890 x + width - shadowT - 1, y, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 /* \| */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
892 make_hor_seg (shadow,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
893 x, y + mid,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
894 x + width - shadowT - 1, y + height - 1, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
895 make_hor_seg (shadow + shadowT,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
896 x + width - shadowT - 1, y,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
897 x + width - shadowT - 1, y + height - 1, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 triangle[0].x = x + width - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 triangle[0].y = y + height - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 triangle[1].x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 triangle[1].y = y + mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 triangle[2].x = x + width - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 triangle[2].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
906 XFillPolygon (dpy, win, bgGC, triangle, 3, Convex, ArcChord);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
908 XDrawSegments (dpy, win, shadowGC, shadow, shadowT * 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
909 XDrawSegments (dpy, win, shineGC, shine, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
912 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
913 draw_arrow_down (Display *dpy, Drawable win, GC bgGC, GC shineGC, GC shadowGC,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
914 int x, int y, int width, int height, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 XSegment shine[10], shadow[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 XPoint triangle[3];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 int mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 mid = width / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
922 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
923 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
924 if (shadowT <= 0) shadowT = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 /* \- */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
927 make_vert_seg (shine,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 x, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
929 x + mid, y + height - shadowT - 1, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
930 make_vert_seg (shine + shadowT,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 x, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
932 x + width - 1, y, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 /* / */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
934 make_vert_seg (shadow,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 x + width - 1, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
936 x + mid, y + height - shadowT - 1, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 triangle[0].x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 triangle[0].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 triangle[1].x = x + mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 triangle[1].y = y + height - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 triangle[2].x = x + width - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 triangle[2].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
945 XFillPolygon (dpy, win, bgGC, triangle, 3, Convex, ArcChord);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
947 XDrawSegments (dpy, win, shadowGC, shadow, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
948 XDrawSegments (dpy, win, shineGC, shine, shadowT * 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
951 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
952 draw_arrow_right (Display *dpy, Drawable win, GC bgGC, GC shineGC, GC shadowGC,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
953 int x, int y, int width, int height, int shadowT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 XSegment shine[10], shadow[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 XPoint triangle[3];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 int mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 mid = width / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
961 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
962 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
963 if (shadowT <= 0) shadowT = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 /* |\ */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
966 make_hor_seg (shine,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 x, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
968 x + width - shadowT - 1, y + mid, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
969 make_hor_seg (shine + shadowT,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 x, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
971 x, y + height -1, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 /* / */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
973 make_hor_seg (shadow,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 x, y + height -1,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
975 x + width - shadowT - 1, y + mid, shadowT);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 triangle[0].x = x + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 triangle[0].y = y + height - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 triangle[1].x = x + width - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 triangle[1].y = y + mid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 triangle[2].x = x + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 triangle[2].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
984 XFillPolygon (dpy, win, bgGC, triangle, 3, Convex, ArcChord);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
986 XDrawSegments (dpy, win, shadowGC, shadow, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
987 XDrawSegments (dpy, win, shineGC, shine, shadowT * 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
990 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
991 draw_dimple (Display *dpy, Drawable win, GC shine, GC shadow,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
992 int x, int y, int width, int height)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
994 XDrawArc (dpy, win, shine, x, y, width, height, 46*64, 180*64);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
995 XDrawArc (dpy, win, shadow, x, y, width, height, 45*64, -179*64);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 ** Scrollbar values -> pixels, pixels -> scrollbar values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1002 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1003 seg_pixel_sizes (XlwScrollBarWidget w, int *above_return,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1004 int *ss_return, int *below_return)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 float total, height, fuz;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 int value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 int above, ss, below;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1010 height= widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1011 if (w->sb.showArrows) height -= (2 * arrow_h (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 value = w->sb.value - w->sb.minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 total = w->sb.maximum - w->sb.minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 fuz = total / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 ss = ((height * w->sb.sliderSize + fuz) / total);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 above = ((height * value + fuz) / total);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 below = ((height) - (ss + above));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 /* Dont' let knob get smaller than SS_MIN */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1023 if (ss < SS_MIN)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1024 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1025 /* add a percent amount for integer rounding */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1026 float tmp = ((((float) (SS_MIN - ss) * (float) value)) / total) + 0.5;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1028 above -= (int) tmp;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 ss = SS_MIN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 below = ((height) - (ss + above));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1032 if (above < 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1033 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 above = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 below = height - ss;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1036 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1037 if (below < 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1038 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 above = height - ss;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 below = 0;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1041 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1042 if (ss > height)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1043 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 above = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 ss = height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 below = 0;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1047 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1048 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 *above_return = above;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 *ss_return = ss;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 *below_return = below;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1054 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1057 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1058 verify_values (XlwScrollBarWidget w)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 int total = w->sb.maximum - w->sb.minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1062 if (w->sb.sliderSize > total)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 w->sb.sliderSize = total;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1064
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1065 if (w->sb.pageIncrement > total)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 w->sb.pageIncrement = total;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1067
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1068 if (w->sb.increment > total)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 w->sb.increment = total;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1070
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1071 if (w->sb.value < w->sb.minimum)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 w->sb.value = w->sb.minimum;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1073
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1074 if (w->sb.value > w->sb.maximum - w->sb.sliderSize)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 w->sb.value = w->sb.maximum - w->sb.sliderSize;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1076
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1079 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1080 value_from_pixel (XlwScrollBarWidget w, int above)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 float total, height, fuz;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 int value, ss;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1085 height= widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1086 if (w->sb.showArrows) height -= (2 * arrow_h (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 total = w->sb.maximum - w->sb.minimum;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1089 fuz = height / 2;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1091 ss = ((height * w->sb.sliderSize + (total / 2)) / total);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1093 if (ss < SS_MIN)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1094 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1095 /* add a percent amount for integer rounding */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 above += ((((SS_MIN - ss) * above) + fuz) / height);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1097 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1100 /* Prevent SIGFPE's that would occur if we don't truncate the value. */
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1101 float floatval = w->sb.minimum + ((float)(above * total + fuz) / height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 if (floatval >= (float) INT_MAX)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 value = INT_MAX;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 else if (floatval <= (float) INT_MIN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 value = INT_MIN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 value = floatval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1110 return value;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1114 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1115 redraw_dimple (XlwScrollBarWidget w, Display *dpy, Window win,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1116 int x, int y, int width, int height)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 GC shine, shadow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 int shadowT, size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1121 if (KNOB_DIMPLE == knob_style (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1122 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1123 if (w->sb.armed == ARM_KNOB)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1124 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1125 shine = w->sb.bottomShadowGC;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 shadow = w->sb.topShadowGC;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1127 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1129 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1130 shine = w->sb.topShadowGC;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 shadow = w->sb.bottomShadowGC;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1132 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 shadowT = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 x += shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 y += shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 width -= 2*shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 height -= 2*shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 size = (width < height ? width : height) * 3 / 4;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1143 if (size%2 != (width < height ? width : height)%2) size--;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1145 DBUG (fprintf (stderr, "%d %d\n",
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1146 x + (width / 2) - (size / 2) - 2*shadowT,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1147 width - size - shadowT));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1149 draw_dimple (dpy, win, shine, shadow,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1150 x + (width / 2) - (size / 2),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 y + (height / 2) - (size / 2),
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1152 size, size);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1153 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1156 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1157 draw_knob (XlwScrollBarWidget w, int above, int ss, int below)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1159 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1160 Window win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 int x, y, width, height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 int shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1164 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1165 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1166 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1167 height = widget_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 shadowT = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1171 if (shadowT > (width / 2)) shadowT = (width / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1172 if (shadowT > (height / 2)) shadowT = (height / 2);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1173 if (shadowT <= 0) return;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1175 if (w->sb.showArrows && !arrow_same_end (w)) y += arrow_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 /* trough above knob */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1178 if (above > 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1179 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1180 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1181 XClearArea (dpy, win, x, y, width, above, False);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1183 XClearArea (dpy, win, y, x, above, width, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1184 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 /* knob */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1187 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1188 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1189 draw_shadows (dpy, win, w->sb.topShadowGC, w->sb.bottomShadowGC,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 x, y + above, width, ss, shadowT);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1191 XFillRectangle (dpy, win,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 w->sb.backgroundGC,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1193 x+shadowT, y + above + shadowT, width-2*shadowT, ss-2*shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1194 redraw_dimple (w, dpy, win, x, y + above, width, ss);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1195 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1197 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1198 draw_shadows (dpy, win, w->sb.topShadowGC, w->sb.bottomShadowGC,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 y + above, x, ss, width, shadowT);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1200 XFillRectangle (dpy, win,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 w->sb.backgroundGC,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1202 y + above + shadowT, x+shadowT, ss-2*shadowT, width-2*shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1203 redraw_dimple (w, dpy, win, y + above, x, ss, width);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1204 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 /* trough below knob */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1207 if (below > 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1208 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1209 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1210 XClearArea (dpy, win, x, y + above + ss, width, below, False);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1212 XClearArea (dpy, win, y + above + ss, x, below, width, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1213 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1215 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1218 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1219 redraw_up_arrow (XlwScrollBarWidget w, Boolean armed, Boolean clear_behind)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1221 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1222 Window win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 GC bg, shine, shadow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 int x, y, width, height, arrow_height, shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1226 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1227 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1228 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1229 height = widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1230 arrow_height = arrow_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 shadowT = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 bg = w->sb.backgroundGC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1235 if (armed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1236 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 shine = w->sb.bottomShadowGC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 shadow = w->sb.topShadowGC;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1239 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1241 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 shine = w->sb.topShadowGC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 shadow = w->sb.bottomShadowGC;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1244 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1246 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1247 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1248 if (arrow_same_end (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1249 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1250 y += height - 2 * arrow_h (w) + 2;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1251 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1252 if (clear_behind)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1253 XClearArea (dpy, win, x, y, width, arrow_height + 1, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1254 draw_arrow_up (dpy, win, bg, shine, shadow,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 x + (width - arrow_height)/2, y,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1256 arrow_height, arrow_height, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1257 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1259 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1260 if (arrow_same_end (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1261 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1262 y += height - 2 * arrow_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1263 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1264 if (clear_behind)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1265 XClearArea (dpy, win, y, x, arrow_height + 1, height, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1266 draw_arrow_left (dpy, win, bg, shine, shadow,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 y, x + (width - arrow_height)/2,
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1268 arrow_height, arrow_height, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1269 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1272 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1273 redraw_down_arrow (XlwScrollBarWidget w, Boolean armed, Boolean clear_behind)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1275 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1276 Window win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 GC bg, shine, shadow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 int x, y, width, height, arrow_height, shadowT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1280 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1281 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1282 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1283 height = widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1284 arrow_height = arrow_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 shadowT = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 bg = w->sb.backgroundGC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1289 if (armed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1290 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1291 shine = w->sb.bottomShadowGC;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1292 shadow = w->sb.topShadowGC;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1293 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1295 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1296 shine = w->sb.topShadowGC;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1297 shadow = w->sb.bottomShadowGC;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1298 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1300 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1301 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1302 if (clear_behind)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1303 XClearArea (dpy, win, x, y + height - arrow_height, width,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1304 arrow_height + 1, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1305 draw_arrow_down (dpy, win, bg, shine, shadow,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1306 x + (width - arrow_height)/2,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1307 y + height - arrow_height + 1,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1308 arrow_height, arrow_height, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1309 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1311 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1312 if (clear_behind)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1313 XClearArea (dpy, win, y + height - arrow_height, x,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1314 arrow_height + 1, height, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1315 draw_arrow_right (dpy, win, bg, shine, shadow,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1316 y + height - arrow_height + 1,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1317 x + (width - arrow_height)/2,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1318 arrow_height, arrow_height, shadowT);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1319 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1322 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1323 redraw_everything (XlwScrollBarWidget w, Region region, Boolean behind_arrows)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1325 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1326 Window win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 int x, y, width, height, shadowT, tmp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1329 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1330 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1331 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1332 height = widget_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 shadowT = w->sb.shadowThickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1335 if (w->sb.showArrows)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1336 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1337 if (region == NULL || XRectInRegion (region, x, y, width, width))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1338 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1339 redraw_up_arrow (w, False, behind_arrows);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1340 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1341 if (VERT (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1342 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 y = y + height - width + 1;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1344 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1346 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 tmp = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 y = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 x = tmp + height - width + 1;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1350 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1351 if (region == NULL || XRectInRegion (region, x, y, width, width))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1352 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1353 redraw_down_arrow (w, False, behind_arrows);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1354 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1355 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1357 draw_shadows (dpy, win, w->sb.bottomShadowGC, w->sb.topShadowGC,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 0, 0, w->core.width, w->core.height, shadowT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1360 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 **
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1366 ** Method functions
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1370 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1371 Initialize (Widget treq, Widget tnew, ArgList args, Cardinal *num_args)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 XlwScrollBarWidget request = (XlwScrollBarWidget) treq;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 XlwScrollBarWidget w = (XlwScrollBarWidget) tnew;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1375 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1376 Window win = RootWindowOfScreen (DefaultScreenOfDisplay (dpy));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1378 DBUG (fprintf (stderr, "Initialize\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1380 if (request->core.width == 0) w->core.width += (VERT (w) ? 12 : 25);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1381 if (request->core.height == 0) w->core.height += (VERT (w) ? 25 : 12);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1383 verify_values (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 w->sb.lastY = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 w->sb.above = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 w->sb.ss = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 w->sb.below = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 w->sb.armed = ARM_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1391 if (w->sb.shadowThickness > 5) w->sb.shadowThickness = 5;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 w->sb.grayPixmap =
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1394 XCreatePixmapFromBitmapData (dpy, win, (char *) gray_bits, gray_width,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1395 gray_height, 1, 0, 1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1397 make_trough_pixel (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1398
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1399 make_shadow_pixels (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1401 w->sb.backgroundGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1402 get_gc (w, w->core.background_pixel, w->core.background_pixel, None);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1403 w->sb.topShadowGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1404 get_gc (w, w->sb.topShadowColor, w->core.background_pixel,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1405 w->sb.topShadowPixmap);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1406 w->sb.bottomShadowGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1407 get_gc (w, w->sb.bottomShadowColor, w->core.background_pixel,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1408 w->sb.bottomShadowPixmap);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 w->sb.fullRedrawNext = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1411
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1412 w->sb.timerActive = False;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1415 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1416 Destroy (Widget widget)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1419 Display *dpy = XtDisplay ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1421 DBUG (fprintf (stderr, "Destroy\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1423 XtReleaseGC (widget, w->sb.bottomShadowGC);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1424 XtReleaseGC (widget, w->sb.topShadowGC);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1425 XtReleaseGC (widget, w->sb.backgroundGC);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1427 XFreePixmap (dpy, w->sb.grayPixmap);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1428
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1429 if (w->sb.timerActive)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1430 XtRemoveTimeOut (w->sb.timerId);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1433 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1434 Realize (Widget widget, XtValueMask *valuemask, XSetWindowAttributes *attr)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1437 Display *dpy = XtDisplay ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 Window win;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 XSetWindowAttributes win_attr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1441 DBUG (fprintf (stderr, "Realize\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (*coreClassRec.core_class.realize)(widget, valuemask, attr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1445 win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1447 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1449 XSetWindowBackground (dpy, win, w->sb.troughColor);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 /* Change bit gravity so widget is not cleared on resize */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 win_attr.bit_gravity = NorthWestGravity;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1453 XChangeWindowAttributes (dpy, win, CWBitGravity , &win_attr);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1457 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1458 Resize (Widget widget)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1461 Display *dpy = XtDisplay ((Widget) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1462 Window win = XtWindow ((Widget) w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1464 if (XtIsRealized (widget))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1465 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1466 DBUG (fprintf (stderr, "Resize = %08lx\n", w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1468 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 /*redraw_everything(w, NULL, True);*/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 w->sb.fullRedrawNext = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 /* Force expose event */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1474 XClearArea (dpy, win, widget_x(w), widget_y(w), 1, 1, True);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1475 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1478 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1479 Redisplay (Widget widget, XEvent *event, Region region)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1483 DBUG (fprintf (stderr, "Redisplay = %08lx\n", w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1485 if (XtIsRealized (widget))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1486 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1487 if (w->sb.fullRedrawNext)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1488 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1489 redraw_everything (w, NULL, True);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1490 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1492 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1493 redraw_everything (w, region, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1494 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 w->sb.fullRedrawNext = False;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1496 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1499 static Boolean
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1500 SetValues (Widget current, Widget request, Widget neww,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1501 ArgList args, Cardinal *num_args)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 XlwScrollBarWidget cur = (XlwScrollBarWidget) current;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 XlwScrollBarWidget w = (XlwScrollBarWidget) neww;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 Boolean do_redisplay = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1507 if (cur->sb.troughColor != w->sb.troughColor)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1508 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1509 if (XtIsRealized ((Widget) w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1510 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1511 XSetWindowBackground (XtDisplay((Widget) w), XtWindow ((Widget) w),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 w->sb.troughColor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 do_redisplay = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1514 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1515 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1517 if (cur->core.background_pixel != w->core.background_pixel)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1518 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1519 XtReleaseGC ((Widget)cur, cur->sb.backgroundGC);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1520 w->sb.backgroundGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1521 get_gc (w, w->core.background_pixel, w->core.background_pixel, None);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 do_redisplay = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1523 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1525 if (cur->sb.topShadowColor != w->sb.topShadowColor ||
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1526 cur->sb.topShadowPixmap != w->sb.topShadowPixmap)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1527 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1528 XtReleaseGC ((Widget)cur, cur->sb.topShadowGC);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1529 w->sb.topShadowGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1530 get_gc (w, w->sb.topShadowColor, w->core.background_pixel,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1531 w->sb.topShadowPixmap);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 do_redisplay = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1533 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1535 if (cur->sb.bottomShadowColor != w->sb.bottomShadowColor ||
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1536 cur->sb.bottomShadowPixmap != w->sb.bottomShadowPixmap)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1537 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1538 XtReleaseGC ((Widget)cur, cur->sb.bottomShadowGC);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1539 w->sb.bottomShadowGC =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1540 get_gc (w, w->sb.bottomShadowColor, w->core.background_pixel,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1541 w->sb.bottomShadowPixmap);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 do_redisplay = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1543 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1545 if (cur->sb.orientation != w->sb.orientation)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1546 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 do_redisplay = True;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1548 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1551 if (cur->sb.minimum != w->sb.minimum ||
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 cur->sb.maximum != w->sb.maximum ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 cur->sb.sliderSize != w->sb.sliderSize ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 cur->sb.value != w->sb.value ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 cur->sb.pageIncrement != w->sb.pageIncrement ||
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1556 cur->sb.increment != w->sb.increment)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1557 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1558 verify_values (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1559 if (XtIsRealized ((Widget) w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1560 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1561 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1562 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1563 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1564 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1566 if (w->sb.shadowThickness > 5) w->sb.shadowThickness = 5;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1568 return do_redisplay;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1571 void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1572 XlwScrollBarGetValues (Widget widget, int *value, int *sliderSize,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1573 int *increment, int *pageIncrement)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1575 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1577 if (w && XtClass ((Widget) w) == xlwScrollBarWidgetClass)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1578 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1579 if (value) *value = w->sb.value;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1580 if (sliderSize) *sliderSize = w->sb.sliderSize;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1581 if (increment) *increment = w->sb.increment;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1582 if (pageIncrement) *pageIncrement = w->sb.pageIncrement;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1583 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1586 void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1587 XlwScrollBarSetValues (Widget widget, int value, int sliderSize,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1588 int increment, int pageIncrement, Boolean notify)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1590 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 int last_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1593 if (w && XtClass ((Widget) w) == xlwScrollBarWidgetClass &&
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 (w->sb.value != value ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 w->sb.sliderSize != sliderSize ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 w->sb.increment != increment ||
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1597 w->sb.pageIncrement != pageIncrement))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1598 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 w->sb.value = value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 w->sb.sliderSize = sliderSize;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 w->sb.increment = increment;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 w->sb.pageIncrement = pageIncrement;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1604 verify_values (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1606 if (XtIsRealized (widget))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1607 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1608 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1609 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 last_value = w->sb.value;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1612 w->sb.value = value_from_pixel (w, w->sb.above);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1613 verify_values (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1615 if (w->sb.value != last_value && notify)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1616 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1617 call_callbacks (w, XmCR_VALUE_CHANGED, w->sb.value, 0, NULL);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1618 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1619 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1620 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 /************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 **
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1625 ** Action functions
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1629 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1630 timer (XtPointer data, XtIntervalId *id)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1632 XlwScrollBarWidget w = (XlwScrollBarWidget) data;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 int reason, last_value;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1634
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1635 w->sb.timerActive = False;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1637 if (w->sb.armed != ARM_NONE)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1638 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 last_value = w->sb.value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 reason = XmCR_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1642 switch (w->sb.armed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1643 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1644 case ARM_PAGEUP:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1645 w->sb.value = safe_subtract (w->sb.value, w->sb.pageIncrement);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1646 reason = XmCR_PAGE_DECREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1647 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1648 case ARM_PAGEDOWN:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1649 w->sb.value = safe_add (w->sb.value, w->sb.pageIncrement);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1650 reason = XmCR_PAGE_INCREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1651 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1652 case ARM_UP:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1653 w->sb.value = safe_subtract (w->sb.value, w->sb.increment);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1654 reason = XmCR_DECREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1655 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1656 case ARM_DOWN:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1657 w->sb.value = safe_add (w->sb.value, w->sb.increment);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1658 reason = XmCR_INCREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1659 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1660 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1662 verify_values (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1663
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1664 if (last_value != w->sb.value)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1665 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1666 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1667 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1669 call_callbacks (w, reason, w->sb.value, 0, NULL);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1671 w->sb.timerId =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1672 XtAppAddTimeOut (XtWidgetToApplicationContext ((Widget) w),
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1673 (unsigned long) w->sb.repeatDelay,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1674 timer, (XtPointer) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1675 w->sb.timerActive = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1676 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1677 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1680 static int
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1681 what_button (XlwScrollBarWidget w, int mouse_x, int mouse_y)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 int x, y, width, height, arrow_height_top, arrow_height_bottom;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 int where;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1686 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1687 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1688 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1689 height = widget_h (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 #if 0
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1692 arrow_height = w->sb.showArrows ? arrow_h (w) : 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 #endif
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1694 if (w->sb.showArrows)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1695 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1696 if (arrow_same_end (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1697 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 arrow_height_top = 0;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1699 arrow_height_bottom = 2 * arrow_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1700 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1702 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1703 arrow_height_top = arrow_height_bottom = arrow_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1704 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1705 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1707 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 arrow_height_top = arrow_height_bottom = 0;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1709 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 where = BUTTON_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1713 if (mouse_x > x && mouse_x < (x + width))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1714 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1715 if (mouse_y > (y + arrow_height_top) &&
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1716 mouse_y < (y + height - arrow_height_bottom))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1717 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1718 if (mouse_y < (y + w->sb.above + arrow_height_top))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1719 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 where = BUTTON_TROUGH_ABOVE;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1721 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1722 else if (mouse_y > (y + w->sb.above + w->sb.ss + arrow_height_top))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1723 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 where = BUTTON_TROUGH_BELOW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1725 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1727 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 where = BUTTON_KNOB;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1729 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1730 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1731 else if (arrow_same_end (w))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1732 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1733 if (mouse_y > (y + height - arrow_height_bottom + 1) &&
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1734 mouse_y < (y + height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1735 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1736 if (mouse_y < (y + height - arrow_height_bottom/2))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1737 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 where = BUTTON_UP_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1739 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1741 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 where = BUTTON_DOWN_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1743 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1744 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1745 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1747 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1748 if (mouse_y > y && mouse_y < (y + arrow_height_top))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1749 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 where = BUTTON_UP_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1751 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1752 else if (mouse_y > (y + height - arrow_height_bottom + 1) &&
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1753 mouse_y < (y + height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1754 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 where = BUTTON_DOWN_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1756 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1757 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1758 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 #if 0
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1760 if (mouse_x > x && mouse_x < (x + width))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1761 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1762 if (mouse_y > (y + arrow_height) && mouse_y < (y + height - arrow_height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1763 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1764 if (mouse_y < (y+w->sb.above+arrow_height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1765 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 where = BUTTON_TROUGH_ABOVE;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1767 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1768 else if (mouse_y > (y + w->sb.above + w->sb.ss + arrow_height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1769 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 where = BUTTON_TROUGH_BELOW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1771 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 else
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1773 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 where = BUTTON_KNOB;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1775 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1776 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1777 else if (mouse_y > y && mouse_y < (y + arrow_height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1778 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 where = BUTTON_UP_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1780 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1781 else if (mouse_y > (y + height - arrow_height + 1) &&
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1782 mouse_y < (y + height))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1783 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 where = BUTTON_DOWN_ARROW;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1785 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1786 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 #endif
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1788 return where;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1791 #define FORCED_SCROLL_NONE 0
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 #define FORCED_SCROLL_DOWNRIGHT 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 #define FORCED_SCROLL_UPLEFT 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 int forced_scroll_flag = FORCED_SCROLL_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1797 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1798 PageDownOrRight (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 forced_scroll_flag = FORCED_SCROLL_DOWNRIGHT;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1801 Select (widget, event, parms, num_parms);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 forced_scroll_flag = FORCED_SCROLL_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1805 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1806 PageUpOrLeft (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 forced_scroll_flag = FORCED_SCROLL_UPLEFT;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1809 Select (widget, event, parms, num_parms);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 forced_scroll_flag = FORCED_SCROLL_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1813 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1814 Select (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1816 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 int mouse_x, mouse_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 int reason, last_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 int sb_button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1821 DBUG (fprintf (stderr, "Select:\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1823 mouse_x = event_x (w, event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1824 mouse_y = event_y (w, event);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 w->sb.savedValue = w->sb.value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 last_value = w->sb.value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 reason = XmCR_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1831 XtGrabKeyboard ((Widget) w, False, GrabModeAsync, GrabModeAsync,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1832 event->xbutton.time);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1834 sb_button = what_button (w, mouse_x, mouse_y);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1835
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1836 if (forced_scroll_flag != FORCED_SCROLL_NONE)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1838 switch (sb_button)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 case BUTTON_TROUGH_ABOVE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 case BUTTON_TROUGH_BELOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 case BUTTON_KNOB:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 sb_button= BUTTON_NONE; /* cause next switch to fall through */
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1844 if (forced_scroll_flag == FORCED_SCROLL_UPLEFT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1846 w->sb.value = safe_subtract (w->sb.value, w->sb.pageIncrement);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 w->sb.armed = ARM_PAGEUP;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 reason = XmCR_PAGE_DECREMENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 }
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1851 else if (forced_scroll_flag == FORCED_SCROLL_DOWNRIGHT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1853 w->sb.value = safe_add (w->sb.value, w->sb.pageIncrement);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 w->sb.armed = ARM_PAGEDOWN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 reason = XmCR_PAGE_INCREMENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 abort();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1862 switch (sb_button)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1863 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1864 case BUTTON_TROUGH_ABOVE:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1865 w->sb.value = safe_subtract (w->sb.value, w->sb.pageIncrement);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1866 w->sb.armed = ARM_PAGEUP;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1867 reason = XmCR_PAGE_DECREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1868 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1869 case BUTTON_TROUGH_BELOW:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1870 w->sb.value = safe_add (w->sb.value, w->sb.pageIncrement);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1871 w->sb.armed = ARM_PAGEDOWN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1872 reason = XmCR_PAGE_INCREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1873 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1874 case BUTTON_KNOB:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1875 w->sb.lastY = mouse_y;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1876 w->sb.armed = ARM_KNOB;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1877 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1878 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1879 case BUTTON_UP_ARROW:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1880 if (event->xbutton.state & ControlMask)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1881 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1882 w->sb.value = INT_MIN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1883 w->sb.armed = ARM_UP;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1884 reason = XmCR_TO_TOP;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1885 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1886 else
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1887 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1888 w->sb.value = safe_subtract (w->sb.value, w->sb.increment);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1889 w->sb.armed = ARM_UP;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1890 reason = XmCR_DECREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1891 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1892 redraw_up_arrow (w, True, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1893 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1894 case BUTTON_DOWN_ARROW:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1895 if (event->xbutton.state & ControlMask)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1896 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1897 w->sb.value = INT_MAX;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1898 w->sb.armed = ARM_DOWN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1899 reason = XmCR_TO_BOTTOM;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1900 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1901 else
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1902 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1903 w->sb.value = safe_add (w->sb.value, w->sb.increment);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1904 w->sb.armed = ARM_DOWN;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1905 reason = XmCR_INCREMENT;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1906 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1907 redraw_down_arrow (w, True, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1908 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1909 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1911 verify_values (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1913 if (last_value != w->sb.value)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1914 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1915 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1916 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1918 call_callbacks (w, reason, w->sb.value, mouse_y, event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1919
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1920 if (w->sb.timerActive)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1921 XtRemoveTimeOut (w->sb.timerId);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1923 w->sb.timerId =
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1924 XtAppAddTimeOut (XtWidgetToApplicationContext ((Widget) w),
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1925 (unsigned long) w->sb.initialDelay,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1926 timer, (XtPointer) w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1927 w->sb.timerActive = True;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1928 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1930 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1933 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1934 Drag (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1936 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 int diff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 int height, mouse_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 int last_value, last_above;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1941 DBUG (fprintf (stderr, "Drag:\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1943 if (w->sb.armed == ARM_KNOB)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1944 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1945 height = widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1946 if (w->sb.showArrows) height -= (2 * arrow_h (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1948 mouse_y = event_y (w, event);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 diff = mouse_y - w->sb.lastY;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 last_above = w->sb.above;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 last_value = w->sb.value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1955 if (diff < 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1956 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 /* up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 w->sb.above -= (-diff);
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1959 if (w->sb.above < 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1960 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 mouse_y = (mouse_y - w->sb.above);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 w->sb.above = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 diff = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 w->sb.below = height - w->sb.ss;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1965 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 w->sb.below -= diff;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1967 CHECK (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1968 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1969 else if (diff > 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1970 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 /* down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 w->sb.above += diff;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1973 if (w->sb.above + w->sb.ss > height)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1974 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 mouse_y = height + (mouse_y - (w->sb.above + w->sb.ss));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 w->sb.above = height - w->sb.ss;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 diff = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 w->sb.below = 0;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1979 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 w->sb.below -= diff;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1981 CHECK (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1982 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1984 if (last_above != w->sb.above)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1985 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1986 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 w->sb.lastY = mouse_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1990 w->sb.value = value_from_pixel (w, w->sb.above);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1991 verify_values (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1992 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1994 if (w->sb.value != last_value)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1995 call_callbacks (w, XmCR_DRAG, w->sb.value, event_y (w, event), event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1996 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1997 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
1998 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2001 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2002 Release (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2004 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2006 DBUG (fprintf (stderr, "EndDrag:\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2008 switch (w->sb.armed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2009 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2010 case ARM_KNOB:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2011 call_callbacks (w, XmCR_VALUE_CHANGED, w->sb.value, event_y (w, event), event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2012 w->sb.armed = ARM_NONE;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2013 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2014 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2015 case ARM_UP:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2016 redraw_up_arrow (w, False, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2017 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2018 case ARM_DOWN:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2019 redraw_down_arrow (w, False, False);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2020 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2021 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2023 XtUngrabKeyboard ((Widget) w, event->xbutton.time);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 w->sb.armed = ARM_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2028 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2029 Jump (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2031 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 int x, y, width, height, mouse_x, mouse_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 int arrow_height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 int last_above, last_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2036 DBUG (fprintf (stderr, "Jump:\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2038 x = widget_x (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2039 y = widget_y (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2040 width = widget_w (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2041 height = widget_h (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2042
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2043 mouse_x = event_x (w, event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2044 mouse_y = event_y (w, event);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2046 arrow_height = w->sb.showArrows ? arrow_h (w) : 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2048 XtGrabKeyboard ((Widget) w, False, GrabModeAsync, GrabModeAsync,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2049 event->xbutton.time);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2051 switch (what_button (w, mouse_x, mouse_y))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2052 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2053 case BUTTON_TROUGH_ABOVE:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2054 case BUTTON_TROUGH_BELOW:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2055 case BUTTON_KNOB:
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2056 w->sb.savedValue = w->sb.value;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2058 height -= (2*arrow_height);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2059 y += arrow_height;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2061 last_above = w->sb.above;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2062 last_value = w->sb.value;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2064 w->sb.armed = ARM_KNOB;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2065 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2067 w->sb.above = mouse_y - (w->sb.ss / 2) - arrow_height;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2068 if (w->sb.above < 0)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2069 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2070 w->sb.above = 0;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2071 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2072 else if (w->sb.above + w->sb.ss > height)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2073 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2074 w->sb.above = height - w->sb.ss;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2075 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2076 w->sb.below = (height - (w->sb.ss + w->sb.above));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2078 if (last_above != w->sb.above)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2079 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2080 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2082 w->sb.value = value_from_pixel (w, w->sb.above);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2083 verify_values (w);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2084 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2086 w->sb.lastY = mouse_y;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2087 w->sb.lastY = w->sb.above + arrow_height + (w->sb.ss / 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2089 if (w->sb.value != last_value)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2090 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2091 call_callbacks (w, XmCR_DRAG, w->sb.value, event_y (w, event), event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2092 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2093 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2094 break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2095 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2096 CHECK (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2099 static void
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2100 Abort (Widget widget, XEvent *event, String *parms, Cardinal *num_parms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 {
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2102 XlwScrollBarWidget w = (XlwScrollBarWidget) widget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2104 DBUG (fprintf (stderr, "Abort:\n"));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2106 if (w->sb.armed != ARM_NONE)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2107 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2108 if (w->sb.value != w->sb.savedValue)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2109 {
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 w->sb.value = w->sb.savedValue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2112 seg_pixel_sizes (w, &w->sb.above, &w->sb.ss, &w->sb.below);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2113 draw_knob (w, w->sb.above, w->sb.ss, w->sb.below);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2115 call_callbacks (w, XmCR_VALUE_CHANGED, w->sb.value,
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2116 event_y (w, event), event);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2117 }
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2118
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2119 switch (w->sb.armed)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2120 {
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2121 case ARM_UP: redraw_up_arrow (w, False, False); break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2122 case ARM_DOWN: redraw_down_arrow (w, False, False); break;
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2123 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 w->sb.armed = ARM_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2127 XtUngrabKeyboard ((Widget) w, event->xbutton.time);
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 2
diff changeset
2128 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 }