UIListView.h 1.1 KB

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