UIListView.h 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "UIWidget.h"
  3. #include "UISelectList.h"
  4. namespace Atomic
  5. {
  6. class ListViewItemSource;
  7. class ListViewItem;
  8. class UIListView : public UIWidget
  9. {
  10. OBJECT(UIListView);
  11. public:
  12. /// Construct.
  13. UIListView(Context* context, bool createWidget = true);
  14. /// Destruct.
  15. virtual ~UIListView();
  16. unsigned AddRootItem(const String& text, const String& icon, const String& id);
  17. unsigned AddChildItem(unsigned parentItemID, const String& text, const String& icon, const String& id);
  18. void DeleteItemByID(const String& id);
  19. void SetExpanded(unsigned itemID, bool value);
  20. void DeleteAllItems();
  21. void SelectItemByID(const String& id);
  22. UISelectList* GetRootList() { return rootList_; }
  23. private:
  24. SharedPtr<UISelectList> rootList_;
  25. ListViewItemSource* source_;
  26. HashMap<unsigned,ListViewItem*> itemLookup_;
  27. unsigned itemLookupId_;
  28. };
  29. }