ListView.pkg 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. $#include "UI/ListView.h"
  2. enum HighlightMode
  3. {
  4. HM_NEVER,
  5. HM_FOCUS,
  6. HM_ALWAYS
  7. };
  8. class HierarchyContainer : public UIElement
  9. {
  10. };
  11. class ListView : public ScrollView
  12. {
  13. ListView();
  14. virtual ~ListView();
  15. void AddItem(UIElement* item);
  16. void InsertItem(unsigned index, UIElement* item, UIElement* parentItem = 0);
  17. void RemoveItem(UIElement* item, unsigned index = 0);
  18. void RemoveItem(unsigned index);
  19. void RemoveAllItems();
  20. void SetSelection(unsigned index);
  21. void SetSelections(const PODVector<unsigned>& indices);
  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 ClearSelection();
  27. void SetHighlightMode(HighlightMode mode);
  28. void SetMultiselect(bool enable);
  29. void SetHierarchyMode(bool enable);
  30. void SetBaseIndent(int baseIndent);
  31. void SetClearSelectionOnDefocus(bool enable);
  32. void SetSelectOnClickEnd(bool enable);
  33. void Expand(unsigned index, bool enable, bool recursive = false);
  34. void ToggleExpand(unsigned index, bool recursive = false);
  35. unsigned GetNumItems() const;
  36. UIElement* GetItem(unsigned index) const;
  37. // PODVector<UIElement*> GetItems() const;
  38. tolua_outside const PODVector<UIElement*>& ListViewGetItems @ GetItems() const;
  39. unsigned FindItem(UIElement* item) const;
  40. unsigned GetSelection() const;
  41. const PODVector<unsigned>& GetSelections() const;
  42. void CopySelectedItemsToClipboard() const;
  43. UIElement* GetSelectedItem() const;
  44. // PODVector<UIElement*> GetSelectedItems() const;
  45. tolua_outside const PODVector<UIElement*>& ListViewGetSelectedItems @ GetSelectedItems() const;
  46. bool IsSelected(unsigned index) const;
  47. bool IsExpanded(unsigned index) const;
  48. HighlightMode GetHighlightMode() const;
  49. bool GetMultiselect() const;
  50. bool GetClearSelectionOnDefocus() const;
  51. bool GetSelectOnClickEnd() const;
  52. bool GetHierarchyMode() const;
  53. int GetBaseIndent() const;
  54. tolua_readonly tolua_property__get_set unsigned numItems;
  55. tolua_property__get_set unsigned selection;
  56. tolua_readonly tolua_property__get_set UIElement* selectedItem;
  57. tolua_property__get_set HighlightMode highlightMode;
  58. tolua_property__get_set bool multiselect;
  59. tolua_property__get_set bool clearSelectionOnDefocus;
  60. tolua_property__get_set bool selectOnClickEnd;
  61. tolua_property__get_set bool hierarchyMode;
  62. tolua_property__get_set int baseIndent;
  63. };
  64. ${
  65. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00
  66. static int tolua_UILuaAPI_ListView_new00(lua_State* tolua_S)
  67. {
  68. return ToluaNewObject<ListView>(tolua_S);
  69. }
  70. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00_local
  71. static int tolua_UILuaAPI_ListView_new00_local(lua_State* tolua_S)
  72. {
  73. return ToluaNewObjectGC<ListView>(tolua_S);
  74. }
  75. static const PODVector<UIElement*>& ListViewGetItems(const ListView* listView)
  76. {
  77. static PODVector<UIElement*> items;
  78. items = listView->GetItems();
  79. return items;
  80. }
  81. static const PODVector<UIElement*>& ListViewGetSelectedItems(const ListView* listView)
  82. {
  83. static PODVector<UIElement*> items;
  84. items = listView->GetSelectedItems();
  85. return items;
  86. }
  87. $}