annotate lwlib/xlwscrollbar.c @ 48:56c54cf7c5b6 r19-16b90

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