DropDownList.pkg 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. $#include "DropDownList.h"
  2. /// %Menu %UI element that displays a popup list view.
  3. class DropDownList : public Menu
  4. {
  5. public:
  6. /// Construct.
  7. DropDownList(Context* context);
  8. /// Destruct.
  9. ~DropDownList();
  10. /// Add item to the end of the list.
  11. void AddItem(UIElement* item);
  12. /// Insert item to a specific position.
  13. void InsertItem(unsigned index, UIElement* item);
  14. /// Remove specific item.
  15. void RemoveItem(UIElement* item);
  16. /// Remove item at index.
  17. void RemoveItem(unsigned index);
  18. /// Remove all items.
  19. void RemoveAllItems();
  20. /// Set selection.
  21. void SetSelection(unsigned index);
  22. /// Set place holder text. This is the text shown when there is no selection in drop down list.
  23. void SetPlaceholderText(const String& text);
  24. /// Set whether popup should be automatically resized to match the dropdown button width.
  25. void SetResizePopup(bool enable);
  26. /// Return number of items.
  27. unsigned GetNumItems() const;
  28. /// Return item at index.
  29. UIElement* GetItem(unsigned index) const;
  30. /// Return selection index, or M_MAX_UNSIGNED if none selected.
  31. unsigned GetSelection() const;
  32. /// Return selected item, or null if none selected.
  33. UIElement* GetSelectedItem() const;
  34. /// Return listview element.
  35. ListView* GetListView() const { return listView_; }
  36. /// Return selected item placeholder element.
  37. UIElement* GetPlaceholder() const { return placeholder_; }
  38. /// Return place holder text.
  39. const String& GetPlaceholderText() const;
  40. /// Return whether popup should be automatically resized.
  41. bool GetResizePopup() const { return resizePopup_; }
  42. };