1 /**************************************************************************\ 2 * 3 * This file is part of the Coin 3D visualization library. 4 * Copyright (C) by Kongsberg Oil & Gas Technologies. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * ("GPL") version 2 as published by the Free Software Foundation. 9 * See the file LICENSE.GPL at the root directory of this source 10 * distribution for additional information about the GNU GPL. 11 * 12 * For using Coin with software that can not be combined with the GNU 13 * GPL, and for taking advantage of the additional benefits of our 14 * support services, please contact Kongsberg Oil & Gas Technologies 15 * about acquiring a Coin Professional Edition License. 16 * 17 * See http://www.coin3d.org/ for more information. 18 * 19 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 20 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 21 * 22 \**************************************************************************/ 23 24 // $Id$ 25 26 #ifndef SOXT_SLIDER_H 27 #define SOXT_SLIDER_H 28 29 #include <X11/Intrinsic.h> 30 31 #include <Inventor/SbBasic.h> 32 33 #include <Inventor/Xt/SoXtBasic.h> 34 35 class SbPList; 36 class SoXtSliderSetModule; 37 38 // ************************************************************************* 39 40 typedef void SoXtSliderCB(void * closure, char * title, float value); 41 42 class SoXtSlider { 43 public: 44 SoXtSlider(const char * const title); 45 ~SoXtSlider(void); 46 47 void setValue(float val); 48 float getValue(void) const; 49 50 void setRange(float min, float max); 51 void getRange(float & min, float & max) const; 52 53 void addCallback(SoXtSliderCB * callback, void * closure = NULL); 54 void removeCallback(SoXtSliderCB * callback, void * closure = NULL); 55 56 Widget buildSimpleWidget(const Widget parent); 57 Widget buildRangedWidget(const Widget parent); 58 Widget buildFullWidget(const Widget parent); 59 Widget buildOrderlyWidget(const Widget parent); 60 61 protected: 62 void invokeCallbacks(void); 63 64 private: 65 float current, minimum, maximum; 66 char * title; 67 68 // simple 69 Widget s_form, s_value, s_slider; 70 // ranged 71 Widget r_form, r_value, r_slider, r_minValue, r_maxValue; 72 // full 73 Widget f_form, f_value, f_slider, f_minValue, f_min, f_maxValue, f_max, 74 f_label; 75 // orderly 76 Widget o_form, o_value, o_slider, o_label; 77 78 SbPList * callbacks; 79 80 private: 81 static void slider_cb(Widget, XtPointer, XtPointer); 82 static void value_cb(Widget, XtPointer, XtPointer); 83 static void min_value_cb(Widget, XtPointer, XtPointer); 84 static void min_cb(Widget, XtPointer, XtPointer); 85 static void max_value_cb(Widget, XtPointer, XtPointer); 86 static void max_cb(Widget, XtPointer, XtPointer); 87 88 }; // class SoXtSlider 89 90 // ************************************************************************* 91 92 #endif // ! SOXT_SLIDER_H 93