ListView.pkg 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 Expand(unsigned index, bool enable, bool recursive = false);
  30. void ToggleExpand(unsigned index, bool recursive = false);
  31. unsigned GetNumItems() const;
  32. UIElement* GetItem(unsigned index) const;
  33. // PODVector<UIElement*> GetItems() const;
  34. tolua_outside const PODVector<UIElement*>& ListViewGetItems @ GetItems() const;
  35. unsigned FindItem(UIElement* item) const;
  36. unsigned GetSelection() const;
  37. const PODVector<unsigned>& GetSelections() const;
  38. void CopySelectedItemsToClipboard() const;
  39. UIElement* GetSelectedItem() const;
  40. // PODVector<UIElement*> GetSelectedItems() const;
  41. tolua_outside const PODVector<UIElement*>& ListViewGetSelectedItems @ GetSelectedItems() const;
  42. bool IsSelected(unsigned index) const;
  43. bool IsExpanded(unsigned index) const;
  44. HighlightMode GetHighlightMode() const;
  45. bool GetMultiselect() const;
  46. bool GetClearSelectionOnDefocus() const;
  47. bool GetHierarchyMode() const;
  48. int GetBaseIndent() const;
  49. tolua_readonly tolua_property__get_set unsigned numItems;
  50. tolua_property__get_set unsigned selection;
  51. tolua_readonly tolua_property__get_set UIElement* selectedItem;
  52. tolua_property__get_set HighlightMode highlightMode;
  53. tolua_property__get_set bool multiselect;
  54. tolua_property__get_set bool clearSelectionOnDefocus;
  55. tolua_property__get_set bool hierarchyMode;
  56. tolua_property__get_set int baseIndent;
  57. };
  58. ${
  59. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00
  60. static int tolua_UILuaAPI_ListView_new00(lua_State* tolua_S)
  61. {
  62. return ToluaNewObject<ListView>(tolua_S);
  63. }
  64. #define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00_local
  65. static int tolua_UILuaAPI_ListView_new00_local(lua_State* tolua_S)
  66. {
  67. return ToluaNewObjectGC<ListView>(tolua_S);
  68. }
  69. static const PODVector<UIElement*>& ListViewGetItems(const ListView* listView)
  70. {
  71. static PODVector<UIElement*> items;
  72. items = listView->GetItems();
  73. return items;
  74. }
  75. static const PODVector<UIElement*>& ListViewGetSelectedItems(const ListView* listView)
  76. {
  77. static PODVector<UIElement*> items;
  78. items = listView->GetSelectedItems();
  79. return items;
  80. }
  81. $}