DropDownList.pkg 1.6 KB

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