aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-11-21 20:42:54 +0800
committercrupest <crupest@outlook.com>2021-11-21 20:42:54 +0800
commit3f8e493423b7cfe96ab53531078b803da7beccbe (patch)
treea0a998c6b2b696eaf4f58870224fef31e65e3dbd /include/cru/platform
parent73b90d4fe6c93a288ca6514432fe1e83ddcf4928 (diff)
downloadcru-3f8e493423b7cfe96ab53531078b803da7beccbe.tar.gz
cru-3f8e493423b7cfe96ab53531078b803da7beccbe.tar.bz2
cru-3f8e493423b7cfe96ab53531078b803da7beccbe.zip
...
Diffstat (limited to 'include/cru/platform')
-rw-r--r--include/cru/platform/graphics/NullPainter.hpp53
-rw-r--r--include/cru/platform/graphics/TextLayout.hpp4
-rw-r--r--include/cru/platform/gui/Window.hpp4
3 files changed, 59 insertions, 2 deletions
diff --git a/include/cru/platform/graphics/NullPainter.hpp b/include/cru/platform/graphics/NullPainter.hpp
new file mode 100644
index 00000000..cf790ccf
--- /dev/null
+++ b/include/cru/platform/graphics/NullPainter.hpp
@@ -0,0 +1,53 @@
+#pragma once
+#include "Painter.hpp"
+
+namespace cru::platform::graphics {
+class NullPainter : public Object, public virtual IPainter {
+ public:
+ NullPainter() = default;
+
+ CRU_DELETE_COPY(NullPainter)
+ CRU_DELETE_MOVE(NullPainter)
+
+ ~NullPainter() override = default;
+
+ public:
+ String GetPlatformId() const override { return u"NULL"; }
+
+ String GetDebugString() override { return u"NullPainter"; }
+
+ Matrix GetTransform() override { return Matrix(); }
+ void SetTransform(const Matrix& matrix) override {}
+
+ void ConcatTransform(const Matrix& matrix) override {}
+
+ void Clear(const Color& color) override {}
+
+ void DrawLine(const Point& start, const Point& end, IBrush* brush,
+ float width) override{};
+ void StrokeRectangle(const Rect& rectangle, IBrush* brush,
+ float width) override {}
+ void FillRectangle(const Rect& rectangle, IBrush* brush) override {}
+ void StrokeEllipse(const Rect& outline_rect, IBrush* brush,
+ float width) override {}
+ void FillEllipse(const Rect& outline_rect, IBrush* brush,
+ float width) override {}
+
+ void StrokeGeometry(IGeometry* geometry, IBrush* brush,
+ float width) override {}
+ void FillGeometry(IGeometry* geometry, IBrush* brush) override {}
+
+ void DrawText(const Point& offset, ITextLayout* text_layout,
+ IBrush* brush) override {}
+
+ void PushLayer(const Rect& bounds) override{};
+
+ void PopLayer() override {}
+
+ void PushState() override {}
+
+ void PopState() override {}
+
+ void EndDraw() override {}
+};
+} // namespace cru::platform::graphics
diff --git a/include/cru/platform/graphics/TextLayout.hpp b/include/cru/platform/graphics/TextLayout.hpp
index d10c9f22..a040ec3b 100644
--- a/include/cru/platform/graphics/TextLayout.hpp
+++ b/include/cru/platform/graphics/TextLayout.hpp
@@ -20,6 +20,10 @@ struct ITextLayout : virtual IGraphicsResource {
virtual bool IsEditMode() = 0;
virtual void SetEditMode(bool enable) = 0;
+ virtual Index GetLineIndexFromCharIndex(Index char_index) = 0;
+ virtual Index GetLineCount() = 0;
+ virtual float GetLineHeight(Index line_index) = 0;
+
virtual Rect GetTextBounds(bool includingTrailingSpace = false) = 0;
virtual std::vector<Rect> TextRangeRect(const TextRange& text_range) = 0;
// Width is always 0, height is line height.
diff --git a/include/cru/platform/gui/Window.hpp b/include/cru/platform/gui/Window.hpp
index f6e1d650..bab5e8fe 100644
--- a/include/cru/platform/gui/Window.hpp
+++ b/include/cru/platform/gui/Window.hpp
@@ -18,9 +18,9 @@ struct WindowStyleFlags {
static constexpr WindowStyleFlag NoCaptionAndBorder{0b1};
};
-enum class WindowVisibilityType { Show, Hide };
+enum class WindowVisibilityType { Show, Hide, Minimize };
-enum class FocusChangeType { Gain, Lost };
+enum class FocusChangeType { Gain, Lose };
enum class MouseEnterLeaveType { Enter, Leave };