vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Icon.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "GUI_item.h"
4 #include "ItemsGroup.h"
5 
6 # ifdef GUI_LIBRARY
7 # define GUI_EXPORT __declspec(dllexport)
8 # else
9 # define GUI_EXPORT __declspec(dllimport)
10 #endif
11 
12 
13 
14 using namespace vrecko;
15 
16 namespace APGUI
17 {
18 
19 
21 typedef enum IconType {
25 };
26 
28 //typedef enum IconState {
29 // ICON__BASIC,
30 // ICON__HOVERED,
31 // ICON__HOVERED_PRESSED,
32 // ICON__PRESSED,
33 //};
34 
35 
36 
38 
46 class GUI_EXPORT Icon : public GUI_Item
47 {
48 public:
49 
50  Icon();
51  ~Icon();
52 
61  bool initialize(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parametersNode);
62 
74  bool initialize(string name, string receiver, string label, string tooltip, string group, osg::Vec3 position = osg::Vec3() );
75 
77  bool processAction( const int sensorNumber, const GUI_ACTION action, const bool pressed);
78 
79 
80  // Called when user pointed to this icon with some sensor
81  void pointed(bool pointed);
82 
83 
84  //TODO Remove this function
86 
89  //void setState(bool active);
90 
91  void setState(GUI_ITEM_STATE newState);
92 
93  // not just very effective, but working
94  // if part with given name is not found, nothing happens
95  void setPartColour(string partName, osg::Vec4 newColour);
96 
97 
98 protected:
99 
102 
104  //bool _switchActive;
105 
107  //bool _switchActive_HullColourChange;
108 
110 
111  // should icon send extra message (event), that it should be deactivated by receiver
113 
115  osg::Switch *_models;
116 
117  // Load models of different states of Icon
118  // Called from initialize
119  bool createModels( string basicModelString, string hullModelString );
120 
122  bool postInitialize(string name, string receiver, string label, string tooltip, string group, osg::Vec3 position );
123 
124 
126  void switchVisuals();
127 
128 
129  DECLARE_OUTPUT(GUIItemClicked, MessageString);
130 
131  //icon want to be deactivated (switched to default state) externaly - by receiver
132  DECLARE_OUTPUT(ExternalDeactivation, MessageObjectID);
133 
135  osg::Vec3 _initialScale;
136 
137 };
138 
139 }