Fri, 05 Nov 2021 16:14:49 +0200
* A sizing bug with dropdown list
* Optimized container resizing
--- a/Source/Gorgon/UI/ComponentStackWidget.h Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/UI/ComponentStackWidget.h Fri Nov 05 16:14:49 2021 +0200 @@ -182,16 +182,10 @@ protected: virtual void move(const Geometry::Point &location) override { stack.Move(location); - - if(IsVisible() && HasParent()) - boundschanged(); } virtual void resize(const Geometry::Size &size) override { stack.Resize(size); - - if(IsVisible() && HasParent()) - boundschanged(); } private:
--- a/Source/Gorgon/UI/Widget.cpp Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/UI/Widget.cpp Fri Nov 05 16:14:49 2021 +0200 @@ -143,6 +143,8 @@ void Widget::calculatebounds() { int unitsize = 0, spacing = 0, fr = 6; Geometry::Size sz; + bool changed = false; + if(HasParent()) { unitsize = GetParent().GetUnitSize(); spacing = GetParent().GetSpacing(); @@ -165,6 +167,7 @@ if(llocation != l) { llocation = l; move(l); + changed = true; } auto s = UI::Convert( @@ -188,7 +191,11 @@ if(lsize != s) { lsize = s; resize(s); + changed = true; } + + if(changed) + boundschanged(); } void Widget::Move(const UnitPoint &value) {
--- a/Source/Gorgon/Widgets/Composer.cpp Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/Widgets/Composer.cpp Fri Nov 05 16:14:49 2021 +0200 @@ -178,18 +178,10 @@ else { ComponentStackWidget::resize(size); } - - if(HasOrganizer()) - GetOrganizer().Reorganize(); - - childboundschanged(nullptr); - distributeparentboundschanged(); } void ComponentStackComposer::move(const Geometry::Point &location) { ComponentStackWidget::move(location); - - distributeparentboundschanged(); } UI::ExtenderRequestResponse ComponentStackComposer::RequestExtender(const Layer &self) {
--- a/Source/Gorgon/Widgets/Composer.h Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/Widgets/Composer.h Fri Nov 05 16:14:49 2021 +0200 @@ -123,6 +123,7 @@ /// The spacing should be left between widgets virtual int GetSpacing() const override; + using WidgetContainer::GetUnitSize; /// Returns the unit width for a widget. This size is enough to @@ -157,10 +158,6 @@ virtual Widget &AsWidget() override { return *this; } - virtual void parentboundschanged () override { - distributeparentboundschanged(); - } - virtual Input::Layer &getinputlayer() { return inputlayer; } @@ -170,6 +167,20 @@ virtual void move(const Geometry::Point &location) override; + virtual void parentenabledchanged(bool state) override { + Widget::parentenabledchanged(state); + + if(!state && IsEnabled()) + distributeparentenabled(state); + else if(state && IsEnabled()) + distributeparentenabled(state); + } + + void boundschanged() override { + Widget::boundschanged(); + distributeparentboundschanged(); + } + private: bool enabled = true; @@ -277,6 +288,20 @@ virtual void focuslost() override; + virtual void parentenabledchanged(bool state) override { + ComponentStackWidget::parentenabledchanged(state); + + if(!state && IsEnabled()) + distributeparentenabled(state); + else if(state && IsEnabled()) + distributeparentenabled(state); + } + + void boundschanged() override { + ComponentStackWidget::boundschanged(); + distributeparentboundschanged(); + } + virtual Layer &getlayer() override { return stack.GetLayerOf(stack.IndexOfTag(UI::ComponentTemplate::ContentsTag)); }
--- a/Source/Gorgon/Widgets/Dropdown.h Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/Widgets/Dropdown.h Fri Nov 05 16:14:49 2021 +0200 @@ -187,6 +187,7 @@ } virtual void parentboundschanged() override { + ComponentStackWidget::parentboundschanged(); if(IsOpened()) { Close();
--- a/Source/Gorgon/Widgets/Panel.cpp Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/Widgets/Panel.cpp Fri Nov 05 16:14:49 2021 +0200 @@ -157,11 +157,7 @@ ComponentStackWidget::resize(size); } - if(HasOrganizer()) - GetOrganizer().Reorganize(); - childboundschanged(nullptr); - distributeparentboundschanged(); } void Panel::move(const Geometry::Point &location) {
--- a/Source/Gorgon/Widgets/Panel.h Fri Nov 05 10:13:45 2021 +0200 +++ b/Source/Gorgon/Widgets/Panel.h Fri Nov 05 16:14:49 2021 +0200 @@ -243,7 +243,12 @@ else if(state && IsEnabled()) distributeparentenabled(state); } - + + void boundschanged() override { + Widget::boundschanged(); + distributeparentboundschanged(); + } + virtual void resize(const Geometry::Size &size) override; virtual void move(const Geometry::Point &location) override;