ListView.pkg 3.3 KB

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