UIListView.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 SetItemText(const String& id, const String& text);
  19. void SetItemIcon(const String& id, const String& icon);
  20. void DeleteItemByID(const String& id);
  21. void SetExpanded(unsigned itemID, bool value);
  22. void DeleteAllItems();
  23. void SelectItemByID(const String& id);
  24. String GetHoverItemID() { return rootList_.Null() ? "" : rootList_->GetHoverItemID(); }
  25. String GetSelectedItemID() { return rootList_.Null() ? "" : rootList_->GetSelectedItemID(); }
  26. UISelectList* GetRootList() { return rootList_; }
  27. private:
  28. SharedPtr<UISelectList> rootList_;
  29. ListViewItemSource* source_;
  30. HashMap<unsigned,ListViewItem*> itemLookup_;
  31. unsigned itemLookupId_;
  32. };
  33. }