UISelectItem.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. virtual tb::TBGenericStringItem* GetTBItem();
  20. protected:
  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. void Clear() { items_.Clear(); }
  36. // caller's responsibility to clean up
  37. virtual tb::TBSelectItemSource* GetTBItemSource();
  38. protected:
  39. List<SharedPtr<UISelectItem>> items_;
  40. };
  41. }