17 #include <vreckoUtils/Export>
27 static void createMenuItem( std::ostringstream& menuSS,
const char* itemName,
const char* caption, osg::Vec3 color = osg::Vec3(0.9f, 0.8f, 0.8f) );
28 static void createMenuSlider(std::ostringstream& menuSS,
const char* itemName,
const char* caption,
double sliderFrom,
29 double sliderTo,
bool integerOnly,
double sliderPos, osg::Vec3 color = osg::Vec3(0.9f, 0.8f, 0.8f));
35 virtual std::string toXMLString() = 0;
36 virtual std::string getName() = 0;
37 virtual std::string getCaption() = 0;
47 std::vector<osg::ref_ptr<IMenuComponent>>
_items;
50 void addChild(osg::ref_ptr<IMenuComponent> menuComponent) {
51 _items.push_back(menuComponent);
55 _items.erase(_items.begin() + index);
58 if(index < 0 || index >= _items.size())
70 virtual std::string toXMLString();
72 virtual std::string
getName() {
return ""; };
76 _attributes[name] = value;
79 bool removeAttribute(
const std::string& name)
81 return _attributes.erase(name) == 1;
92 Menu(
string name =
"",
string caption=
"") : _menuName(name), _menuCaption(caption) {};
94 virtual std::string toXMLString();
116 MenuItem(
string name,
string caption, osg::Vec3 color = osg::Vec3(0.9f, 0.8f, 0.8f)) :
117 _itemName(name), _itemCaption(caption), _color(color) {};
118 MenuItem(
string name,
string caption, osg::Vec4 color) :
119 _itemName(name), _itemCaption(caption), _color(color._v[0], color._v[1], color._v[2]) {};
121 virtual std::string toXMLString();
144 MenuSlider(
string name,
string caption,
double from,
double to,
145 double value,
bool onlyInt, osg::Vec3 color = osg::Vec3(0.9f, 0.8f, 0.8f)) :
146 _sliderName(name), _sliderCaption(caption), _from(from), _to(to),
147 _value(value), _onlyInt(onlyInt), _color(color) {};
149 virtual std::string toXMLString();
156 return _sliderCaption;