diff options
author | crupest <crupest@outlook.com> | 2022-02-23 21:37:11 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-23 21:37:11 +0800 |
commit | 9a3a9f487b24a7b1afff5e6f07e88096dc5755be (patch) | |
tree | 3aef99be8bf58509907d056bef469820d2a106b5 /include/cru/ui/controls | |
parent | 603f46e195823530bafda97f0dda1a332cc39dc8 (diff) | |
download | cru-9a3a9f487b24a7b1afff5e6f07e88096dc5755be.tar.gz cru-9a3a9f487b24a7b1afff5e6f07e88096dc5755be.tar.bz2 cru-9a3a9f487b24a7b1afff5e6f07e88096dc5755be.zip |
...
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r-- | include/cru/ui/controls/Control.h | 11 |
1 files changed, 9 insertions, 2 deletions
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<void(Control*)>& 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(); |