From 9a3a9f487b24a7b1afff5e6f07e88096dc5755be Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 23 Feb 2022 21:37:11 +0800 Subject: ... --- include/cru/ui/controls/Control.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h index 3293969d..c52a53af 100644 --- a/include/cru/ui/controls/Control.h +++ b/include/cru/ui/controls/Control.h @@ -3,6 +3,7 @@ #include "../events/UiEvents.h" #include "../render/RenderObject.h" #include "../style/StyleRuleSet.h" +#include "cru/ui/render/MeasureRequirement.h" namespace cru::ui::controls { @@ -13,8 +14,7 @@ namespace cru::ui::controls { * - GetRenderObject() * - ForEachChild(const std::function& predicate) * - RemoveChild(Control* child) - * The last two methods are totally for convenient control tree management. The - * former one is even not used. + * The last two methods are totally for convenient control tree management. */ class CRU_UI_API Control : public Object { friend class RootControl; @@ -52,6 +52,13 @@ class CRU_UI_API Control : public Object { public: virtual render::RenderObject* GetRenderObject() const = 0; + render::MeasureSize GetPreferredSize() { + return GetRenderObject()->GetPreferredSize(); + } + void SetPreferredSize(const render::MeasureSize& size) { + GetRenderObject()->SetPreferredSize(size); + } + //*************** region: focus *************** public: bool HasFocus(); -- cgit v1.2.3