14 #ifndef OSGUI_COMBOBOX
15 #define OSGUI_COMBOBOX
17 #include <osgUI/Popup>
19 #include <osgText/Text>
28 Item() : _color(1.0f,1.0f,1.0f,0.0f) {}
29 Item(
const std::string& str) : _text(str), _color(1.0f,1.0f,1.0f,0.0f) {}
30 Item(
const std::string& str,
const osg::Vec4& col) : _text(str), _color(col) {}
37 void setText(
const std::string& text) { _text = text; }
39 const std::string&
getText()
const {
return _text; }
61 void setItem(
unsigned int i,
Item* item) { _items[i] = item; dirty(); }
63 const Item*
getItem(
unsigned int i)
const {
return _items[i].get(); }
65 void clear() { _items.clear(); dirty(); }
66 void removeItem(
unsigned int i) { _items.erase(_items.begin()+i); dirty(); }
67 unsigned int getNumItems() {
return static_cast<unsigned int>(_items.size()); }
69 typedef std::vector< osg::ref_ptr<Item> >
Items;
71 void setItems(
const Items& items) { _items = items; }
73 const Items&
getItems()
const {
return _items; }
75 void setCurrentIndex(
unsigned int i);
78 virtual void currrentIndexChanged(
unsigned int i);
79 virtual void currentIndexChangedImplementation(
unsigned int i);
83 virtual void createGraphicsImplementation();
84 virtual void enterImplementation();
85 virtual void leaveImplementation();
const Item * getItem(unsigned int i) const
osg::Vec3d _popupItemSize
Item * getItem(unsigned int i)
void setText(const std::string &text)
Item(const Item &item, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
osg::ref_ptr< osgUI::Popup > _popup
#define META_Node(library, name)
unsigned int _currentIndex
void removeItem(unsigned int i)
void setItems(const Items &items)
void setItem(unsigned int i, Item *item)
osg::ref_ptr< osg::Switch > _backgroundSwitch
#define META_Object(library, name)
void setColor(const osg::Vec4f &color)
const osg::Vec4f & getColor() const
std::vector< osg::ref_ptr< Item > > Items
Item(const std::string &str)
unsigned int getCurrentIndex() const
osg::ref_ptr< osg::Switch > _buttonSwitch
Item(const std::string &str, const osg::Vec4 &col)
Item(const osg::Vec4 &col)
const Items & getItems() const
unsigned int getNumItems()
const std::string & getText() const
osg::Vec3d _popupItemOrigin