diff options
author | crupest <crupest@outlook.com> | 2020-10-30 00:07:57 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-10-30 00:07:57 +0800 |
commit | 6aa2201797a9ed64ce0178215ae941d0c5f09579 (patch) | |
tree | 9a74ee8d9f616afbe693ef7825a71474850831b5 /include/cru/ui/render | |
parent | b4cb4fb7552d35c267bdb66913e4c822f16346ab (diff) | |
download | cru-6aa2201797a9ed64ce0178215ae941d0c5f09579.tar.gz cru-6aa2201797a9ed64ce0178215ae941d0c5f09579.tar.bz2 cru-6aa2201797a9ed64ce0178215ae941d0c5f09579.zip |
...
Diffstat (limited to 'include/cru/ui/render')
-rw-r--r-- | include/cru/ui/render/BorderRenderObject.hpp | 26 | ||||
-rw-r--r-- | include/cru/ui/render/CanvasRenderObject.hpp | 2 | ||||
-rw-r--r-- | include/cru/ui/render/LayoutRenderObject.hpp | 2 | ||||
-rw-r--r-- | include/cru/ui/render/RenderObject.hpp | 12 | ||||
-rw-r--r-- | include/cru/ui/render/ScrollRenderObject.hpp | 4 | ||||
-rw-r--r-- | include/cru/ui/render/TextRenderObject.hpp | 38 |
6 files changed, 42 insertions, 42 deletions
diff --git a/include/cru/ui/render/BorderRenderObject.hpp b/include/cru/ui/render/BorderRenderObject.hpp index 587f051a..f1b957cf 100644 --- a/include/cru/ui/render/BorderRenderObject.hpp +++ b/include/cru/ui/render/BorderRenderObject.hpp @@ -16,11 +16,11 @@ class BorderRenderObject : public RenderObject { bool IsBorderEnabled() const { return is_border_enabled_; } void SetBorderEnabled(bool enabled) { is_border_enabled_ = enabled; } - std::shared_ptr<platform::graph::IBrush> GetBorderBrush() { + std::shared_ptr<platform::graphics::IBrush> GetBorderBrush() { return border_brush_; } - void SetBorderBrush(std::shared_ptr<platform::graph::IBrush> brush) { + void SetBorderBrush(std::shared_ptr<platform::graphics::IBrush> brush) { if (brush == border_brush_) return; border_brush_ = std::move(brush); InvalidatePaint(); @@ -42,21 +42,21 @@ class BorderRenderObject : public RenderObject { RecreateGeometry(); } - std::shared_ptr<platform::graph::IBrush> GetForegroundBrush() { + std::shared_ptr<platform::graphics::IBrush> GetForegroundBrush() { return foreground_brush_; } - void SetForegroundBrush(std::shared_ptr<platform::graph::IBrush> brush) { + void SetForegroundBrush(std::shared_ptr<platform::graphics::IBrush> brush) { if (brush == foreground_brush_) return; foreground_brush_ = std::move(brush); InvalidatePaint(); } - std::shared_ptr<platform::graph::IBrush> GetBackgroundBrush() { + std::shared_ptr<platform::graphics::IBrush> GetBackgroundBrush() { return background_brush_; } - void SetBackgroundBrush(std::shared_ptr<platform::graph::IBrush> brush) { + void SetBackgroundBrush(std::shared_ptr<platform::graphics::IBrush> brush) { if (brush == background_brush_) return; background_brush_ = std::move(brush); InvalidatePaint(); @@ -67,7 +67,7 @@ class BorderRenderObject : public RenderObject { RenderObject* HitTest(const Point& point) override; protected: - void OnDrawCore(platform::graph::IPainter* painter) override; + void OnDrawCore(platform::graphics::IPainter* painter) override; Size OnMeasureCore(const MeasureRequirement& requirement, const MeasureSize& preferred_size) override; @@ -87,19 +87,19 @@ class BorderRenderObject : public RenderObject { private: bool is_border_enabled_ = false; - std::shared_ptr<platform::graph::IBrush> border_brush_; + std::shared_ptr<platform::graphics::IBrush> border_brush_; Thickness border_thickness_; CornerRadius border_radius_; - std::shared_ptr<platform::graph::IBrush> foreground_brush_; - std::shared_ptr<platform::graph::IBrush> background_brush_; + std::shared_ptr<platform::graphics::IBrush> foreground_brush_; + std::shared_ptr<platform::graphics::IBrush> background_brush_; // The ring. Used for painting. - std::unique_ptr<platform::graph::IGeometry> geometry_; + std::unique_ptr<platform::graphics::IGeometry> geometry_; // Area including inner area of the border. Used for painting foreground and // background. - std::unique_ptr<platform::graph::IGeometry> border_inner_geometry_; + std::unique_ptr<platform::graphics::IGeometry> border_inner_geometry_; // Area including border ring and inner area. Used for hit test. - std::unique_ptr<platform::graph::IGeometry> border_outer_geometry_; + std::unique_ptr<platform::graphics::IGeometry> border_outer_geometry_; }; } // namespace cru::ui::render diff --git a/include/cru/ui/render/CanvasRenderObject.hpp b/include/cru/ui/render/CanvasRenderObject.hpp index 3216f08c..58fee59c 100644 --- a/include/cru/ui/render/CanvasRenderObject.hpp +++ b/include/cru/ui/render/CanvasRenderObject.hpp @@ -22,7 +22,7 @@ class CanvasRenderObject : public RenderObject { IEvent<CanvasPaintEventArgs>* PaintEvent() { return &paint_event_; } protected: - void OnDrawContent(platform::graph::IPainter* painter) override; + void OnDrawContent(platform::graphics::IPainter* painter) override; Size OnMeasureContent(const MeasureRequirement& requirement, const MeasureSize& preferred_size) override; diff --git a/include/cru/ui/render/LayoutRenderObject.hpp b/include/cru/ui/render/LayoutRenderObject.hpp index b46ba0d0..732031a1 100644 --- a/include/cru/ui/render/LayoutRenderObject.hpp +++ b/include/cru/ui/render/LayoutRenderObject.hpp @@ -1,7 +1,7 @@ #pragma once #include "RenderObject.hpp" -#include "cru/platform/graph/util/Painter.hpp" +#include "cru/platform/graphics/util/Painter.hpp" namespace cru::ui::render { template <typename TChildLayoutData> diff --git a/include/cru/ui/render/RenderObject.hpp b/include/cru/ui/render/RenderObject.hpp index 20e095fa..436cf6b2 100644 --- a/include/cru/ui/render/RenderObject.hpp +++ b/include/cru/ui/render/RenderObject.hpp @@ -33,7 +33,7 @@ namespace cru::ui::render { // // To write a custom RenderObject, override following methods: // public: -// void Draw(platform::graph::IPainter* painter) override; +// void Draw(platform::graphics::IPainter* painter) override; // RenderObject* HitTest(const Point& point) override; // protected: // Size OnMeasureContent(const MeasureRequirement& requirement) override; @@ -129,7 +129,7 @@ class RenderObject : public Object { // This will set offset of this render object and call OnLayoutCore. void Layout(const Point& offset); - void Draw(platform::graph::IPainter* painter); + void Draw(platform::graphics::IPainter* painter); // Param point must be relative the lefttop of render object including margin. // Add offset before pass point to children. @@ -163,15 +163,15 @@ class RenderObject : public Object { virtual void OnRemoveChild(RenderObject* removed_child, Index position); // Draw all children with offset. - void DefaultDrawChildren(platform::graph::IPainter* painter); + void DefaultDrawChildren(platform::graphics::IPainter* painter); // Draw all children with translation of content rect lefttop. - void DefaultDrawContent(platform::graph::IPainter* painter); + void DefaultDrawContent(platform::graphics::IPainter* painter); // Call DefaultDrawContent. Then call DefaultDrawChildren. - virtual void OnDrawCore(platform::graph::IPainter* painter); + virtual void OnDrawCore(platform::graphics::IPainter* painter); - virtual void OnDrawContent(platform::graph::IPainter* painter); + virtual void OnDrawContent(platform::graphics::IPainter* painter); // Size measure including margin and padding. Please reduce margin and padding // or other custom things and pass the result content measure requirement and diff --git a/include/cru/ui/render/ScrollRenderObject.hpp b/include/cru/ui/render/ScrollRenderObject.hpp index 9b0cbf9a..3cc0e4c4 100644 --- a/include/cru/ui/render/ScrollRenderObject.hpp +++ b/include/cru/ui/render/ScrollRenderObject.hpp @@ -1,7 +1,7 @@ #pragma once #include "RenderObject.hpp" -#include "cru/platform/graph/util/Painter.hpp" +#include "cru/platform/graphics/util/Painter.hpp" #include <optional> @@ -44,7 +44,7 @@ class ScrollRenderObject : public RenderObject { void ScrollToContain(const Rect& rect, const Thickness& margin = Thickness{}); protected: - void OnDrawCore(platform::graph::IPainter* painter) override; + void OnDrawCore(platform::graphics::IPainter* painter) override; // Logic: // If available size is bigger than child's preferred size, then child's diff --git a/include/cru/ui/render/TextRenderObject.hpp b/include/cru/ui/render/TextRenderObject.hpp index 3be42bbb..fa569c8c 100644 --- a/include/cru/ui/render/TextRenderObject.hpp +++ b/include/cru/ui/render/TextRenderObject.hpp @@ -24,10 +24,10 @@ class TextRenderObject : public RenderObject { constexpr static float default_caret_width = 2; public: - TextRenderObject(std::shared_ptr<platform::graph::IBrush> brush, - std::shared_ptr<platform::graph::IFont> font, - std::shared_ptr<platform::graph::IBrush> selection_brush, - std::shared_ptr<platform::graph::IBrush> caret_brush); + TextRenderObject(std::shared_ptr<platform::graphics::IBrush> brush, + std::shared_ptr<platform::graphics::IFont> font, + std::shared_ptr<platform::graphics::IBrush> selection_brush, + std::shared_ptr<platform::graphics::IBrush> caret_brush); TextRenderObject(const TextRenderObject& other) = delete; TextRenderObject(TextRenderObject&& other) = delete; TextRenderObject& operator=(const TextRenderObject& other) = delete; @@ -38,25 +38,25 @@ class TextRenderObject : public RenderObject { std::u16string_view GetTextView() const; void SetText(std::u16string new_text); - std::shared_ptr<platform::graph::IBrush> GetBrush() const { return brush_; } - void SetBrush(std::shared_ptr<platform::graph::IBrush> new_brush); + std::shared_ptr<platform::graphics::IBrush> GetBrush() const { return brush_; } + void SetBrush(std::shared_ptr<platform::graphics::IBrush> new_brush); - std::shared_ptr<platform::graph::IFont> GetFont() const; - void SetFont(std::shared_ptr<platform::graph::IFont> font); + std::shared_ptr<platform::graphics::IFont> GetFont() const; + void SetFont(std::shared_ptr<platform::graphics::IFont> font); std::vector<Rect> TextRangeRect(const TextRange& text_range); Point TextSinglePoint(gsl::index position, bool trailing); - platform::graph::TextHitTestResult TextHitTest(const Point& point); + platform::graphics::TextHitTestResult TextHitTest(const Point& point); std::optional<TextRange> GetSelectionRange() const { return selection_range_; } void SetSelectionRange(std::optional<TextRange> new_range); - std::shared_ptr<platform::graph::IBrush> GetSelectionBrush() const { + std::shared_ptr<platform::graphics::IBrush> GetSelectionBrush() const { return selection_brush_; } - void SetSelectionBrush(std::shared_ptr<platform::graph::IBrush> new_brush); + void SetSelectionBrush(std::shared_ptr<platform::graphics::IBrush> new_brush); bool IsDrawCaret() const { return draw_caret_; } void SetDrawCaret(bool draw_caret); @@ -72,10 +72,10 @@ class TextRenderObject : public RenderObject { // Lefttop relative to render object lefttop. Rect GetCaretRect(); - std::shared_ptr<platform::graph::IBrush> GetCaretBrush() const { + std::shared_ptr<platform::graphics::IBrush> GetCaretBrush() const { return caret_brush_; } - void GetCaretBrush(std::shared_ptr<platform::graph::IBrush> brush); + void GetCaretBrush(std::shared_ptr<platform::graphics::IBrush> brush); float GetCaretWidth() const { return caret_width_; } void SetCaretWidth(float width); @@ -83,7 +83,7 @@ class TextRenderObject : public RenderObject { RenderObject* HitTest(const Point& point) override; protected: - void OnDrawContent(platform::graph::IPainter* painter) override; + void OnDrawContent(platform::graphics::IPainter* painter) override; // See remarks of this class. Size OnMeasureContent(const MeasureRequirement& requirement, @@ -93,16 +93,16 @@ class TextRenderObject : public RenderObject { void OnAfterLayout() override; private: - std::shared_ptr<platform::graph::IBrush> brush_; - std::shared_ptr<platform::graph::IFont> font_; - std::unique_ptr<platform::graph::ITextLayout> text_layout_; + std::shared_ptr<platform::graphics::IBrush> brush_; + std::shared_ptr<platform::graphics::IFont> font_; + std::unique_ptr<platform::graphics::ITextLayout> text_layout_; std::optional<TextRange> selection_range_ = std::nullopt; - std::shared_ptr<platform::graph::IBrush> selection_brush_; + std::shared_ptr<platform::graphics::IBrush> selection_brush_; bool draw_caret_ = false; gsl::index caret_position_ = 0; - std::shared_ptr<platform::graph::IBrush> caret_brush_; + std::shared_ptr<platform::graphics::IBrush> caret_brush_; float caret_width_ = default_caret_width; }; } // namespace cru::ui::render |