SCV  4.2.1
Simple Components for Visual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ComboBox.h
Go to the documentation of this file.
1 
7 #ifndef __SCV_COMBOBOX_H__
8 #define __SCV_COMBOBOX_H__
9 
10 #include "Button.h"
11 #include "ContextMenu.h"
12 
13 namespace scv {
14 
15 class ComboBox : public Button {
16 friend class ComboBoxMenuStyle;
17 public:
18  //ComboBox(const scv::Point &p1, const scv::Point &p2);
19  ComboBox(const scv::Point &p, unsigned int width);
20  virtual ~ComboBox(void);
21 
22  virtual void onSelectionChanged(std::string address, int id);
23 
24  std::string getValue(void);
25 
26  int getIndex(void);
27  void setIndex(int offset);
28 
29  void setItems(const std::vector<std::string>& items);
30  void addItem(const std::string& str);
31 
32  void popupMenu(void);
33  void popMenu(void);
34 
35  void clear();
36 
37  virtual void display(void);
38 
39 protected:
40  class ComboBoxMenu : public ContextMenu {
41  public:
43 
44  void onMenuAccessed(const std::deque<std::string> &address);
45  void onStatusChange(void);
46 
47  void setItems(const std::vector<std::string>& items);
48  void addItem(const std::string item);
49 
51  };
52 
53  void createTexture(void);
54  void processMouse(const scv::MouseEvent &evt);
55 
56  void select(const std::string& value);
57 
59 
60  bool _active;
62  std::vector<std::string> _values;
63 };
64 
65 } // namespace scv
66 
67 #endif // __SCV_COMBOBOX_H__