aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/render/StackLayoutRenderObject.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/ui/render/StackLayoutRenderObject.hpp
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/ui/render/StackLayoutRenderObject.hpp')
-rw-r--r--include/cru/ui/render/StackLayoutRenderObject.hpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/include/cru/ui/render/StackLayoutRenderObject.hpp b/include/cru/ui/render/StackLayoutRenderObject.hpp
deleted file mode 100644
index 2f832e55..00000000
--- a/include/cru/ui/render/StackLayoutRenderObject.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#pragma once
-#include "LayoutRenderObject.hpp"
-#include "cru/ui/Base.hpp"
-
-namespace cru::ui::render {
-// Measure Logic:
-// Following rules are applied both horizontally and vertically.
-//
-// 1. Measure each children with min size not specified and max size as
-// following rules:
-//
-// 1.1. If parent's preferred size is set and it is not less than child's min
-// size, then it is used as child's max size.
-//
-// 1.2. Or if parent's max size is set, then it is used as child's max size.
-// If it is less than child's min size, then log an warning about that.
-//
-// 2. Result size is children's max size.
-//
-// 3. If preferred size is specified and result size is smaller than it, coerce
-// result size to preferred size.
-//
-// 4. If result size is smaller than min size (if specified), coerce result size
-// to min size.
-class CRU_UI_API StackLayoutRenderObject
- : public LayoutRenderObject<StackChildLayoutData> {
- CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render:StackLayoutRenderObject")
-
- public:
- StackLayoutRenderObject() = default;
- CRU_DELETE_COPY(StackLayoutRenderObject)
- CRU_DELETE_MOVE(StackLayoutRenderObject)
- ~StackLayoutRenderObject() = default;
-
- std::u16string_view GetName() const override {
- return u"StackLayoutRenderObject";
- }
-
- Alignment GetDefaultHorizontalAlignment() const {
- return default_vertical_alignment_;
- }
- void SetDefaultHorizontalAlignment(Alignment alignment);
- Alignment GetDefaultVerticalAlignment() {
- return default_horizontal_alignment_;
- }
- void SetDefaultVertialAlignment(Alignment alignment);
-
- protected:
- Size OnMeasureContent(const MeasureRequirement& requirement,
- const MeasureSize& preferred_size) override;
- void OnLayoutContent(const Rect& content_rect) override;
-
- private:
- Alignment default_horizontal_alignment_ = Alignment::Start;
- Alignment default_vertical_alignment_ = Alignment::Start;
-};
-} // namespace cru::ui::render