UIListView.h 1.3 KB

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