OpenCOVER
coRotButton.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_VOL_ROTBUTTON_H
9#define CO_VOL_ROTBUTTON_H
10
11#include <OpenVRUI/coAction.h>
14
15namespace vrui
16{
17
18class coRotButton;
19
20class vruiTransformNode;
21
23class OPENVRUIEXPORT coRotButtonActor
24{
25public:
26 virtual ~coRotButtonActor(){};
27 virtual void buttonEvent(coRotButton *button) = 0;
28};
29
35class OPENVRUIEXPORT coRotButton : public coAction, public coUIElement
36{
37public:
39 virtual ~coRotButton();
40
41 void setState(bool state, bool generateEvent = false);
42 bool getState() const;
43
45 bool isPressed() const;
46
47 virtual int hit(vruiHit *hit);
48 virtual void miss();
49
50 virtual void onPress();
51 virtual void onRelease();
52
53 void setPos(float x, float y, float z = 0.0f);
54 virtual void setSize(float x, float y, float z);
55 virtual void setSize(float size);
56
57 virtual void setRotation(float rotation);
58
60 virtual void setActive(bool a);
61
62 virtual float getWidth() const
63 {
64 return myGeometry->getWidth() * xScaleFactor;
65 }
66 virtual float getHeight() const
67 {
68 return myGeometry->getHeight() * yScaleFactor;
69 }
70
71 virtual float getXpos() const
72 {
73 return myX;
74 }
75 virtual float getYpos() const
76 {
77 return myY;
78 }
79 virtual float getZpos() const
80 {
81 return myZ;
82 }
83
84 virtual void createGeometry();
85 virtual void resizeGeometry();
86
88
90 virtual const char *getClassName() const;
92 virtual bool isOfClassName(const char *) const;
93
94protected:
100 float myX;
101 float myY;
102 float myZ;
103
106 float rotation;
107 bool active_;
108};
109
115{
116public:
119 virtual void onPress();
120 virtual void onRelease();
121 virtual void miss();
122
124 virtual const char *getClassName() const;
126 virtual bool isOfClassName(const char *) const;
127};
128
135{
136public:
139 virtual void onPress();
140
142 virtual const char *getClassName() const;
144 virtual bool isOfClassName(const char *) const;
145};
146}
147#endif
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coAction.h:26
Definition: coButtonGeometry.h:27
Action listener for events triggered by coButton.
Definition: coRotButton.h:24
virtual ~coRotButtonActor()
Definition: coRotButton.h:26
virtual void buttonEvent(coRotButton *button)=0
Definition: coRotButton.h:36
coRotButton(coButtonGeometry *geometry, coRotButtonActor *actor)
virtual void createGeometry()
float myX
button x position
Definition: coRotButton.h:100
virtual void onRelease()
vruiTransformNode * rotationDCS
Definition: coRotButton.h:105
void setPos(float x, float y, float z=0.0f)
coRotButtonActor * myActor
action listener, triggered on button press
Definition: coRotButton.h:99
virtual void onPress()
virtual ~coRotButton()
virtual const char * getClassName() const
get the Element's classname
virtual void setRotation(float rotation)
void setState(bool state, bool generateEvent=false)
float myY
button y position
Definition: coRotButton.h:101
vruiTransformNode * myDCS
Definition: coRotButton.h:104
virtual float getYpos() const
Returns element y position.
Definition: coRotButton.h:75
virtual void setSize(float x, float y, float z)
float rotation
rotation in degrees off ??? orientation
Definition: coRotButton.h:106
virtual float getXpos() const
Returns element x position.
Definition: coRotButton.h:71
virtual void miss()
bool pressState
true if the button is currently pressed
Definition: coRotButton.h:96
virtual float getZpos() const
Definition: coRotButton.h:79
bool active_
flag if button is active
Definition: coRotButton.h:107
float myZ
button z position
Definition: coRotButton.h:102
coButtonGeometry * myGeometry
information about visual appearance
Definition: coRotButton.h:98
bool wasReleased
Definition: coRotButton.h:97
bool getState() const
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual void setActive(bool a)
functions activates or deactivates the item
bool isPressed() const
virtual int hit(vruiHit *hit)
virtual void resizeGeometry()
virtual void setSize(float size)
virtual vruiTransformNode * getDCS()
bool selectionState
true if button is selected by the user
Definition: coRotButton.h:95
virtual float getWidth() const
Returns element width.
Definition: coRotButton.h:62
virtual float getHeight() const
Returns element height.
Definition: coRotButton.h:66
Definition: coRotButton.h:115
coRotPushButton(coButtonGeometry *geometry, coRotButtonActor *actor)
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual ~coRotPushButton()
virtual void onRelease()
virtual const char * getClassName() const
get the Element's classname
virtual void miss()
virtual void onPress()
Definition: coRotButton.h:135
coRotToggleButton(coButtonGeometry *geometry, coRotButtonActor *actor)
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual void onPress()
virtual const char * getClassName() const
get the Element's classname
Definition: coUIElement.h:53
Definition: vruiHit.h:21
Definition: vruiTransformNode.h:18