Sun, 31 Oct 2021 20:31:10 +0200
#337 partial fixes to dialog system
--- a/Source/Gorgon/UI/Dialog.cpp Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/UI/Dialog.cpp Sun Oct 31 20:31:10 2021 +0200 @@ -223,7 +223,7 @@ text = new Widgets::Label(message); } - text->SetAutosize(Autosize::Automatic, Autosize::Automatic); + text->SetAutosize(Autosize::None, Autosize::Automatic); diag->Add(*text); diag->Own(*text);
--- a/Source/Gorgon/UI/LayerAdapter.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/UI/LayerAdapter.h Sun Oct 31 20:31:10 2021 +0200 @@ -82,18 +82,6 @@ issizesset = true; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - int AutomaticUnitSize(int spacing, int units = 6) override { - ASSERT(base, "Base layer is not set"); - - this->spacing = spacing; - issizesset = true; - this->unitsize = ( base->GetWidth() - spacing * (units-1) ) / units; - - return base->GetWidth() - (this->unitsize * units + this->spacing * (units-1)); - } - /// Return to use default sizes void UseDefaultSizes() { issizesset = false;
--- a/Source/Gorgon/UI/WidgetContainer.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/UI/WidgetContainer.h Sun Oct 31 20:31:10 2021 +0200 @@ -322,10 +322,6 @@ /// change focus to the next widget using tab key virtual void SetTabSwitchEnabledState(bool state) { tabswitch = state; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - virtual int AutomaticUnitSize(int spacing, int units = 6) = 0; - /// Returns the begin iterator for the contained widgets auto begin() { return widgets.begin();
--- a/Source/Gorgon/UI/Window.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/UI/Window.h Sun Oct 31 20:31:10 2021 +0200 @@ -225,15 +225,6 @@ issizesset = true; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - int AutomaticUnitSize(int spacing, int units = 6) override { - this->spacing = spacing; - this->unitwidth = ( GetInteriorSize().Width - spacing * (units-1) ) / units; - - return GetInteriorSize().Width - (this->unitwidth * units + this->spacing * (units-1)); - } - /// Return to use default sizes void UseDefaultSizes() { issizesset = false;
--- a/Source/Gorgon/Widgets/Composer.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/Widgets/Composer.h Sun Oct 31 20:31:10 2021 +0200 @@ -138,15 +138,6 @@ issizesset = true; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - int AutomaticUnitSize(int spacing, int units) override { - this->spacing = spacing; - this->unitwidth = ( GetInteriorSize().Width - spacing * (units-1) ) / units; - - return GetInteriorSize().Width - (this->unitwidth * units + this->spacing * (units-1)); - } - /// Return to use default sizes void UseDefaultSizes() { issizesset = false; @@ -308,15 +299,6 @@ issizesset = true; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - int AutomaticUnitSize(int spacing, int units) override { - this->spacing = spacing; - this->unitwidth = ( GetInteriorSize().Width - spacing * (units-1) ) / units; - - return GetInteriorSize().Width - (this->unitwidth * units + this->spacing * (units-1)); - } - /// Return to use default sizes void UseDefaultSizes() { issizesset = false;
--- a/Source/Gorgon/Widgets/DialogWindow.cpp Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/Widgets/DialogWindow.cpp Sun Oct 31 20:31:10 2021 +0200 @@ -47,7 +47,6 @@ buttonsarea.SetFocusStrategy(Deny); btnorg.AttachTo(buttonsarea); btnorg.SetAlignment(Graphics::TextAlignment::Right); - buttonsarea.AutomaticUnitSize(temp.GetSpacing()); } } @@ -58,9 +57,6 @@ updatescrollvisibility(); - if(buttonsarea.IsReady()) - buttonsarea.AutomaticUnitSize(temp.GetSpacing()); - if(autoplace != None) Center(); }
--- a/Source/Gorgon/Widgets/Panel.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/Widgets/Panel.h Sun Oct 31 20:31:10 2021 +0200 @@ -123,16 +123,6 @@ issizesset = true; } - /// Sets the unit size automatically. Full width will be at least - /// given units wide. Returns remaining size. - int AutomaticUnitSize(int spacing, int units = 6) override { - this->spacing = spacing; - this->unitwidth = ( GetInteriorSize().Width - spacing * (units-1) ) / units; - issizesset = true; - - return GetInteriorSize().Width - (this->unitwidth * units + this->spacing * (units-1)); - } - /// Return to use default sizes void UseDefaultSizes() { issizesset = false;
--- a/Source/Gorgon/Widgets/RadioButtons.h Sun Oct 31 07:34:15 2021 +0200 +++ b/Source/Gorgon/Widgets/RadioButtons.h Sun Oct 31 20:31:10 2021 +0200 @@ -221,11 +221,6 @@ rearrange(); } - /// This function is not supported. - int AutomaticUnitSize(int, int = 6) override { - return 0; - } - using UI::RadioControl<T_, W_>::GetColumns; protected:
--- a/Testing/Source/Manual/UI_Generate.cpp Sun Oct 31 07:34:15 2021 +0200 +++ b/Testing/Source/Manual/UI_Generate.cpp Sun Oct 31 20:31:10 2021 +0200 @@ -125,9 +125,9 @@ Gorgon::Widgets::Button icnbtn2("Âj", Gorgon::Widgets::Registry::Button_Icon); Gorgon::Widgets::Button icnbtn3("X", Gorgon::Widgets::Registry::Button_Icon); btn.OwnIcon(icon2.CreateAnimation()); - btn.Size.Width = 2_fr; - btn2.Size.Width = 3_fr; - btn2.Location.X = 2_fr; + btn.Size.Width = 3_fr; + btn2.Size.Width = 4_fr; + btn2.Location.X = 3_fr; icnbtn.OwnIcon(icon2.CreateAnimation()); @@ -322,7 +322,7 @@ wind.Add(btn); wind.Add(btn2); wind.SetMinSize({6,1}); - wind.SetFractionCount(5); + wind.SetFractionCount(7); wind.SetMaxSize({50_perc,8}); btn.Move(Pixels(0,0)); btn.Disable();