diff options
author | crupest <crupest@outlook.com> | 2018-12-05 15:51:05 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-12-05 15:51:05 +0800 |
commit | 01b0378ed32eb2011863393892717483004cc375 (patch) | |
tree | 5cd487e9359c4680a81cd77c304935539c10406e /src/ui/control.hpp | |
parent | 1166da612f01172270114921eb6785998ef88476 (diff) | |
download | cru-01b0378ed32eb2011863393892717483004cc375.tar.gz cru-01b0378ed32eb2011863393892717483004cc375.tar.bz2 cru-01b0378ed32eb2011863393892717483004cc375.zip |
Avoid search for ancestor in measure.
Diffstat (limited to 'src/ui/control.hpp')
-rw-r--r-- | src/ui/control.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ui/control.hpp b/src/ui/control.hpp index f3751ddf..b2dad9fd 100644 --- a/src/ui/control.hpp +++ b/src/ui/control.hpp @@ -22,6 +22,13 @@ namespace cru::ui class Window; + struct AdditionalMeasureInfo + { + bool horizontal_stretchable = true; + bool vertical_stretchable = true; + }; + + //the position cache struct ControlPositionCache { @@ -194,7 +201,7 @@ namespace cru::ui void InvalidateLayout(); - void Measure(const Size& available_size); + void Measure(const Size& available_size, const AdditionalMeasureInfo& additional_info); void Layout(const Rect& rect); @@ -314,11 +321,11 @@ namespace cru::ui //*************** region: layout *************** private: - Size OnMeasureCore(const Size& available_size); + Size OnMeasureCore(const Size& available_size, const AdditionalMeasureInfo& additional_info); void OnLayoutCore(const Rect& rect); protected: - virtual Size OnMeasureContent(const Size& available_size); + virtual Size OnMeasureContent(const Size& available_size, const AdditionalMeasureInfo& additional_info); virtual void OnLayoutContent(const Rect& rect); // Called by Layout after set position and size. |