IGUIComboBox.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #ifndef IRR_I_GUI_COMBO_BOX_H_INCLUDED
  5. #define IRR_I_GUI_COMBO_BOX_H_INCLUDED
  6. #include "IGUIElement.h"
  7. namespace irr
  8. {
  9. namespace gui
  10. {
  11. //! Combobox widget
  12. /** \par This element can create the following events of type EGUI_EVENT_TYPE:
  13. \li EGET_COMBO_BOX_CHANGED
  14. */
  15. class IGUIComboBox : public IGUIElement
  16. {
  17. public:
  18. //! constructor
  19. IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
  20. : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
  21. //! Returns amount of items in box
  22. virtual u32 getItemCount() const = 0;
  23. //! Returns string of an item. the idx may be a value from 0 to itemCount-1
  24. virtual const wchar_t* getItem(u32 idx) const = 0;
  25. //! Returns item data of an item. the idx may be a value from 0 to itemCount-1
  26. virtual u32 getItemData(u32 idx) const = 0;
  27. //! Returns index based on item data
  28. virtual s32 getIndexForItemData(u32 data ) const = 0;
  29. //! Adds an item and returns the index of it
  30. virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;
  31. //! Removes an item from the combo box.
  32. /** Warning. This will change the index of all following items */
  33. virtual void removeItem(u32 idx) = 0;
  34. //! Deletes all items in the combo box
  35. virtual void clear() = 0;
  36. //! Returns id of selected item. returns -1 if no item is selected.
  37. virtual s32 getSelected() const = 0;
  38. //! Sets the selected item. Set this to -1 if no item should be selected
  39. virtual void setSelected(s32 idx) = 0;
  40. //! Sets text justification of the text area
  41. /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
  42. EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text.
  43. \param vertical: EGUIA_UPPERLEFT to align with top edge,
  44. EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
  45. virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
  46. //! Set the maximal number of rows for the selection listbox
  47. virtual void setMaxSelectionRows(u32 max) = 0;
  48. //! Get the maximal number of rows for the selection listbox
  49. virtual u32 getMaxSelectionRows() const = 0;
  50. };
  51. } // end namespace gui
  52. } // end namespace irr
  53. #endif