ListView.pkg 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 UpdateInternalLayout();
  16. void DisableInternalLayoutUpdate();
  17. void EnableInternalLayoutUpdate();
  18. void AddItem(UIElement* item);
  19. void InsertItem(unsigned index, UIElement* item, UIElement* parentItem = 0);
  20. void RemoveItem(UIElement* item, unsigned index = 0);
  21. void RemoveItem(unsigned index);
  22. void RemoveAllItems();
  23. void SetSelection(unsigned index);
  24. void SetSelections(const PODVector<unsigned>& indices);
  25. void AddSelection(unsigned index);
  26. void RemoveSelection(unsigned index);
  27. void ToggleSelection(unsigned index);
  28. void ChangeSelection(int delta, bool additive = false);
  29. void ClearSelection();
  30. void SetHighlightMode(HighlightMode mode);
  31. void SetMultiselect(bool enable);
  32. void SetHierarchyMode(bool enable);
  33. void SetBaseIndent(int baseIndent);
  34. void SetClearSelectionOnDefocus(bool enable);
  35. void SetSelectOnClickEnd(bool enable);
  36. void Expand(unsigned index, bool enable, bool recursive = false);
  37. void ToggleExpand(unsigned index, bool recursive = false);
  38. unsigned GetNumItems() const;
  39. UIElement* GetItem(unsigned index) const;
  40. // PODVector<UIElement*> GetItems() const;
  41. tolua_outside const PODVector<UIElement*>& ListViewGetItems @ GetItems() const;
  42. unsigned FindItem(UIElement* item) const;
  43. unsigned GetSelection() const;
  44. const PODVector<unsigned>& GetSelections() const;
  45. void CopySelectedItemsToClipboard() const;
  46. UIElement* GetSelectedItem() const;
  47. // PODVector<UIElement*> GetSelectedItems() const;
  48. tolua_outside const PODVector<UIElement*>& ListViewGetSelectedItems @ GetSelectedItems() const;
  49. bool IsSelected(unsigned index) const;
  50. bool IsExpanded(unsigned index) const;
  51. HighlightMode GetHighlightMode() const;
  52. bool GetMultiselect() const;
  53. bool GetClearSelectionOnDefocus() const;
  54. bool GetSelectOnClickEnd() const;
  55. bool GetHierarchyMode() const;
  56. int GetBaseIndent() const;
  57. tolua_readonly tolua_property__get_set unsigned numItems;
  58. tolua_property__get_set unsigned selection;
  59. tolua_readonly tolua_property__get_set UIElement* selectedItem;
  60. tolua_property__get_set HighlightMode highlightMode;
  61. tolua_property__get_set bool multiselect;
  62. tolua_property__get_set bool clearSelectionOnDefocus;
  63. tolua_property__get_set bool selectOnClickEnd;
  64. tolua_property__get_set bool hierarchyMode;
  65. tolua_property__get_set int baseIndent;
  66. };
  67. ${
  68. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00
  69. static int tolua_UILuaAPI_ListView_new00(lua_State* tolua_S)
  70. {
  71. return ToluaNewObject<ListView>(tolua_S);
  72. }
  73. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00_local
  74. static int tolua_UILuaAPI_ListView_new00_local(lua_State* tolua_S)
  75. {
  76. return ToluaNewObjectGC<ListView>(tolua_S);
  77. }
  78. static const PODVector<UIElement*>& ListViewGetItems(const ListView* listView)
  79. {
  80. static PODVector<UIElement*> items;
  81. items = listView->GetItems();
  82. return items;
  83. }
  84. static const PODVector<UIElement*>& ListViewGetSelectedItems(const ListView* listView)
  85. {
  86. static PODVector<UIElement*> items;
  87. items = listView->GetSelectedItems();
  88. return items;
  89. }
  90. $}