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
5 #ifndef __I_GUI_COMBO_BOX_H_INCLUDED__
\r
6 #define __I_GUI_COMBO_BOX_H_INCLUDED__
\r
8 #include "IGUIElement.h"
\r
16 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
\r
17 \li EGET_COMBO_BOX_CHANGED
\r
19 class IGUIComboBox : public IGUIElement
\r
24 IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
\r
25 : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
\r
27 //! Returns amount of items in box
\r
28 virtual u32 getItemCount() const = 0;
\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
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
36 //! Returns index based on item data
\r
37 virtual s32 getIndexForItemData(u32 data ) const = 0;
\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
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
46 //! Deletes all items in the combo box
\r
47 virtual void clear() = 0;
\r
49 //! Returns id of selected item. returns -1 if no item is selected.
\r
50 virtual s32 getSelected() const = 0;
\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
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
62 //! Set the maximal number of rows for the selection listbox
\r
63 virtual void setMaxSelectionRows(u32 max) = 0;
\r
65 //! Get the maximal number of rows for the selection listbox
\r
66 virtual u32 getMaxSelectionRows() const = 0;
\r
70 } // end namespace gui
\r
71 } // end namespace irr
\r