* Small fixes to previous changes 4.x-dev

Mon, 25 Oct 2021 06:58:50 +0300

author
cemkalyoncu
date
Mon, 25 Oct 2021 06:58:50 +0300
branch
4.x-dev
changeset 1742
6e10cbe21ea3
parent 1741
29e95844622d
child 1743
ad4507937c5d

* Small fixes to previous changes

Source/Gorgon/UI/Widget.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Widget.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/GeometryBoxes.h file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/UI/Widget.cpp	Sun Oct 24 19:07:17 2021 +0300
+++ b/Source/Gorgon/UI/Widget.cpp	Mon Oct 25 06:58:50 2021 +0300
@@ -191,4 +191,35 @@
         ));
     }
 
+
+    void Widget::parentboundschanged() {
+        //for now
+
+        //move out
+        int unitsize = 0, spacing = 0;
+        Geometry::Size sz;
+        if(HasParent()) {
+            unitsize = GetParent().GetUnitSize();
+            spacing = GetParent().GetSpacing();
+            sz = GetParent().GetInteriorSize();
+        }
+        else {
+            unitsize = Widgets::Registry::Active().GetUnitSize();
+            spacing  = Widgets::Registry::Active().GetSpacing();
+            sz = GetCurrentSize();
+        }
+
+        move(Convert(
+            location, sz,
+            unitsize, spacing,
+            Widgets::Registry::Active().GetEmSize()
+        ));
+
+        resize(Convert(
+            size, sz,
+            unitsize, spacing,
+            Widgets::Registry::Active().GetEmSize()
+        ));
+    }
+
 } }
--- a/Source/Gorgon/UI/Widget.h	Sun Oct 24 19:07:17 2021 +0300
+++ b/Source/Gorgon/UI/Widget.h	Mon Oct 25 06:58:50 2021 +0300
@@ -285,7 +285,7 @@
         virtual void boundschanged();
         
         /// Call this function when the bounds of the parent is changed
-        virtual void parentboundschanged() { }
+        virtual void parentboundschanged();
         
         /// This function is called when the parent's enabled state changes.
         virtual void parentenabledchanged(bool /*state*/) { }
--- a/Source/Gorgon/Widgets/GeometryBoxes.h	Sun Oct 24 19:07:17 2021 +0300
+++ b/Source/Gorgon/Widgets/GeometryBoxes.h	Mon Oct 25 06:58:50 2021 +0300
@@ -83,7 +83,9 @@
     public:
         using Inputbox::operator=;
         
-        using Widget::Move;
+        using Widget::Resize;
+        using Widget::SetWidth;
+        using Widget::SetHeight;
 
 
         /// Initializes the inputbox
@@ -115,7 +117,10 @@
     public:
         using Inputbox::operator=;
 
-        using Widget::Move;
+        using Widget::Resize;
+        using Widget::SetWidth;
+        using Widget::SetHeight;
+
 
 
         /// Initializes the inputbox
@@ -148,6 +153,12 @@
     public:
         using Inputbox::operator=;
 
+        using Widget::Move;
+        using Widget::Resize;
+        using Widget::SetWidth;
+        using Widget::SetHeight;
+
+
         /// Initializes the inputbox
         explicit Boundsbox(const UI::Template &temp, Geometry::Bounds value = {0, 0, 0, 0}) : Inputbox(temp, value) {
         }
@@ -178,6 +189,11 @@
     public:
         using Inputbox::operator=;
 
+        using Widget::Move;
+        using Widget::Resize;
+        using Widget::SetWidth;
+        using Widget::SetHeight;
+
         /// Initializes the inputbox
         explicit Marginbox(const UI::Template &temp, Geometry::Margin value = {0, 0, 0, 0}) : Inputbox(temp, value) {
         }

mercurial