OpenCOVER
coSlider.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef CO_SLIDER_H
9#define CO_SLIDER_H
10
11#include <OpenVRUI/coAction.h>
14
15namespace vrui
16{
17
18class coSlider;
19class vruiHit;
20class vruiTransformNode;
21class coCombinedButtonInteraction;
22
24class OPENVRUIEXPORT coSliderActor
25{
26public:
28 {
29 }
30 virtual void sliderEvent(coSlider *slider);
31 virtual void sliderReleasedEvent(coSlider *slider);
32};
33
37class OPENVRUIEXPORT coSlider : public coAction, public coUIElement, public coUpdateable
38{
39public:
40 coSlider(coSliderActor *actor, bool showValue = true);
41 virtual ~coSlider();
42
43 // hit is called whenever the button
44 // with this action is intersected
45 // return ACTION_CALL_ON_MISS if you want miss to be called
46 // otherwise return ACTION_DONE
47 virtual int hit(vruiHit *hit);
48
49 // miss is called once after a hit, if the button is not intersected
50 // anymore
51 virtual void miss();
52
53 void joystickUp();
54 void joystickDown();
56
57 void setValue(float val, bool generateEvent = false);
58 float getValue() const;
59 float getLinearValue() const;
60 void setMin(float mi);
61 float getMin() const;
62 float getLinearMin() const;
63 void setMax(float ma);
64 float getMax() const;
65 float getLinearMax() const;
66 void setNumTicks(float nt);
67 float getNumTicks() const;
68 void setPrecision(int nt);
69 int getPrecision() const;
70 void setInteger(bool on);
71 bool isInteger() const;
72 void setLogarithmic(bool on);
73 bool isLogarithmic() const;
74 float getDialSize() const;
75 void setPos(float x, float y, float z = 0.0f);
76
77 virtual void setHighlighted(bool highlighted);
78 virtual void setSize(float x, float y, float z);
79 virtual void setSize(float size);
80 virtual float getWidth() const
81 {
82 return myWidth;
83 }
84 virtual float getHeight() const
85 {
86 return myHeight;
87 }
88 virtual float getXpos() const
89 {
90 return myX;
91 }
92 virtual float getYpos() const
93 {
94 return myY;
95 }
96 virtual float getZpos() const
97 {
98 return myZ;
99 }
100 virtual void setActive(bool a);
101 virtual bool getActive()
102 {
103 return active_;
104 };
105
106 bool getShowValue() const;
107
108 static void adjustSlider(float &mini, float &maxi, float & /*value*/, float &step, int &digits);
109
111 virtual const char *getClassName() const;
113 virtual bool isOfClassName(const char *) const;
114
115protected:
116 void clamp() const;
117
118 bool integer;
123 coCombinedButtonInteraction *interactionWheel[2];
125 float dialSize;
127 float myX;
128 float myY;
129 float myZ;
130 float myWidth;
131 float myHeight;
132 float myDepth;
133 float minVal;
134 float maxVal;
135 mutable float value;
136 mutable float linearValue;
137 float numTicks;
139
141 bool active_;
142
143 virtual bool update();
144
146};
147}
148#endif
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coAction.h:26
Definition: coCombinedButtonInteraction.h:22
Action listener for events triggered by coSlider.
Definition: coSlider.h:25
virtual ~coSliderActor()
Definition: coSlider.h:27
virtual void sliderReleasedEvent(coSlider *slider)
virtual void sliderEvent(coSlider *slider)
Definition: coSlider.h:38
float myDepth
slider depth [mm]
Definition: coSlider.h:132
virtual int hit(vruiHit *hit)
float minVal
minimum slider value
Definition: coSlider.h:133
float maxVal
maximum slider value
Definition: coSlider.h:134
virtual void setSize(float size)
virtual void setSize(float x, float y, float z)
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
float myY
slider element y position in object space [mm]
Definition: coSlider.h:128
float value
current slider value
Definition: coSlider.h:135
float myZ
slider element z position in object space [mm]
Definition: coSlider.h:129
void setMin(float mi)
float myHeight
slider height [mm]
Definition: coSlider.h:131
coSliderActor * myActor
action listener for slider events
Definition: coSlider.h:126
float linearValue
current linear slider value (=value or log(value))
Definition: coSlider.h:136
float getLinearMax() const
long lastPressAction
Definition: coSlider.h:145
int getPrecision() const
virtual const char * getClassName() const
get the Element's classname
float getLinearMin() const
float numTicks
number of tickmarks on slider dial
Definition: coSlider.h:137
bool isInteger() const
virtual void setHighlighted(bool highlighted)
virtual float getYpos() const
Returns element y position.
Definition: coSlider.h:92
float getValue() const
virtual float getXpos() const
Returns element x position.
Definition: coSlider.h:88
bool unregister
true if the interaction should be unregistered
Definition: coSlider.h:124
void setMax(float ma)
bool getShowValue() const
void setPos(float x, float y, float z=0.0f)
void setNumTicks(float nt)
static void adjustSlider(float &mini, float &maxi, float &, float &step, int &digits)
void setLogarithmic(bool on)
void clamp() const
coSlider(coSliderActor *actor, bool showValue=true)
virtual void miss()
void setValue(float val, bool generateEvent=false)
bool active_
flag if slider is active
Definition: coSlider.h:141
bool showValue
true = the slider value is displayed
Definition: coSlider.h:120
virtual bool update()
bool logarithmic
true = slider shows logarithm of value
Definition: coSlider.h:119
void setPrecision(int nt)
void joystickDown()
decrementslidervalue
void setInteger(bool on)
float getNumTicks() const
float getMax() const
bool valueChanged
indicates a value change since last readout
Definition: coSlider.h:140
virtual float getWidth() const
Returns element width.
Definition: coSlider.h:80
float myWidth
slider width [mm]
Definition: coSlider.h:130
virtual float getHeight() const
Returns element height.
Definition: coSlider.h:84
void joystickUp()
increment slidervalue
bool isLogarithmic() const
coCombinedButtonInteraction * interactionA
interaction for wheel
Definition: coSlider.h:121
virtual void setActive(bool a)
float myX
slider element x position in object space [mm]
Definition: coSlider.h:127
virtual bool getActive()
Definition: coSlider.h:101
int precision
precision of slider value display: number of decimals
Definition: coSlider.h:138
virtual ~coSlider()
float getDialSize() const
float getLinearValue() const
bool integer
true = slider processes only integer values
Definition: coSlider.h:118
virtual float getZpos() const
Definition: coSlider.h:96
void resetLastPressAction()
no last press action
float getMin() const
float dialSize
size of slider dial
Definition: coSlider.h:125
Definition: coUIElement.h:53
objects that are derived from this class are called once per frame
Definition: coUpdateManager.h:20
Definition: vruiHit.h:21