Debian Codegraph @

libSoXt/src/motif/SoXtSldrTl.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990-93 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.3 $
44 |
45 | Classes:
46 | SoXtSliderTool is a component that expands the functionality of the
47 | standard motif slider (they call it 'scale') widget.
48 |
49 | Author(s) : Paul Isaacs
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55
56
57 #include <inttypes.h>
58 #include "SoXtSliderTool.h"
59 #include "SoXtMultiSlider.h"
60 #include <X11/StringDefs.h>
61 #include <Xm/Form.h>
62
63 /***************************************************************************/
64 /* static variables used by XtGetApplicationResources to get values of */
65 /* user-settable parameters. The defaults values are used if the user */
66 /* does not override them. */
67 /***************************************************************************/
68 static XtResource _leftResources[] = {
69 { XmNleftPosition, XmCPosition, XtRInt, sizeof( int),
70 0,
71 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_LEFT_DIVIDING_POINT }
72 };
73 static XtResource _rightResources[] = {
74 { XmNrightPosition, XmCPosition, XtRInt, sizeof( int),
75 0,
76 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_RIGHT_DIVIDING_POINT }
77 };
78 static XtResource _valueResources[] = {
79 { XmNbottomPosition, XmCPosition, XtRInt, sizeof( int),
80 0,
81 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_SLIDER_DIVIDING_POINT }
82 };
83 static XtResource _minValueResources[] = {
84 { XmNbottomPosition, XmCPosition, XtRInt, sizeof( int),
85 0,
86 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_MIN_DIVIDING_POINT }
87 };
88 static XtResource _minResources[] = {
89 { XmNbottomPosition, XmCPosition, XtRInt, sizeof( int),
90 0,
91 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_MIN_BOTTOM_POINT }
92 };
93 static XtResource _maxValueResources[] = {
94 { XmNbottomPosition, XmCPosition, XtRInt, sizeof( int),
95 0,
96 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_MAX_DIVIDING_POINT }
97 };
98 static XtResource _maxResources[] = {
99 { XmNbottomPosition, XmCPosition, XtRInt, sizeof( int),
100 0,
101 XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_MAX_BOTTOM_POINT }
102 };
103 static XtResource _borderWidthResource[] = {
104 { XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof( unsigned short),
105 0, XtRImmediate, (XtPointer) DEFAULT_SLIDER_TOOL_BORDER_WIDTH }
106 };
107
108 SoXtSliderTool::SoXtSliderTool(
109 Widget parent,
110 const char *name,
111 SbBool buildInsideParent,
112 int startingMin,
113 int startingMax)
114 : SoXtSliderSetBase(
115 parent,
116 name,
117 buildInsideParent,
118 NULL)
119 {
120 _leftDividingPoint = 0;
121 _rightDividingPoint = 0;
122 _sliderDividingPoint = 0;
123 _minDividingPoint = 0;
124 _maxDividingPoint = 0;
125 _minBottomPoint = 0;
126 _maxBottomPoint = 0;
127 _layoutWidth = 310;
128 _layoutHeight = 82;
129 _title = NULL;
130 _multiSlider = NULL;
131
132 // Build the widget!
133 Widget w = buildWidget( getParentWidget(), startingMin, startingMax);
134 setBaseWidget(w);
135 }
136
137 SoXtSliderTool::~SoXtSliderTool()
138 {
139 delete _value;
140 delete _slider;
141 delete _minValue;
142 delete _maxValue;
143 delete _min;
144 delete _max;
145
146 if (_title != NULL)
147 XmStringFree(_title);
148 }
149
150 Widget
151 SoXtSliderTool::buildWidget(
152 Widget parent,
153 int startingMin,
154 int startingMax )
155 {
156 widget = XtCreateManagedWidget(getWidgetName(),xmFormWidgetClass,
157 parent,NULL, 0);
158
159 _value = new SoXtFloatText(widget, "value");
160 _slider = new SoXtMinMaxSlider(widget, "slider", TRUE, startingMin, startingMax);
161 _slider->setSliderTool( this );
162
163 _max = new SoXtMMSliderMax( widget, "max" );
164 _max->setSliderTool( this );
165 _maxValue = new SoXtFloatText( widget, "maxValue" );
166
167 _min = new SoXtMMSliderMin(widget, "min");
168 _min->setSliderTool( this );
169 _minValue = new SoXtFloatText( widget, "minValue" );
170
171 /* take care of layout within the tool */
172 initLayout();
173
174 /* set the callbacks for the sub components */
175 XtAddCallback( _value->getWidget(), XmNactivateCallback,
176 (XtCallbackProc) &SoXtSliderTool::sliderValueCallback,
177 (XtPointer) this );
178 XtAddCallback( _minValue->getWidget(), XmNactivateCallback,
179 (XtCallbackProc) &SoXtSliderTool::minValueCallback,
180 (XtPointer) this );
181 XtAddCallback( _maxValue->getWidget(), XmNactivateCallback,
182 (XtCallbackProc) &SoXtSliderTool::maxValueCallback,
183 (XtPointer) this );
184
185 /* initialize values throughout the tool to be those in the slider */
186 /* Right now, this winds up filling the label widgets with text */
187 toolSetValue( _slider->getSliderValue());
188 toolSetMin( _slider->getSliderMin());
189 toolSetMax( _slider->getSliderMax());
190 return widget;
191 }
192
193 void
194 SoXtSliderTool::openMinMax()
195 {
196 Arg wargs[10];
197 int nargs;
198
199 _layoutWidth = 310;
200 _layoutHeight = 82;
201
202 // set positions for widgets...
203 nargs = 0;
204 XtSetArg(wargs[nargs],XmNbottomPosition, _sliderDividingPoint ); nargs++;
205 XtSetArg(wargs[nargs],XmNleftPosition, _leftDividingPoint ); nargs++;
206 XtSetArg(wargs[nargs],XmNrightPosition, _rightDividingPoint ); nargs++;
207 XtSetValues( _value->getWidget(), wargs, nargs );
208
209 nargs = 0;
210 XtSetArg(wargs[nargs],XmNtopPosition, _sliderDividingPoint ); nargs++;
211 XtSetArg(wargs[nargs],XmNleftPosition, _leftDividingPoint ); nargs++;
212 XtSetArg(wargs[nargs],XmNrightPosition, _rightDividingPoint ); nargs++;
213 if ( _title )
214 XtSetArg(wargs[nargs],XmNtitleString, _title ); nargs++;
215 XtSetValues( _slider->getWidget(), wargs, nargs );
216
217 nargs = 0;
218 XtSetArg(wargs[nargs],XmNbottomPosition, _minDividingPoint ); nargs++;
219 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_FORM ); nargs++;
220 XtSetArg(wargs[nargs],XmNrightPosition, _leftDividingPoint ); nargs++;
221 XtSetValues( _minValue->getWidget(), wargs, nargs );
222
223 nargs = 0;
224 XtSetArg(wargs[nargs],XmNbottomPosition, _maxDividingPoint ); nargs++;
225 XtSetArg(wargs[nargs],XmNleftPosition, _rightDividingPoint); nargs++;
226 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_FORM ); nargs++;
227 XtSetValues( _maxValue->getWidget(), wargs, nargs );
228
229 _maxValue->show();
230 _max->show();
231
232 _minValue->show();
233 _min->show();
234 }
235
236 void
237 SoXtSliderTool::closeMinMax()
238 {
239 Arg wargs[10];
240 int nargs;
241
242 _layoutWidth = 310;
243 _layoutHeight = 82;
244
245 // redo layout for widgets
246 nargs = 0;
247 XtSetArg(wargs[nargs],XmNbottomPosition, _sliderDividingPoint ); nargs++;
248 XtSetArg(wargs[nargs],XmNleftPosition, 0 ); nargs++;
249 XtSetArg(wargs[nargs],XmNrightPosition, 100 ); nargs++;
250 XtSetValues( _value->getWidget(), wargs, nargs );
251
252 nargs = 0;
253 XtSetArg(wargs[nargs],XmNtopPosition, _sliderDividingPoint ); nargs++;
254 XtSetArg(wargs[nargs],XmNleftPosition, 0 ); nargs++;
255 XtSetArg(wargs[nargs],XmNrightPosition, 100 ); nargs++;
256 if ( _title )
257 XtSetArg(wargs[nargs],XmNtitleString, _title ); nargs++;
258 XtSetValues( _slider->getWidget(), wargs, nargs );
259
260 _maxValue->hide();
261 _max->hide();
262
263 _minValue->hide();
264 _min->hide();
265 }
266
267 void
268 SoXtSliderTool::makeSkinnyOpen()
269 {
270 Arg wargs[10];
271 int nargs;
272
273 _layoutWidth = 310;
274 _layoutHeight = 37;
275
276 // redo layout
277 nargs = 0;
278 XtSetArg(wargs[nargs],XmNbottomPosition, 100 ); nargs++;
279 XtSetArg(wargs[nargs],XmNleftPosition, 0 ); nargs++;
280 XtSetArg(wargs[nargs],XmNrightPosition,
281 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_1 ); nargs++;
282 XtSetValues( _value->getWidget(), wargs, nargs );
283
284 nargs = 0;
285 XtSetArg(wargs[nargs],XmNbottomPosition, 100 ); nargs++;
286 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_POSITION ); nargs++;
287 XtSetArg(wargs[nargs],XmNleftPosition,
288 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_1 ); nargs++;
289 XtSetArg(wargs[nargs],XmNrightPosition,
290 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_2 ); nargs++;
291 XtSetValues( _minValue->getWidget(), wargs, nargs );
292
293 // save the title before zeroing it out...
294 if (_title == NULL) {
295 nargs = 0;
296 XtSetArg(wargs[nargs],XmNtitleString, (XtPointer) &_title ); nargs++;
297 XtGetValues( _slider->getWidget(), wargs, nargs );
298 }
299
300 nargs = 0;
301 XtSetArg(wargs[nargs],XmNtopPosition, 0 ); nargs++;
302 XtSetArg(wargs[nargs],XmNleftPosition,
303 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_2 ); nargs++;
304 XtSetArg(wargs[nargs],XmNrightPosition,
305 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_3 ); nargs++;
306 XtSetArg(wargs[nargs],XmNtitleString, (void *) NULL ); nargs++;
307 XtSetValues( _slider->getWidget(), wargs, nargs );
308
309 nargs = 0;
310 XtSetArg(wargs[nargs],XmNbottomPosition, 100 ); nargs++;
311 XtSetArg(wargs[nargs],XmNleftPosition,
312 DEFAULT_SLIDER_TOOL_SKINNY_OPEN_POINT_3 ); nargs++;
313 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_POSITION ); nargs++;
314 XtSetArg(wargs[nargs],XmNrightPosition, 100 ); nargs++;
315 XtSetValues( _maxValue->getWidget(), wargs, nargs );
316
317 _maxValue->show();
318 _max->hide();
319
320 _minValue->show();
321 _min->hide();
322 }
323
324 void
325 SoXtSliderTool::makeSkinnyClosed()
326 {
327 Arg wargs[10];
328 int nargs;
329
330 _layoutWidth = 310;
331 _layoutHeight = 37;
332
333 // redo layout
334 nargs = 0;
335 XtSetArg(wargs[nargs],XmNbottomPosition, 100 ); nargs++;
336 XtSetArg(wargs[nargs],XmNleftPosition, 0 ); nargs++;
337 XtSetArg(wargs[nargs],XmNrightPosition,
338 DEFAULT_SLIDER_TOOL_SKINNY_CLOSED_POINT_1 ); nargs++;
339 XtSetValues( _value->getWidget(), wargs, nargs );
340
341 // save the title before zeroing it out...
342 if (_title == NULL) {
343 nargs = 0;
344 XtSetArg(wargs[nargs],XmNtitleString, &_title ); nargs++;
345 XtGetValues( _slider->getWidget(), wargs, nargs );
346 }
347
348 nargs = 0;
349 XtSetArg(wargs[nargs],XmNtopPosition, 0 ); nargs++;
350 XtSetArg(wargs[nargs],XmNleftPosition,
351 DEFAULT_SLIDER_TOOL_SKINNY_CLOSED_POINT_1 ); nargs++;
352 XtSetArg(wargs[nargs],XmNrightPosition, 100 ); nargs++;
353 XtSetArg(wargs[nargs],XmNtitleString, (void *) NULL ); nargs++;
354 XtSetValues( _slider->getWidget(), wargs, nargs );
355
356 _maxValue->hide();
357 _max->hide();
358
359 _minValue->hide();
360 _min->hide();
361 }
362
363 void
364 SoXtSliderTool::toolSetValue( float newVal )
365 {
366 if ( _slider->getSliderMin() > newVal )
367 toolSetMin( newVal );
368 if ( _slider->getSliderMax() < newVal )
369 toolSetMax( newVal );
370
371 /* send the value to the slider */
372 _slider->setSliderValue( newVal );
373
374 /* send the value to the label */
375 _value->setDisplayedValue( newVal, _slider->getNumDecimals() );
376 }
377
378 void
379 SoXtSliderTool::toolSetMin( float newVal )
380 {
381 float valToUse;
382
383 if ( newVal <= _slider->getSliderValue()
384 && newVal < _slider->getSliderMax() )
385 valToUse = newVal;
386 else
387 valToUse = _slider->getSliderMin();
388
389 /* send the new minimum value to the slider */
390 _slider->setSliderMin( valToUse );
391
392 /* send the new minimum value to the minimum label */
393 _minValue->setDisplayedValue( valToUse, _slider->getNumDecimals() );
394 }
395
396 void
397 SoXtSliderTool::toolSetMax( float newVal )
398 {
399 float valToUse;
400
401 if ( newVal >= _slider->getSliderValue()
402 && newVal > _slider->getSliderMin() )
403 valToUse = newVal;
404 else
405 valToUse = _slider->getSliderMax();
406
407 /* send the new maximum value to the slider */
408 _slider->setSliderMax( valToUse );
409
410 /* send the new maximum value to the maximum label */
411 _maxValue->setDisplayedValue( valToUse, _slider->getNumDecimals() );
412 }
413
414 void
415 SoXtSliderTool::initLayout()
416 {
417 if (widget == NULL)
418 return;
419
420 Arg wargs[10];
421 int nargs;
422 Dimension bWidth;
423
424 /* get the dividing points from the resource manager */
425 /* note: defaults will be returned if the user didn't set them. */
426 /* these defaults can be found at the beginning of this file, where */
427 /* _leftResources, _rightResources, etc. are defined */
428 XtGetApplicationResources( widget, (XtPointer) &bWidth,
429 _borderWidthResource, XtNumber( _borderWidthResource),
430 NULL, 0 );
431
432 XtGetApplicationResources( _slider->getWidget(),
433 (XtPointer) &_leftDividingPoint,
434 _leftResources, XtNumber( _leftResources),
435 NULL, 0 );
436 XtGetApplicationResources( _slider->getWidget(),
437 (XtPointer) &_rightDividingPoint,
438 _rightResources, XtNumber( _rightResources),
439 NULL, 0 );
440
441 XtGetApplicationResources( _value->getWidget(),
442 (XtPointer) &_sliderDividingPoint,
443 _valueResources, XtNumber( _valueResources),
444 NULL, 0 );
445
446 XtGetApplicationResources( _minValue->getWidget(),
447 (XtPointer) &_minDividingPoint,
448 _minValueResources, XtNumber( _minValueResources),
449 NULL, 0 );
450 XtGetApplicationResources( _min->getWidget(),(XtPointer) &_minBottomPoint,
451 _minResources, XtNumber( _minResources),
452 NULL, 0 );
453
454 XtGetApplicationResources( _maxValue->getWidget(),
455 (XtPointer) &_maxDividingPoint,
456 _maxValueResources, XtNumber( _maxValueResources),
457 NULL, 0 );
458 XtGetApplicationResources( _max->getWidget(),(XtPointer) &_maxBottomPoint,
459 _maxResources, XtNumber( _maxResources),
460 NULL, 0 );
461
462 nargs = 0;
463 XtSetArg(wargs[nargs],XmNborderWidth, bWidth ); nargs++;
464 XtSetValues( widget, wargs, nargs );
465
466 nargs = 0;
467 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_FORM ); nargs++;
468 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_POSITION ); nargs++;
469 XtSetArg(wargs[nargs],XmNbottomPosition, _sliderDividingPoint ); nargs++;
470 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_POSITION ); nargs++;
471 XtSetArg(wargs[nargs],XmNleftPosition, _leftDividingPoint ); nargs++;
472 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_POSITION ); nargs++;
473 XtSetArg(wargs[nargs],XmNrightPosition, _rightDividingPoint ); nargs++;
474 XtSetValues( _value->getWidget(), wargs, nargs );
475
476 nargs = 0;
477 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_POSITION ); nargs++;
478 XtSetArg(wargs[nargs],XmNtopPosition, _sliderDividingPoint ); nargs++;
479 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_FORM ); nargs++;
480 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_POSITION ); nargs++;
481 XtSetArg(wargs[nargs],XmNleftPosition, _leftDividingPoint ); nargs++;
482 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_POSITION ); nargs++;
483 XtSetArg(wargs[nargs],XmNrightPosition, _rightDividingPoint ); nargs++;
484 XtSetValues( _slider->getWidget(), wargs, nargs );
485
486 nargs = 0;
487 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_FORM ); nargs++;
488 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_POSITION ); nargs++;
489 XtSetArg(wargs[nargs],XmNbottomPosition, _minDividingPoint ); nargs++;
490 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_FORM ); nargs++;
491 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_POSITION ); nargs++;
492 XtSetArg(wargs[nargs],XmNrightPosition, _leftDividingPoint ); nargs++;
493 XtSetValues( _minValue->getWidget(), wargs, nargs );
494
495 nargs = 0;
496 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_POSITION ); nargs++;
497 XtSetArg(wargs[nargs],XmNtopPosition, _minDividingPoint); nargs++;
498 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_POSITION ); nargs++;
499 XtSetArg(wargs[nargs],XmNbottomPosition, _minBottomPoint ); nargs++;
500 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_FORM ); nargs++;
501 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_POSITION ); nargs++;
502 XtSetArg(wargs[nargs],XmNrightPosition, _leftDividingPoint ); nargs++;
503 XtSetValues( _min->getWidget(), wargs, nargs );
504
505 nargs = 0;
506 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_FORM ); nargs++;
507 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_POSITION ); nargs++;
508 XtSetArg(wargs[nargs],XmNbottomPosition, _maxDividingPoint ); nargs++;
509 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_POSITION ); nargs++;
510 XtSetArg(wargs[nargs],XmNleftPosition, _rightDividingPoint); nargs++;
511 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_FORM ); nargs++;
512 XtSetValues( _maxValue->getWidget(), wargs, nargs );
513
514 nargs = 0;
515 XtSetArg(wargs[nargs],XmNtopAttachment, XmATTACH_POSITION ); nargs++;
516 XtSetArg(wargs[nargs],XmNtopPosition, _maxDividingPoint ); nargs++;
517 XtSetArg(wargs[nargs],XmNbottomAttachment, XmATTACH_POSITION ); nargs++;
518 XtSetArg(wargs[nargs],XmNbottomPosition, _maxBottomPoint ); nargs++;
519 XtSetArg(wargs[nargs],XmNleftAttachment, XmATTACH_POSITION ); nargs++;
520 XtSetArg(wargs[nargs],XmNleftPosition, _rightDividingPoint); nargs++;
521 XtSetArg(wargs[nargs],XmNrightAttachment, XmATTACH_FORM ); nargs++;
522 XtSetValues( _max->getWidget(), wargs, nargs );
523 }
524
525 void
526 SoXtSliderTool::sliderValueCallback( Widget, void *client_data, void *)
527 {
528 float theVal;
529 SoXtMinMaxSlider *theSlider;
530 SoXtSliderTool *theSliderTool = (SoXtSliderTool *) client_data;
531
532 if (theSliderTool) {
533 // If you can't get a legible value from the value label... */
534 if ( !theSliderTool->getValue()->getDisplayedValue( theVal ) ) {
535 // get if from the slider itself
536 theSlider = theSliderTool->getSlider();
537 if (theSlider)
538 theVal = theSlider->getSliderValue();
539 }
540 // set the value throughout the SoXtSliderTool
541 theSliderTool->toolSetValue( theVal );
542
543 // If you can find a tripleSlider in the ancestry...
544 if ( theSliderTool->_multiSlider )
545 theSliderTool->_multiSlider->exportValuesToInventor();
546 }
547 }
548
549 void
550 SoXtSliderTool::minValueCallback( Widget, void *client_data, void * )
551 {
552 float theVal;
553 SoXtMinMaxSlider *theSlider;
554 SoXtSliderTool *theSliderTool = (SoXtSliderTool *) client_data;
555
556 if (theSliderTool) {
557 // If you can't get a legible value from the min value label... */
558 if ( !theSliderTool->getMinValue()->getDisplayedValue( theVal ) ) {
559 // get if from the slider itself
560 theSlider = theSliderTool->getSlider();
561 if (theSlider)
562 theVal = theSlider->getSliderMin();
563 }
564 // set the value throughout the SoXtSliderTool
565 theSliderTool->toolSetMin( theVal );
566 }
567 }
568
569 void
570 SoXtSliderTool::maxValueCallback( Widget, void *client_data, void * )
571 {
572 float theVal;
573 SoXtMinMaxSlider *theSlider;
574 SoXtSliderTool *theSliderTool = (SoXtSliderTool *) client_data;
575
576 if (theSliderTool) {
577 // If you can't get a legible value from the max value label... */
578 if ( !theSliderTool->getMaxValue()->getDisplayedValue( theVal ) ) {
579 // get if from the slider itself
580 theSlider = theSliderTool->getSlider();
581 if (theSlider)
582 theVal = theSlider->getSliderMax();
583 }
584 // set the value throughout the SoXtSliderTool
585 theSliderTool->toolSetMax( theVal );
586 }
587 }
588
589 void
590 SoXtSliderTool::setMultiSlider( SoXtMultiSlider *newOne )
591 {
592 _multiSlider = newOne;
593 if (_slider)
594 _slider->setMultiSlider( newOne );
595 }