ListView.pkg 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. $#include "ListView.h"
  2. enum HighlightMode
  3. {
  4. HM_NEVER,
  5. HM_FOCUS,
  6. HM_ALWAYS
  7. };
  8. class ListView : public ScrollView
  9. {
  10. public:
  11. // Methods:
  12. ListView(Context* context);
  13. virtual ~ListView();
  14. void AddItem(UIElement* item);
  15. void InsertItem(unsigned index, UIElement* item, UIElement* parentItem = 0);
  16. void InsertItem(unsigned index, UIElement* item);
  17. void RemoveItem(UIElement* item, unsigned index = 0);
  18. void RemoveItem(UIElement* item);
  19. void RemoveItem(unsigned index);
  20. void RemoveAllItems();
  21. void SetSelection(unsigned index);
  22. void AddSelection(unsigned index);
  23. void RemoveSelection(unsigned index);
  24. void ToggleSelection(unsigned index);
  25. void ChangeSelection(int delta, bool additive = false);
  26. void ChangeSelection(int delta);
  27. void ClearSelection();
  28. void SetHighlightMode(HighlightMode mode);
  29. void SetMultiselect(bool enable);
  30. void SetHierarchyMode(bool enable);
  31. void SetBaseIndent(int baseIndent);
  32. void SetClearSelectionOnDefocus(bool enable);
  33. void SetDoubleClickInterval(float interval);
  34. void Expand(unsigned index, bool enable, bool recursive = false);
  35. void Expand(unsigned index, bool enable);
  36. void ToggleExpand(unsigned index, bool recursive = false);
  37. void ToggleExpand(unsigned index);
  38. unsigned GetNumItems() const;
  39. UIElement* GetItem(unsigned index) const;
  40. unsigned FindItem(UIElement* item) const;
  41. unsigned GetSelection() const;
  42. UIElement* GetSelectedItem() const;
  43. bool IsSelected(unsigned index) const;
  44. bool IsExpanded(unsigned index) const;
  45. HighlightMode GetHighlightMode() const;
  46. bool GetMultiselect() const;
  47. bool GetClearSelectionOnDefocus() const;
  48. bool GetHierarchyMode() const;
  49. int GetBaseIndent() const;
  50. float GetDoubleClickInterval() const;
  51. // Properties:
  52. tolua_readonly tolua_property__get_set unsigned numItems;
  53. tolua_property__get_set unsigned selection;
  54. tolua_readonly tolua_property__get_set UIElement* selectedItem;
  55. tolua_property__get_set HighlightMode highlightMode;
  56. tolua_property__get_set bool multiselect;
  57. tolua_property__get_set bool clearSelectionOnDefocus;
  58. tolua_property__get_set bool hierarchyMode;
  59. tolua_property__get_set int baseIndent;
  60. tolua_property__get_set float doubleClickInterval;
  61. };