home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- | Description:
- | A component class that creates a more functionally extensive
- | slider than that given by motif.
- |
- | Author(s) : Paul Isaacs
- |
- */
-
-
- #ifndef _NOODLE_SLIDER_
- #define _NOODLE_SLIDER_
-
- #include <Xm/Xm.h>
- #include <Inventor/Xt/SoXtComponent.h>
- #include <Inventor/misc/SoCallbackList.h>
-
- class NoodleSlider : public SoXtComponent {
- public:
- NoodleSlider(
- Widget parent = NULL,
- const char *name = NULL,
- SbBool buildInsideParent = TRUE,
- int startingMin = -1000,
- int startingMax = 1000);
- ~NoodleSlider();
-
- // add callbacks to the slider to be called when the value changes,
- // either from the slider or the text widget.
- void addValueChangedCallback(SoCallbackListCB *f, void *userData = NULL);
- void removeValueChangedCallback(SoCallbackListCB *f,void *userData =NULL);
-
- // return the current value, min, or max.
- float getValue();
- float getMin();
- float getMax();
-
- // set the value, min, or max.
- void setValue( float newVal );
- void setMin( float newVal );
- void setMax( float newVal );
-
- // internal:
- static void valueWidgetCallback(Widget w,
- void *client_data, void *call_data );
- static void sliderWidgetCallback(Widget w,
- void *client_data, void *call_data );
- Widget buildWidget( Widget parent, int startingMin, int startingMax);
-
- private:
- Widget _form;
- Widget _value;
- Widget _slider;
-
- float convertSliderToFloat( int sliderValue );
- int convertFloatToSlider( float floatValue );
- short getNumDecimals();
- void initLayout();
-
- SoCallbackList *valueChangedCallbacks;
- };
-
- #endif /* _NOODLE_SLIDER_ */
-