OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OSGVruiToggleButtonGeometry.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 OSG_VRUI_TOGGLE_BUTTON_GEOMETRY_H
9 #define OSG_VRUI_TOGGLE_BUTTON_GEOMETRY_H
10 
12 
13 #include <osg/Array>
14 #include <osg/Geode>
15 #include <osg/StateSet>
16 #include <osg/Switch>
17 #include <osg/Texture2D>
18 #include <osg/Vec3>
19 
20 #include <string>
21 
22 namespace vrui
23 {
24 
25 class coToggleButtonGeometry;
26 class OSGVruiTransformNode;
27 
28 class OSGVRUIEXPORT OSGVruiToggleButtonGeometry : public vruiButtonProvider
29 {
30 public:
32  virtual ~OSGVruiToggleButtonGeometry();
33  virtual float getWidth() const
34  {
35  return A;
36  }
37  virtual float getHeight() const
38  {
39  return A;
40  }
41 
42  virtual void switchGeometry(coButtonGeometry::ActiveGeometry active);
43 
44  virtual void createGeometry();
45  virtual void resizeGeometry();
46 
47  virtual vruiTransformNode *getDCS();
48 
49 protected:
50  // create Texture, either normal or checked
51  osg::ref_ptr<osg::Geode> createNode(const std::string &textureName, bool checkTexture);
52 
53  void createSharedLists();
54 
55  // kept for compatibility only! They re-call createTexture()
56  osg::ref_ptr<osg::Geode> createBox(const std::string &textureName);
57  osg::ref_ptr<osg::Geode> createCheck(const std::string &textureName);
58 
59  osg::ref_ptr<osg::Node> normalNode;
60  osg::ref_ptr<osg::Node> pressedNode;
61  osg::ref_ptr<osg::Node> highlightNode;
62  osg::ref_ptr<osg::Node> pressedHighlightNode;
64  osg::ref_ptr<osg::Node> disabledNode;
65 
66  osg::ref_ptr<osg::Switch> switchNode;
67 
69 
71 
72 private:
73  //shared coord and color list
74  static float A;
75  static float B;
76  static float D;
77  static osg::ref_ptr<osg::Vec3Array> coord;
78  static osg::ref_ptr<osg::Vec3Array> normal;
79  static osg::ref_ptr<osg::Vec2Array> texCoord;
80 
81  osg::ref_ptr<osg::Texture2D> texture;
82 };
83 }
84 #endif
osg::ref_ptr< osg::Switch > switchNode
Definition: OSGVruiToggleButtonGeometry.h:66
osg::ref_ptr< osg::Node > normalNode
normal geometry
Definition: OSGVruiToggleButtonGeometry.h:59
virtual float getWidth() const
Definition: OSGVruiToggleButtonGeometry.h:33
Definition: vruiTransformNode.h:17
Definition: vruiButtonProvider.h:20
ActiveGeometry
Definition: coButtonGeometry.h:32
Definition: coToggleButtonGeometry.h:18
coToggleButtonGeometry * button
Definition: OSGVruiToggleButtonGeometry.h:68
osg::ref_ptr< osg::Node > highlightNode
pressed highlighted geometry
Definition: OSGVruiToggleButtonGeometry.h:61
OSGVruiTransformNode * myDCS
Definition: OSGVruiToggleButtonGeometry.h:70
Definition: OSGVruiTransformNode.h:25
virtual float getHeight() const
Definition: OSGVruiToggleButtonGeometry.h:37
Definition: OSGVruiToggleButtonGeometry.h:28
osg::ref_ptr< osg::Node > disabledNode
Definition: OSGVruiToggleButtonGeometry.h:64
osg::ref_ptr< osg::Node > pressedNode
pressed normal geometry
Definition: OSGVruiToggleButtonGeometry.h:60