diff options
author | crupest <crupest@outlook.com> | 2019-05-24 23:45:58 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-05-24 23:45:58 +0800 |
commit | b6db663269201fa14a6a4aa1b9042645a9e8f859 (patch) | |
tree | 1984e2c2784fb9623d4c20fbdd6fc650792e133c /include/cru/ui | |
parent | b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7 (diff) | |
download | cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.tar.gz cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.tar.bz2 cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.zip |
...
Diffstat (limited to 'include/cru/ui')
-rw-r--r-- | include/cru/ui/event/ui_event.hpp | 8 | ||||
-rw-r--r-- | include/cru/ui/render/border_render_object.hpp | 18 | ||||
-rw-r--r-- | include/cru/ui/render/flex_layout_render_object.hpp | 2 | ||||
-rw-r--r-- | include/cru/ui/render/render_object.hpp | 4 | ||||
-rw-r--r-- | include/cru/ui/render/text_render_object.hpp | 34 | ||||
-rw-r--r-- | include/cru/ui/render/window_render_object.hpp | 2 | ||||
-rw-r--r-- | include/cru/ui/ui_manager.hpp | 12 |
7 files changed, 40 insertions, 40 deletions
diff --git a/include/cru/ui/event/ui_event.hpp b/include/cru/ui/event/ui_event.hpp index c84116b9..2704cc4f 100644 --- a/include/cru/ui/event/ui_event.hpp +++ b/include/cru/ui/event/ui_event.hpp @@ -8,7 +8,7 @@ #include <optional> namespace cru::platform::graph { -struct Painter; +struct IPainter; } namespace cru::ui { @@ -113,7 +113,7 @@ class MouseWheelEventArgs : public MouseEventArgs { class PaintEventArgs : public UiEventArgs { public: PaintEventArgs(Object* sender, Object* original_sender, - platform::graph::Painter* painter) + platform::graph::IPainter* painter) : UiEventArgs(sender, original_sender), painter_(painter) {} PaintEventArgs(const PaintEventArgs& other) = default; PaintEventArgs(PaintEventArgs&& other) = default; @@ -121,10 +121,10 @@ class PaintEventArgs : public UiEventArgs { PaintEventArgs& operator=(PaintEventArgs&& other) = default; ~PaintEventArgs() = default; - platform::graph::Painter* GetPainter() const { return painter_; } + platform::graph::IPainter* GetPainter() const { return painter_; } private: - platform::graph::Painter* painter_; + platform::graph::IPainter* painter_; }; class FocusChangeEventArgs : public UiEventArgs { diff --git a/include/cru/ui/render/border_render_object.hpp b/include/cru/ui/render/border_render_object.hpp index 44382c63..407edbb3 100644 --- a/include/cru/ui/render/border_render_object.hpp +++ b/include/cru/ui/render/border_render_object.hpp @@ -4,8 +4,8 @@ #include <memory> namespace cru::platform::graph { -struct Brush; -struct Geometry; +struct IBrush; +struct IGeometry; } // namespace cru::platform namespace cru::ui::render { @@ -32,7 +32,7 @@ struct CornerRadius { class BorderRenderObject : public RenderObject { public: - explicit BorderRenderObject(std::shared_ptr<platform::graph::Brush> brush); + explicit BorderRenderObject(std::shared_ptr<platform::graph::IBrush> brush); BorderRenderObject(const BorderRenderObject& other) = delete; BorderRenderObject(BorderRenderObject&& other) = delete; BorderRenderObject& operator=(const BorderRenderObject& other) = delete; @@ -42,8 +42,8 @@ class BorderRenderObject : public RenderObject { bool IsEnabled() const { return is_enabled_; } void SetEnabled(bool enabled) { is_enabled_ = enabled; } - std::shared_ptr<platform::graph::Brush> GetBrush() const { return border_brush_; } - void SetBrush(std::shared_ptr<platform::graph::Brush> new_brush) { + std::shared_ptr<platform::graph::IBrush> GetBrush() const { return border_brush_; } + void SetBrush(std::shared_ptr<platform::graph::IBrush> new_brush) { border_brush_ = std::move(new_brush); } @@ -59,7 +59,7 @@ class BorderRenderObject : public RenderObject { void Refresh() { RecreateGeometry(); } - void Draw(platform::graph::Painter* painter) override; + void Draw(platform::graph::IPainter* painter) override; RenderObject* HitTest(const Point& point) override; @@ -83,11 +83,11 @@ class BorderRenderObject : public RenderObject { private: bool is_enabled_ = false; - std::shared_ptr<platform::graph::Brush> border_brush_ = nullptr; + std::shared_ptr<platform::graph::IBrush> border_brush_ = nullptr; Thickness border_thickness_{}; CornerRadius corner_radius_{}; - std::shared_ptr<platform::graph::Geometry> geometry_ = nullptr; - std::shared_ptr<platform::graph::Geometry> border_outer_geometry_ = nullptr; + std::shared_ptr<platform::graph::IGeometry> geometry_ = nullptr; + std::shared_ptr<platform::graph::IGeometry> border_outer_geometry_ = nullptr; }; } // namespace cru::ui::render diff --git a/include/cru/ui/render/flex_layout_render_object.hpp b/include/cru/ui/render/flex_layout_render_object.hpp index d225e679..99ec1247 100644 --- a/include/cru/ui/render/flex_layout_render_object.hpp +++ b/include/cru/ui/render/flex_layout_render_object.hpp @@ -38,7 +38,7 @@ class FlexLayoutRenderObject : public RenderObject { FlexChildLayoutData* GetChildLayoutData(int position); - void Draw(platform::graph::Painter* painter) override; + void Draw(platform::graph::IPainter* painter) override; RenderObject* HitTest(const Point& point) override; diff --git a/include/cru/ui/render/render_object.hpp b/include/cru/ui/render/render_object.hpp index 7f5f7ac6..b6614317 100644 --- a/include/cru/ui/render/render_object.hpp +++ b/include/cru/ui/render/render_object.hpp @@ -11,7 +11,7 @@ class Control; } namespace cru::platform::graph { -struct Painter; +struct IPainter; } namespace cru::ui::render { @@ -58,7 +58,7 @@ class RenderObject : public Object { void Measure(const Size& available_size); void Layout(const Rect& rect); - virtual void Draw(platform::graph::Painter* painter) = 0; + virtual void Draw(platform::graph::IPainter* painter) = 0; virtual RenderObject* HitTest(const Point& point) = 0; diff --git a/include/cru/ui/render/text_render_object.hpp b/include/cru/ui/render/text_render_object.hpp index 9f03551d..ecad6bb8 100644 --- a/include/cru/ui/render/text_render_object.hpp +++ b/include/cru/ui/render/text_render_object.hpp @@ -6,17 +6,17 @@ // forward declarations namespace cru::platform::graph { -struct Brush; -struct FontDescriptor; -struct TextLayout; +struct IBrush; +struct IFontDescriptor; +struct ITextLayout; } // namespace cru::platform::graph namespace cru::ui::render { class TextRenderObject : public RenderObject { public: - TextRenderObject(std::shared_ptr<platform::graph::Brush> brush, - std::shared_ptr<platform::graph::FontDescriptor> font, - std::shared_ptr<platform::graph::Brush> selection_brush); + TextRenderObject(std::shared_ptr<platform::graph::IBrush> brush, + std::shared_ptr<platform::graph::IFontDescriptor> font, + std::shared_ptr<platform::graph::IBrush> selection_brush); TextRenderObject(const TextRenderObject& other) = delete; TextRenderObject(TextRenderObject&& other) = delete; TextRenderObject& operator=(const TextRenderObject& other) = delete; @@ -26,13 +26,13 @@ class TextRenderObject : public RenderObject { std::wstring GetText() const; void SetText(std::wstring new_text); - std::shared_ptr<platform::graph::Brush> GetBrush() const { return brush_; } - void SetBrush(std::shared_ptr<platform::graph::Brush> new_brush) { + std::shared_ptr<platform::graph::IBrush> GetBrush() const { return brush_; } + void SetBrush(std::shared_ptr<platform::graph::IBrush> new_brush) { new_brush.swap(brush_); } - std::shared_ptr<platform::graph::FontDescriptor> GetFont() const; - void SetFont(std::shared_ptr<platform::graph::FontDescriptor> font); + std::shared_ptr<platform::graph::IFontDescriptor> GetFont() const; + void SetFont(std::shared_ptr<platform::graph::IFontDescriptor> font); std::optional<TextRange> GetSelectionRange() const { return selection_range_; @@ -41,14 +41,14 @@ class TextRenderObject : public RenderObject { selection_range_ = std::move(new_range); } - std::shared_ptr<platform::graph::Brush> GetSelectionBrush() const { + std::shared_ptr<platform::graph::IBrush> GetSelectionBrush() const { return selection_brush_; } - void SetSelectionBrush(std::shared_ptr<platform::graph::Brush> new_brush) { + void SetSelectionBrush(std::shared_ptr<platform::graph::IBrush> new_brush) { new_brush.swap(selection_brush_); } - void Draw(platform::graph::Painter* painter) override; + void Draw(platform::graph::IPainter* painter) override; RenderObject* HitTest(const Point& point) override; @@ -59,11 +59,11 @@ class TextRenderObject : public RenderObject { void OnLayoutContent(const Rect& content_rect) override; private: - std::shared_ptr<platform::graph::Brush> brush_; - std::shared_ptr<platform::graph::FontDescriptor> font_; - std::shared_ptr<platform::graph::TextLayout> text_layout_; + std::shared_ptr<platform::graph::IBrush> brush_; + std::shared_ptr<platform::graph::IFontDescriptor> font_; + std::shared_ptr<platform::graph::ITextLayout> text_layout_; std::optional<TextRange> selection_range_ = std::nullopt; - std::shared_ptr<platform::graph::Brush> selection_brush_; + std::shared_ptr<platform::graph::IBrush> selection_brush_; }; } // namespace cru::ui::render diff --git a/include/cru/ui/render/window_render_object.hpp b/include/cru/ui/render/window_render_object.hpp index dfeae487..b95acbce 100644 --- a/include/cru/ui/render/window_render_object.hpp +++ b/include/cru/ui/render/window_render_object.hpp @@ -17,7 +17,7 @@ class WindowRenderObject : public RenderObject { void MeasureAndLayout(); - void Draw(platform::graph::Painter* painter) override; + void Draw(platform::graph::IPainter* painter) override; RenderObject* HitTest(const Point& point) override; diff --git a/include/cru/ui/ui_manager.hpp b/include/cru/ui/ui_manager.hpp index 5317f579..2dc9cf6b 100644 --- a/include/cru/ui/ui_manager.hpp +++ b/include/cru/ui/ui_manager.hpp @@ -4,8 +4,8 @@ #include <memory> namespace cru::platform::graph { -struct Brush; -struct FontDescriptor; +struct IBrush; +struct IFontDescriptor; } // namespace cru::platform namespace cru::ui { @@ -19,12 +19,12 @@ class PredefineResources : public Object { ~PredefineResources() override = default; // region Button - std::shared_ptr<platform::graph::Brush> button_normal_border_brush; + std::shared_ptr<platform::graph::IBrush> button_normal_border_brush; // region TextBlock - std::shared_ptr<platform::graph::Brush> text_block_selection_brush; - std::shared_ptr<platform::graph::Brush> text_block_text_brush; - std::shared_ptr<platform::graph::FontDescriptor> text_block_font; + std::shared_ptr<platform::graph::IBrush> text_block_selection_brush; + std::shared_ptr<platform::graph::IBrush> text_block_text_brush; + std::shared_ptr<platform::graph::IFontDescriptor> text_block_font; }; class UiManager : public Object { |