OpenCOVER
coValuePoti.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_VALUEPOTI_H
9#define CO_VALUEPOTI_H
10
11#include <OpenVRUI/coAction.h>
15
17
18#include <string>
19
20namespace vrui
21{
22
23class coValuePoti;
24class coCombinedButtonInteraction;
25class vruiTransformNode;
26class vruiNode;
27
30class OPENVRUIEXPORT coValuePotiActor
31{
32public:
34 {
35 }
42 virtual void potiValueChanged(float oldValue, float newValue, coValuePoti *poti, int context = -1) = 0;
43 virtual void potiPressed(coValuePoti *poti, int context = -1);
44 virtual void potiReleased(coValuePoti *poti, int context = -1);
48 virtual int getContext()
49 {
50 return -1;
51 }
52};
53
61class OPENVRUIEXPORT coValuePoti
62 : public coAction,
63 public coUIElement,
65 public coUpdateable
66{
67public:
68 enum
69 {
70 MAX_SLOPE = 1000
71 };
72
73 coValuePoti(const std::string &buttonText, coValuePotiActor *actor,
74 const std::string &backgroundTexture, vruiCOIM *cInterfaceManager = 0,
75 const std::string &interfaceName = "");
76
77 virtual ~coValuePoti();
78
79 virtual float getWidth() const // see superclass for comment
80 {
81 return 67.0f * xScaleFactor;
82 }
83 virtual float getHeight() const // see superclass for comment
84 {
85 return 60.0f * yScaleFactor;
86 }
87 virtual float getXpos() const // see superclass for comment
88 {
89 return myX;
90 }
91 virtual float getYpos() const // see superclass for comment
92 {
93 return myY;
94 }
95
96 virtual bool update();
97 virtual void setValue(float value);
98 virtual void setMin(float min);
99 virtual void setMax(float max);
100 virtual float getValue() const;
101 virtual int hit(vruiHit *hit);
102 // miss is called once after a hit, if the button is not intersected
103 // anymore
104 virtual void miss();
105
108
109 void setPos(float x, float y, float z = 0.0f);
110 void setSize(float size);
111 void setSize(float width, float height, float depth);
112 void setInteger(bool on);
113 void setIncrement(float increment);
114 void setLogarithmic(bool on);
115
116 void setState(float min, float max, float value,
117 bool isInt, float inc = 0.0f);
118
119 virtual float getMin() const;
120 virtual float getMax() const;
121 virtual bool isInteger() const;
122 virtual bool isDiscrete() const;
123 virtual float getIncrement() const;
124 virtual bool isLogarithmic() const;
125
126 virtual float getXSize() const;
127 virtual float getYSize() const;
128 virtual float getZSize() const;
129
130 virtual void setLabelVisible(bool);
131 virtual bool isLabelVisible();
132
133 const std::string &getBackgroundTexture() const
134 {
135 return backgroundTexture;
136 }
137 const std::string &getButtonText() const
138 {
139 return buttonText;
140 }
141
142 float discreteValue(float value) const;
143
145 virtual const char *getClassName() const;
147 virtual bool isOfClassName(const char *) const;
148
149protected:
150 float myX;
151 float myY;
152 float minValue;
153 float maxValue;
154 float value;
159 float lastRoll;
160 std::string buttonText;
161 std::string baseButtonText;
162 std::string backgroundTexture;
164 bool integer;
165 float increment;
167 bool logarithmic = false;
169
170 virtual void remoteLock(const char *message);
171 virtual void remoteOngoing(const char *message);
172 virtual void releaseRemoteLock(const char *message);
173 virtual void setEnabled(bool on);
174
175 virtual void setText(const std::string &buttonText);
176
177 void displayValue(float value);
178};
179
184class OPENVRUIEXPORT coSlopePoti : public coValuePoti
185{
186public:
187 coSlopePoti(const std::string &buttonText, coValuePotiActor *actor,
188 const std::string &backgroundTexture, vruiCOIM *cInterfaceManager = 0,
189 const std::string &interfaceName = "");
190
191 virtual void setValue(float);
192 virtual bool update();
193
194 virtual void remoteOngoing(const char *message);
195 virtual void setABS(bool on);
196 virtual bool getABS() const;
197 virtual float getValue() const;
198
200 virtual const char *getClassName() const;
202 virtual bool isOfClassName(const char *) const;
203
204 float convertSlopeToLinear(float) const;
205 float convertLinearToSlope(float) const;
206
207protected:
208 bool positive;
209
210 void setLinearValue(float value);
211};
212}
213#endif
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coAction.h:26
Definition: coCombinedButtonInteraction.h:22
Definition: coUIElement.h:53
objects that are derived from this class are called once per frame
Definition: coUpdateManager.h:20
Definition: coValuePoti.h:31
virtual void potiReleased(coValuePoti *poti, int context=-1)
virtual void potiValueChanged(float oldValue, float newValue, coValuePoti *poti, int context=-1)=0
virtual int getContext()
Definition: coValuePoti.h:48
virtual ~coValuePotiActor()
Definition: coValuePoti.h:33
virtual void potiPressed(coValuePoti *poti, int context=-1)
Definition: coValuePoti.h:66
float lastRoll
previous mouse orientation
Definition: coValuePoti.h:159
void setInteger(bool on)
float minValue
poti minimum value
Definition: coValuePoti.h:152
float increment
step size this poti, 0.0 if continuous
Definition: coValuePoti.h:165
coCombinedButtonInteraction * interactionA
interaction for first button
Definition: coValuePoti.h:155
void setState(float min, float max, float value, bool isInt, float inc=0.0f)
virtual void releaseRemoteLock(const char *message)
void setSize(float width, float height, float depth)
float value
current value represented by this poti
Definition: coValuePoti.h:154
void setSize(float size)
void setLogarithmic(bool on)
virtual void remoteOngoing(const char *message)
float maxValue
poti maximum value
Definition: coValuePoti.h:153
bool integer
true if adjustable value is an integer
Definition: coValuePoti.h:164
coValuePotiActor * myActor
action listener
Definition: coValuePoti.h:163
virtual void setText(const std::string &buttonText)
virtual float getYSize() const
bool labelVisible
true if label is visible
Definition: coValuePoti.h:168
virtual const char * getClassName() const
get the Element's classname
virtual void setMax(float max)
virtual float getMin() const
void setPos(float x, float y, float z=0.0f)
virtual void setEnabled(bool on)
virtual float getYpos() const
Returns element y position.
Definition: coValuePoti.h:91
float discreteValue(float value) const
virtual void remoteLock(const char *message)
std::string buttonText
value display text
Definition: coValuePoti.h:160
virtual ~coValuePoti()
virtual float getHeight() const
Returns element height.
Definition: coValuePoti.h:83
std::string baseButtonText
Definition: coValuePoti.h:161
coValuePoti(const std::string &buttonText, coValuePotiActor *actor, const std::string &backgroundTexture, vruiCOIM *cInterfaceManager=0, const std::string &interfaceName="")
float myX
poti x location
Definition: coValuePoti.h:150
virtual bool isDiscrete() const
std::string backgroundTexture
Definition: coValuePoti.h:162
virtual float getWidth() const
Returns element width.
Definition: coValuePoti.h:79
const std::string & getBackgroundTexture() const
Definition: coValuePoti.h:133
virtual float getZSize() const
virtual float getXSize() const
coCombinedButtonInteraction * interactionB
interaction for second button (fine Tune)
Definition: coValuePoti.h:156
coCombinedButtonInteraction * interactionW
wheel interaction
Definition: coValuePoti.h:157
virtual float getMax() const
void displayValue(float value)
virtual bool isLogarithmic() const
virtual int hit(vruiHit *hit)
void setIncrement(float increment)
bool unregister
true if the interaction should be unregistered
Definition: coValuePoti.h:158
virtual bool isLabelVisible()
virtual void setValue(float value)
virtual void setMin(float min)
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual bool isInteger() const
bool discrete
Definition: coValuePoti.h:166
virtual void miss()
virtual float getIncrement() const
virtual void setLabelVisible(bool)
virtual bool update()
float myY
poti y location
Definition: coValuePoti.h:151
virtual float getXpos() const
Returns element x position.
Definition: coValuePoti.h:87
const std::string & getButtonText() const
Definition: coValuePoti.h:137
virtual float getValue() const
Definition: coValuePoti.h:185
virtual void setValue(float)
float convertSlopeToLinear(float) const
virtual void setABS(bool on)
void setLinearValue(float value)
coSlopePoti(const std::string &buttonText, coValuePotiActor *actor, const std::string &backgroundTexture, vruiCOIM *cInterfaceManager=0, const std::string &interfaceName="")
virtual float getValue() const
virtual bool getABS() const
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual const char * getClassName() const
get the Element's classname
float convertLinearToSlope(float) const
bool positive
true=positive values only, false=negative values are allowed
Definition: coValuePoti.h:208
virtual bool update()
virtual void remoteOngoing(const char *message)
Definition: vruiCollabInterface.h:28
base class for collaborative Userinterface elements
Definition: vruiCollabInterface.h:46
Definition: vruiHit.h:21