UISelectItem.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include <TurboBadger/tb_widgets.h>
  3. #include <TurboBadger/tb_select_item.h>
  4. #include "../Core/Object.h"
  5. #include "../Container/List.h"
  6. namespace Atomic
  7. {
  8. class UISelectItemSource;
  9. class UISelectItem : public Object
  10. {
  11. OBJECT(UISelectItem)
  12. public:
  13. UISelectItem(Context* context, const String& str = String::EMPTY, const String& id = String::EMPTY, const String& skinImage = String::EMPTY);
  14. virtual ~UISelectItem();
  15. void SetString(const String& str) { str_ = str; }
  16. void SetID(const String& id);
  17. void SetSkinImage(const String& skinImage);
  18. void SetSubSource(UISelectItemSource *subSource);
  19. tb::TBGenericStringItem* GetTBItem();
  20. private:
  21. String str_;
  22. // TBID
  23. tb::TBID id_;
  24. // TBID
  25. tb::TBID skinImage_;
  26. SharedPtr<UISelectItemSource> subSource_;
  27. };
  28. class UISelectItemSource : public Object
  29. {
  30. OBJECT(UISelectItemSource)
  31. public:
  32. UISelectItemSource(Context* context);
  33. virtual ~UISelectItemSource();
  34. void AddItem(UISelectItem* item) { items_.Push(SharedPtr<UISelectItem>(item)); }
  35. // caller's responsibility to clean up
  36. tb::TBGenericStringItemSource* GetTBItemSource();
  37. private:
  38. List<SharedPtr<UISelectItem>> items_;
  39. };
  40. }