]> git.lizzy.rs Git - irrlicht.git/blob - include/IGUIComboBox.h
8d23834119be1c6abfd5251c3188a5ce10a9be76
[irrlicht.git] / include / IGUIComboBox.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_GUI_COMBO_BOX_H_INCLUDED__\r
6 #define __I_GUI_COMBO_BOX_H_INCLUDED__\r
7 \r
8 #include "IGUIElement.h"\r
9 \r
10 namespace irr\r
11 {\r
12 namespace gui\r
13 {\r
14 \r
15         //! Combobox widget\r
16         /** \par This element can create the following events of type EGUI_EVENT_TYPE:\r
17         \li EGET_COMBO_BOX_CHANGED\r
18         */\r
19         class IGUIComboBox : public IGUIElement\r
20         {\r
21         public:\r
22 \r
23                 //! constructor\r
24                 IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)\r
25                         : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}\r
26 \r
27                 //! Returns amount of items in box\r
28                 virtual u32 getItemCount() const = 0;\r
29 \r
30                 //! Returns string of an item. the idx may be a value from 0 to itemCount-1\r
31                 virtual const wchar_t* getItem(u32 idx) const = 0;\r
32 \r
33                 //! Returns item data of an item. the idx may be a value from 0 to itemCount-1\r
34                 virtual u32 getItemData(u32 idx) const = 0;\r
35 \r
36                 //! Returns index based on item data\r
37                 virtual s32 getIndexForItemData(u32 data ) const = 0;\r
38 \r
39                 //! Adds an item and returns the index of it\r
40                 virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;\r
41 \r
42                 //! Removes an item from the combo box.\r
43                 /** Warning. This will change the index of all following items */\r
44                 virtual void removeItem(u32 idx) = 0;\r
45 \r
46                 //! Deletes all items in the combo box\r
47                 virtual void clear() = 0;\r
48 \r
49                 //! Returns id of selected item. returns -1 if no item is selected.\r
50                 virtual s32 getSelected() const = 0;\r
51 \r
52                 //! Sets the selected item. Set this to -1 if no item should be selected\r
53                 virtual void setSelected(s32 idx) = 0;\r
54 \r
55                 //! Sets text justification of the text area\r
56                 /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),\r
57                 EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.\r
58                 \param vertical: EGUIA_UPPERLEFT to align with top edge,\r
59                 EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */\r
60                 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;\r
61 \r
62                 //! Set the maximal number of rows for the selection listbox\r
63                 virtual void setMaxSelectionRows(u32 max) = 0;\r
64 \r
65                 //! Get the maximal number of rows for the selection listbox\r
66                 virtual u32 getMaxSelectionRows() const = 0;\r
67         };\r
68 \r
69 \r
70 } // end namespace gui\r
71 } // end namespace irr\r
72 \r
73 #endif\r
74 \r