aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/render
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-10 23:37:38 +0800
committercrupest <crupest@outlook.com>2022-02-10 23:37:38 +0800
commit382d42802221941e24e672743d03e7adcb544f94 (patch)
treecce2a16646c289f66270e61a0b0533764049ceaf /include/cru/ui/render
parentf65d0502a9f0fc44be0dd79a5f3f31697bb3aad0 (diff)
downloadcru-382d42802221941e24e672743d03e7adcb544f94.tar.gz
cru-382d42802221941e24e672743d03e7adcb544f94.tar.bz2
cru-382d42802221941e24e672743d03e7adcb544f94.zip
...
Diffstat (limited to 'include/cru/ui/render')
-rw-r--r--include/cru/ui/render/CanvasRenderObject.h17
-rw-r--r--include/cru/ui/render/StackLayoutRenderObject.h5
2 files changed, 22 insertions, 0 deletions
diff --git a/include/cru/ui/render/CanvasRenderObject.h b/include/cru/ui/render/CanvasRenderObject.h
index 8343a5f5..2488dc91 100644
--- a/include/cru/ui/render/CanvasRenderObject.h
+++ b/include/cru/ui/render/CanvasRenderObject.h
@@ -4,6 +4,23 @@
#include "cru/common/Event.h"
namespace cru::ui::render {
+class CanvasPaintEventArgs {
+ public:
+ CanvasPaintEventArgs(platform::graphics::IPainter* painter,
+ const Size& paint_size)
+ : painter_(painter), paint_size_(paint_size) {}
+ CRU_DEFAULT_COPY(CanvasPaintEventArgs)
+ CRU_DEFAULT_MOVE(CanvasPaintEventArgs)
+ ~CanvasPaintEventArgs() = default;
+
+ platform::graphics::IPainter* GetPainter() const { return painter_; }
+ Size GetPaintSize() const { return paint_size_; }
+
+ private:
+ platform::graphics::IPainter* painter_;
+ Size paint_size_;
+};
+
// Layout logic:
// If no preferred size is set. Then (100, 100) is used and then coerced to
// required range.
diff --git a/include/cru/ui/render/StackLayoutRenderObject.h b/include/cru/ui/render/StackLayoutRenderObject.h
index 65b81b3d..b522ecbb 100644
--- a/include/cru/ui/render/StackLayoutRenderObject.h
+++ b/include/cru/ui/render/StackLayoutRenderObject.h
@@ -2,6 +2,11 @@
#include "LayoutRenderObject.h"
namespace cru::ui::render {
+struct StackChildLayoutData {
+ std::optional<Alignment> horizontal;
+ std::optional<Alignment> vertical;
+};
+
// Measure Logic:
// Following rules are applied both horizontally and vertically.
//