aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h
new file mode 100644
index 0000000..3d020ac
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CGUIComboBox.h
@@ -0,0 +1,117 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_GUI_COMBO_BOX_H_INCLUDED__
6#define __C_GUI_COMBO_BOX_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9#ifdef _IRR_COMPILE_WITH_GUI_
10
11#include "IGUIComboBox.h"
12#include "IGUIStaticText.h"
13#include "irrString.h"
14#include "irrArray.h"
15
16namespace irr
17{
18namespace gui
19{
20 class IGUIButton;
21 class IGUIListBox;
22
23 //! Single line edit box for editing simple text.
24 class CGUIComboBox : public IGUIComboBox
25 {
26 public:
27
28 //! constructor
29 CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
30 s32 id, core::rect<s32> rectangle);
31
32 //! Returns amount of items in box
33 virtual u32 getItemCount() const;
34
35 //! returns string of an item. the idx may be a value from 0 to itemCount-1
36 virtual const wchar_t* getItem(u32 idx) const;
37
38 //! Returns item data of an item. the idx may be a value from 0 to itemCount-1
39 virtual u32 getItemData(u32 idx) const;
40
41 //! Returns index based on item data
42 virtual s32 getIndexForItemData( u32 data ) const;
43
44 //! adds an item and returns the index of it
45 virtual u32 addItem(const wchar_t* text, u32 data);
46
47 //! Removes an item from the combo box.
48 virtual void removeItem(u32 id);
49
50 //! deletes all items in the combo box
51 virtual void clear();
52
53 //! returns the text of the currently selected item
54 virtual const wchar_t* getText() const;
55
56 //! returns id of selected item. returns -1 if no item is selected.
57 virtual s32 getSelected() const;
58
59 //! sets the selected item. Set this to -1 if no item should be selected
60 virtual void setSelected(s32 idx);
61
62 //! sets the text alignment of the text part
63 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
64
65 //! Set the maximal number of rows for the selection listbox
66 virtual void setMaxSelectionRows(u32 max);
67
68 //! Get the maximimal number of rows for the selection listbox
69 virtual u32 getMaxSelectionRows() const;
70
71 //! called if an event happened.
72 virtual bool OnEvent(const SEvent& event);
73
74 //! draws the element and its children
75 virtual void draw();
76
77 //! Writes attributes of the element.
78 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
79
80 //! Reads attributes of the element
81 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
82
83 private:
84
85 void openCloseMenu();
86 void sendSelectionChangedEvent();
87
88 IGUIButton* ListButton;
89 IGUIStaticText* SelectedText;
90 IGUIListBox* ListBox;
91 IGUIElement *LastFocus;
92
93
94 struct SComboData
95 {
96 SComboData ( const wchar_t * text, u32 data )
97 : Name (text), Data ( data ) {}
98
99 core::stringw Name;
100 u32 Data;
101 };
102 core::array< SComboData > Items;
103
104 s32 Selected;
105 EGUI_ALIGNMENT HAlign, VAlign;
106 u32 MaxSelectionRows;
107 bool HasFocus;
108 };
109
110
111} // end namespace gui
112} // end namespace irr
113
114#endif // _IRR_COMPILE_WITH_GUI_
115
116#endif // __C_GUI_COMBO_BOX_H_INCLUDED__
117