UITextureWidget.h 665 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "UIWidget.h"
  3. namespace Atomic
  4. {
  5. class Texture;
  6. class UIRenderer;
  7. /// A widget that can render a Texture2D, so the image data
  8. /// doesn't need to be loaded 2x (once for Texture2D and once for say a UIImageWidget)
  9. class UITextureWidget : public UIWidget
  10. {
  11. friend class TBTextureWidget;
  12. OBJECT(UITextureWidget)
  13. public:
  14. UITextureWidget(Context* context, bool createWidget = true);
  15. virtual ~UITextureWidget();
  16. void SetTexture(Texture *texture);
  17. Texture* GetTexture();
  18. protected:
  19. virtual bool OnEvent(const tb::TBWidgetEvent &ev);
  20. private:
  21. SharedPtr<Texture> texture_;
  22. UIRenderer* renderer_;
  23. };
  24. }