Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/windowing/StarImageWidget.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/windowing/StarImageWidget.hpp')
-rw-r--r--source/windowing/StarImageWidget.hpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/source/windowing/StarImageWidget.hpp b/source/windowing/StarImageWidget.hpp
new file mode 100644
index 0000000..f900b68
--- /dev/null
+++ b/source/windowing/StarImageWidget.hpp
@@ -0,0 +1,51 @@
+#ifndef STAR_IMAGE_WIDGET_HPP
+#define STAR_IMAGE_WIDGET_HPP
+
+#include "StarWidget.hpp"
+
+namespace Star {
+
+STAR_CLASS(ImageWidget);
+class ImageWidget : public Widget {
+public:
+ ImageWidget(String const& image = {});
+
+ bool interactive() const override;
+ void setImage(String const& image);
+ void setScale(float scale);
+ void setRotation(float rotation);
+ String image() const;
+
+ void setDrawables(List<Drawable> drawables);
+ Vec2I offset();
+ void setOffset(Vec2I const& offset);
+ bool centered();
+ void setCentered(bool centered);
+ bool trim();
+ void setTrim(bool trim);
+
+ void setMaxSize(Vec2I const& size);
+ void setMinSize(Vec2I const& size);
+
+ RectI screenBoundRect() const override;
+
+protected:
+ void renderImpl() override;
+
+private:
+ void transformDrawables();
+
+ List<Drawable> m_baseDrawables;
+ List<Drawable> m_drawables;
+ bool m_centered;
+ bool m_trim;
+ float m_scale;
+ float m_rotation;
+ Vec2I m_offset;
+ Vec2I m_maxSize;
+ Vec2I m_minSize;
+};
+
+}
+
+#endif