diff options
author | crupest <crupest@outlook.com> | 2018-12-10 00:25:35 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-12-10 00:25:35 +0800 |
commit | 4219992207b524e23a426e753589001b6f7a24d0 (patch) | |
tree | 397142e8f6da56cd300fac5c0dfd9b3e58aaefba | |
parent | 3ec1e536bd0ced5abcf82e84d1eee42960912b37 (diff) | |
download | cru-4219992207b524e23a426e753589001b6f7a24d0.tar.gz cru-4219992207b524e23a426e753589001b6f7a24d0.tar.bz2 cru-4219992207b524e23a426e753589001b6f7a24d0.zip |
...
-rw-r--r-- | src/ui/render/render_object.cpp | 12 | ||||
-rw-r--r-- | src/ui/render/render_object.hpp | 83 |
2 files changed, 91 insertions, 4 deletions
diff --git a/src/ui/render/render_object.cpp b/src/ui/render/render_object.cpp index d84d1d8b..7b430f06 100644 --- a/src/ui/render/render_object.cpp +++ b/src/ui/render/render_object.cpp @@ -116,6 +116,18 @@ namespace cru::ui::render render_target->SetTransform(&old_matrix); } + void OffsetRenderObject::SetOffsetX(const float new_offset_x) + { + offset_x_ = new_offset_x; + SetMatrix(D2D1::Matrix3x2F::Translation(offset_x_, offset_y_)); + } + + void OffsetRenderObject::SetOffsetY(const float new_offset_y) + { + offset_y_ = new_offset_y; + SetMatrix(D2D1::Matrix3x2F::Translation(offset_x_, offset_y_)); + } + const MatrixRenderObject::MatrixApplier MatrixRenderObject::append_applier(ApplyAppendMatrix); const MatrixRenderObject::MatrixApplier MatrixRenderObject::set_applier(ApplySetMatrix); } diff --git a/src/ui/render/render_object.hpp b/src/ui/render/render_object.hpp index 3a8777d8..675a1759 100644 --- a/src/ui/render/render_object.hpp +++ b/src/ui/render/render_object.hpp @@ -167,13 +167,75 @@ namespace cru::ui::render class OffsetRenderObject : public MatrixRenderObject { public: - OffsetRenderObject(const float offset_x, const float offset_y) : MatrixRenderObject(D2D1::Matrix3x2F::Translation(offset_x, offset_y)) + explicit OffsetRenderObject(const float offset_x = 0.0f, const float offset_y = 0.0f) + : MatrixRenderObject(D2D1::Matrix3x2F::Translation(offset_x, offset_y)), + offset_x_(offset_x), offset_y_(offset_y) { - + + } + + float GetOffsetX() const + { + return offset_x_; + } + + void SetOffsetX(float new_offset_x); + + float GetOffsetY() const + { + return offset_y_; } - }; + void SetOffsetY(float new_offset_y); + private: + float offset_x_; + float offset_y_; + }; + + class BorderRenderObject; //TODO! + + class FillGeometryRenderObject; //TODO! + + class CustomDrawHandlerRenderObject; //TODO! + + class ContainerRenderObject; //TODO! + + + + // Render object tree for a control. (RO for RenderObject) + // + // ControlRO (not a SingleChildRO because child is not changed) + // | + // MatrixRO (control transform, only matrix exposed) + // | + // ClipRO (control clip, only clip geometry exposed) + // | + // OffsetRO (border offset) + // | + // ContainerRO + // / | + // BorderRO OffsetRO (padding offset) + // / | \ + // / | \ + // / | \ + // / | \ + // / | \ + // / | \ + // ContainerRO (background) | ContainerRO (foreground, symmetrical to background) + // / \ | / \ + // GeometryFillRO CustomDrawHandlerRO | GeometryFillRO CustomDrawHandlerRO + // | + // OffsetRO (content offset) + // | + // ContainerRO (content) + // / | \ + // / | \ + // / | \ + // ContainerRO (control-define content ROs) | ContainerRO (child-control ROs) + // | + // CustomDrawHandlerRO (user-define drawing) + // class ControlRenderObject : public RenderObject { public: @@ -184,6 +246,19 @@ namespace cru::ui::render ControlRenderObject& operator=(ControlRenderObject&& other) = delete; ~ControlRenderObject() override = default; - + + D2D1_MATRIX_3X2_F GetControlTransform() const; + Microsoft::WRL::ComPtr<ID2D1Geometry> GetControlClip() const; + + Point GetBorderOffset() const; + BorderRenderObject* GetBorderRenderObject() const; + + Point GetPaddingOffset() const; + Microsoft::WRL::ComPtr<ID2D1Geometry> GetPaddingGeometry() const; + + Point GetContentOffset() const; + ContainerRenderObject* GetContentContainer() const; + + ContainerRenderObject* GetChildrenContainer() const; }; } |