1 /* $Id: Slider.h,v 1.2 2000/01/17 20:55:18 falk Exp $
2  *
3  * Slider:  a widget to allow the user to enter a numeric value.
4  */
5 
6 
7 #ifndef _MwSlider_h
8 #define _MwSlider_h
9 
10 #include <X11/Xmu/Converters.h>
11 
12 
13 /***********************************************************************
14  *
15  * Slider Widget (subclass of CoreClass)
16  *
17  * The slider widget is very similar to a scrollbar except that it is
18  * intended to represent a numeric value which ranges between two numbers.
19  * The thumb is not normally resized, and the range of the slider goes all the
20  * way from min to max (a scrollbar stops short of 1. by an amount determined
21  * by the thumb size.)
22  *
23  ***********************************************************************/
24 
25 /* Resources:
26 
27  Name			Class			RepType		Default Value
28  ----			-----			-------		-------------
29  font			Font			XFontStruct*	XtDefaultFont
30  foreground		Foreground		Pixel		XtDefaultFore
31  minimum		Minimum			int		0
32  maximum		Maximum			int		100
33  value			Value			int		0
34  step			Step			int		(max-min)/10
35  step2			Step2			int		1
36  orientation		Orientation		XtOrientation	horizontal
37  showValue		ShowValue		Boolean		False	[tbd]
38  decimalPoints		DecimalPoints		short		0	[tbd]
39  inputScale		InputScale		short		100%
40  autoScale		AutoScale		Boolean		True
41  thumbLength		ThumbLength		short		20
42 
43  shadowWidth		ShadowWidth		short		1
44  topShadowContrast	TopShadowContrast	short		20
45  bottomShadowContrast	BottomShadowContrast	short		40
46  armShadowContrast	ArmShadowContrast	short		40
47  insensitiveContrast	InsensitiveContrast	short		33
48  beNiceToColormap	BeNiceToColormap	Boolean		False
49 
50  dragCallback		DragCallback		XtCallbackList	NULL
51  valueChangedCallback	ValueChangedCallback	XtCallbackList	NULL
52 
53  Notes:
54 
55  * showValue, decimalPoints not implemented yet.
56 
57  * step is the amount to change the value when the user clicks in the
58    slider background or presses a page up/down key.
59 
60  * step2 is the amount to change the value when the user presses an
61    arrow key or uses a scrollwheel mouse.
62 
63  * inputScale scales pointer motion to changes in the slider.  It is
64    very useful for small sliders which would otherwise be difficult
65    to manipulate.  Small values for inputScale cause small slider
66    changes for a given amount of pointer motion.  E.g. if inputScale
67    is 10, then a 100-pixel motion of the pointer results in only a
68    10-pixel change in the slider.
69 
70  * autoScale causes inputScale to be automatically set for sliders
71    with a range of motion less than 100 pixels.
72 
73  * dragCallback is called continuously as the slider is adjusted.
74    Call_data is the new slider value.
75 
76  * valueChangedCallback is called when the user completes an interaction.
77    Call_data is the new slider value.
78 
79  * style is one of:
80  	Normal		looks like Motif scale
81 	Eletronic	looks like a level control on a mix board.
82 
83  * thumbLength is the width of the thumb for horizontal sliders, or the
84    height for vertical sliders.
85 
86 */
87 
88 
89 
90 typedef	enum {SLNormal, SLElectronic} MwSliderStyle ;
91 
92 
93 /* New fields */
94 
95 #ifndef	XtNminimum
96 #define	XtNminimum	"minimum"
97 #define	XtCMinimum	"Minimum"
98 #endif
99 
100 #ifndef	XtNmaximum
101 #define	XtNmaximum	"maximum"
102 #define	XtCMaximum	"Maximum"
103 #endif
104 
105 #ifndef	XtNorientation
106 #define	XtNorientation	"orientation"
107 #define	XtCOrientation	"Orientation"
108 #endif
109 
110 #ifndef	XtNinputScale
111 #define	XtNinputScale	"inputScale"
112 #define	XtCInputScale	"InputScale"
113 #endif
114 
115 #ifndef	XtNautoScale
116 #define	XtNautoScale	"autoScale"
117 #define	XtCAutoScale	"AutoScale"
118 #endif
119 
120 #ifndef	XtNstep
121 #define	XtNstep		"step"
122 #define	XtCStep		"Step"
123 #endif
124 
125 #ifndef	XtNstep2
126 #define	XtNstep2	"step2"
127 #define	XtCStep2	"Step2"
128 #endif
129 
130 #ifndef	XtNdecimalPoints
131 #define	XtNdecimalPoints	"decimalPoints"
132 #define	XtCDecimalPoints	"DecimalPoints"
133 #endif
134 
135 #ifndef	XtNshowValue
136 #define	XtNshowValue	"showValue"
137 #define	XtCShowValue	"ShowValue"
138 #endif
139 
140 #ifndef	XtNautoScale
141 #define	XtNautoScale	"autoScale"
142 #define	XtCAutoScale	"AutoScale"
143 #endif
144 
145 #ifndef	XtNthumbLength
146 #define	XtNthumbLength	"thumbLength"
147 #define	XtCThumbLength	"ThumbLength"
148 #endif
149 
150 #ifndef	XtNsliderStyle
151 #define	XtNsliderStyle	"sliderStyle"
152 #define	XtCSliderStyle	"SliderStyle"
153 #define	XtRSliderStyle	"SliderStyle"
154 #endif
155 
156 #ifndef	XtNdragCallback
157 #define	XtNdragCallback	"dragCallback"
158 #define	XtCDragCallback	"DragCallback"
159 #endif
160 
161 #ifndef	XtNvalueChangedCallback
162 #define	XtNvalueChangedCallback	"valueChangedCallback"
163 #define	XtCValueChangedCallback	"ValueChangedCallback"
164 #endif
165 
166 #ifndef	XtNshadowWidth
167 #define XtNshadowWidth "shadowWidth"
168 #define XtCShadowWidth "ShadowWidth"
169 #define XtNtopShadowPixel "topShadowPixel"
170 #define XtCTopShadowPixel "TopShadowPixel"
171 #define XtNbottomShadowPixel "bottomShadowPixel"
172 #define XtCBottomShadowPixel "BottomShadowPixel"
173 #define XtNtopShadowContrast "topShadowContrast"
174 #define XtCTopShadowContrast "TopShadowContrast"
175 #define XtNbottomShadowContrast "bottomShadowContrast"
176 #define XtCBottomShadowContrast "BottomShadowContrast"
177 #define XtNarmShadowContrast "armShadowContrast"
178 #define XtCArmShadowContrast "ArmShadowContrast"
179 #endif
180 
181 #ifndef	XtNinsensitiveContrast
182 #define	XtNinsensitiveContrast	"insensitiveContrast"
183 #define	XtCInsensitiveContrast	"InsensitiveContrast"
184 #endif
185 
186 #ifndef	XtNtopShadowPixmap
187 #define	XtNtopShadowPixmap	"topShadowPixmap"
188 #define	XtCTopShadowPixmap	"TopShadowPixmap"
189 #define	XtNbottomShadowPixmap	"bottomShadowPixmap"
190 #define	XtCBottomShadowPixmap	"BottomShadowPixmap"
191 #endif
192 
193 #ifndef	XtNbeNiceToColormap
194 #define XtNbeNiceToColormap "beNiceToColormap"
195 #define XtCBeNiceToColormap "BeNiceToColormap"
196 #define XtNbeNiceToColourmap "beNiceToColormap"
197 #define XtCBeNiceToColourmap "BeNiceToColormap"
198 #endif
199 
200 /* Class record constants */
201 
202 extern WidgetClass mwSliderWidgetClass;
203 
204 typedef struct _MwSliderClassRec *MwSliderWidgetClass;
205 typedef struct _MwSliderRec      *MwSliderWidget;
206 
207 extern	XtAccelerators	MwSliderAccelerators ;
208 
209 _XFUNCPROTOBEGIN
210 extern	void
211 XawSliderSetValue(
212 #if NeedFunctionPrototypes
213 	Widget	w,
214 	int	newvalue,
215 	Bool	callCallbacks
216 #endif
217 ) ;
218 
219 _XFUNCPROTOEND
220 
221 #endif /* _MwSlider_h */
222