OpenCOVER
coUIElement.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
20#ifndef CO_UI_ELEMENT_H
21#define CO_UI_ELEMENT_H
22
23#ifndef coMax
24#define coMax(v1, v2) ((v1) > (v2) ? (v1) : (v2))
25#endif
26
27#include <util/coTypes.h>
28
30#include <util/coTypes.h>
31
32#include <string>
33
34namespace vrui
35{
36
37class coUIContainer;
38class coUIUserData;
39
40class vruiTransformNode;
41class vruiUIElementProvider;
42
52class OPENVRUIEXPORT coUIElement
53{
54private:
55 coUIContainer *parentContainer;
56 coUIUserData *userData;
57
58 std::string Unique_Name;
59
60public:
61 // it is the callers' responsibility to delete the returned matrix by calling vruiRendererInterface::the()->deleteMatrix(matrix);
62 static vruiMatrix *getMatrixFromPositionHprScale(float x, float y, float z, float h, float p, float r, float scale);
63
66 {
67 RED = 0,
83 NUM_MATERIALS
84 };
85
87 virtual ~coUIElement();
88
89 virtual void createGeometry();
90
91 virtual void setParent(coUIContainer *);
93
94 virtual void setEnabled(bool enabled);
95 virtual void setHighlighted(bool highlighted);
96 virtual void setVisible(bool visible);
97
98 virtual bool isEnabled() const;
99 virtual bool isHighlighted() const;
100 virtual bool isVisible() const;
101
102 virtual float getWidth() const = 0;
103 virtual float getHeight() const = 0;
104 virtual float getDepth() const;
105 virtual float getXpos() const = 0;
106 virtual float getYpos() const = 0;
107 virtual float getZpos() const;
108
109 virtual void childResized(bool shrink = true);
110 virtual void resizeToParent(float, float, float, bool shrink = true);
111 virtual void shrinkToMin();
112
114 virtual void setPos(float, float, float) = 0;
115 virtual void setSize(float, float, float);
116 virtual void setSize(float);
117 virtual float getResizePref()
118 {
119 return 0.0f;
120 }
121 virtual void setUserData(coUIUserData *);
122 virtual coUIUserData *getUserData() const;
123
125
127 {
128 return uiElementProvider;
129 }
130
133 enum
134 {
135 LEFT = 0,
139 REPLACE
140 } Attachments;
141
142 virtual void setAttachment(int)
143 {
144 }
145 virtual int getAttachment() const
146 {
147 return LEFT;
148 }
149
150 void setUniqueName(const char *);
151 const char *getUniqueName() const;
152
154 virtual const char *getClassName() const;
156 virtual bool isOfClassName(const char *) const;
157
158protected:
159 virtual void resizeGeometry();
160
164 bool enabled;
166 bool visible;
167
169
171
172private:
173 vruiMatrix *transformMatrix;
174};
175}
176#endif
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coUIContainer.h:24
Definition: coUIElement.h:53
virtual void setPos(float, float, float)=0
bool visible
true if UI element is visible, false if not visible but still present in scene tree
Definition: coUIElement.h:166
float zScaleFactor
UI element z axis scale factor.
Definition: coUIElement.h:163
virtual void setParent(coUIContainer *)
virtual coUIContainer * getParent()
virtual void shrinkToMin()
Set element location in space.
float yScaleFactor
UI element y axis scale factor.
Definition: coUIElement.h:162
virtual void setUserData(coUIUserData *)
bool highlighted
true if highlighted
Definition: coUIElement.h:165
virtual void createGeometry()
float xScaleFactor
UI element x axis scale factor.
Definition: coUIElement.h:161
virtual float getHeight() const =0
Returns element height.
void setUniqueName(const char *)
virtual void childResized(bool shrink=true)
virtual float getDepth() const
virtual void setAttachment(int)
sets the attachment border
Definition: coUIElement.h:142
Material
Color definitions, to be used whenever a material is needed.
Definition: coUIElement.h:66
@ HANDLE_BACKGROUND_HIGHLIGHTED
Definition: coUIElement.h:80
@ ITEM_BACKGROUND_NORMAL
Definition: coUIElement.h:76
@ BACKGROUND
Definition: coUIElement.h:82
@ BLUE
Definition: coUIElement.h:69
@ WHITE
Definition: coUIElement.h:72
@ WHITE_NL
self illuminated white (NL = no lighting)
Definition: coUIElement.h:75
@ ITEM_BACKGROUND_DISABLED
Definition: coUIElement.h:78
@ YELLOW
Definition: coUIElement.h:70
@ ITEM_BACKGROUND_HIGHLIGHTED
Definition: coUIElement.h:77
@ HANDLE_BACKGROUND_NORMAL
Definition: coUIElement.h:79
@ BLACK
Definition: coUIElement.h:73
@ HANDLE_BACKGROUND_DISABLED
Definition: coUIElement.h:81
@ GREY
Definition: coUIElement.h:71
@ GREEN
Definition: coUIElement.h:68
@ DARK_YELLOW
Definition: coUIElement.h:74
virtual bool isEnabled() const
virtual float getZpos() const
static vruiMatrix * getMatrixFromPositionHprScale(float x, float y, float z, float h, float p, float r, float scale)
virtual void setSize(float)
virtual const vruiMatrix * getTransformMatrix()
virtual void setHighlighted(bool highlighted)
virtual bool isVisible() const
virtual coUIUserData * getUserData() const
virtual int getAttachment() const
returns the attachment border
Definition: coUIElement.h:145
virtual float getXpos() const =0
Returns element x position.
virtual ~coUIElement()
virtual float getWidth() const =0
Returns element width.
virtual vruiTransformNode * getDCS()
virtual bool isOfClassName(const char *) const
check if the Element or any ancestor is this classname
virtual float getYpos() const =0
Returns element y position.
virtual vruiUIElementProvider * getUIElementProvider() const
Definition: coUIElement.h:126
bool enabled
true if UI element is enabled, false if UI element cannot be used
Definition: coUIElement.h:164
const char * getUniqueName() const
virtual void setVisible(bool visible)
virtual void resizeToParent(float, float, float, bool shrink=true)
virtual bool isHighlighted() const
virtual float getResizePref()
Definition: coUIElement.h:117
vruiUIElementProvider * uiElementProvider
Definition: coUIElement.h:170
virtual void setEnabled(bool enabled)
virtual void setSize(float, float, float)
virtual void resizeGeometry()
virtual const char * getClassName() const
get the Element's classname
@ RIGHT
Definition: coUIElement.h:137
@ BOTTOM
Definition: coUIElement.h:138
@ TOP
Definition: coUIElement.h:136
Definition: coUIUserData.h:18
Definition: vruiMatrix.h:20
Definition: vruiTransformNode.h:18
Definition: vruiUIElementProvider.h:23