aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/Control.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui/controls/Control.h')
-rw-r--r--include/cru/ui/controls/Control.h11
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();