OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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>
13 #include <OpenVRUI/coUIElement.h>
14 
15 namespace vrui
16 {
17 
18 class coRotButton;
19 
20 class vruiTransformNode;
21 
23 class OPENVRUIEXPORT coRotButtonActor
24 {
25 public:
26  virtual ~coRotButtonActor(){};
27  virtual void buttonEvent(coRotButton *button) = 0;
28 };
29 
35 class OPENVRUIEXPORT coRotButton : public coAction, public coUIElement
36 {
37 public:
39  virtual ~coRotButton();
40 
41  void setState(bool state, bool generateEvent = false);
42  bool getState() const;
43 
44  void updateSwitch();
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 
87  virtual vruiTransformNode *getDCS();
88 
90  virtual const char *getClassName() const;
92  virtual bool isOfClassName(const char *) const;
93 
94 protected:
96  bool pressState;
100  float myX;
101  float myY;
102  float myZ;
103 
106  float rotation;
107  bool active_;
108 };
109 
115 {
116 public:
118  virtual ~coRotPushButton();
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 {
136 public:
138  virtual ~coRotToggleButton();
139  virtual void onPress();
140 
142  virtual const char *getClassName() const;
144  virtual bool isOfClassName(const char *) const;
145 };
146 }
147 #endif
float myY
button y position
Definition: coRotButton.h:101
virtual void onPress()
float myX
button x position
Definition: coRotButton.h:100
bool wasReleased
Definition: coRotButton.h:97
Definition: coRotButton.h:35
float myZ
button z position
Definition: coRotButton.h:102
virtual void miss()
Definition: vruiHit.h:20
virtual const char * getClassName() const
get the Element&#39;s classname
virtual float getXpos() const
Returns element x position.
Definition: coRotButton.h:71
coRotButtonActor * myActor
action listener, triggered on button press
Definition: coRotButton.h:99
Definition: vruiTransformNode.h:17
vruiTransformNode * rotationDCS
Definition: coRotButton.h:105
Definition: coRotButton.h:134
virtual void onPress()
coButtonGeometry * myGeometry
information about visual appearance
Definition: coRotButton.h:98
float rotation
rotation in degrees off ??? orientation
Definition: coRotButton.h:106
bool active_
flag if button is active
Definition: coRotButton.h:107
Definition: coAction.h:25
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual float getZpos() const
Definition: coRotButton.h:79
virtual float getHeight() const
Returns element height.
Definition: coRotButton.h:66
bool pressState
true if the button is currently pressed
Definition: coRotButton.h:96
virtual float getWidth() const
Returns element width.
Definition: coRotButton.h:62
virtual void onRelease()
Definition: coRotButton.h:114
virtual ~coRotPushButton()
virtual const char * getClassName() const
get the Element&#39;s classname
coRotPushButton(coButtonGeometry *geometry, coRotButtonActor *actor)
virtual float getYpos() const
Returns element y position.
Definition: coRotButton.h:75
Definition: coButtonGeometry.h:26
vruiTransformNode * myDCS
Definition: coRotButton.h:104
Definition: coUIElement.h:52
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
Action listener for events triggered by coButton.
Definition: coRotButton.h:23
coRotToggleButton(coButtonGeometry *geometry, coRotButtonActor *actor)
bool selectionState
true if button is selected by the user
Definition: coRotButton.h:95
virtual ~coRotButtonActor()
Definition: coRotButton.h:26