#337 Resize and move functions 4.x-dev

Sun, 24 Oct 2021 19:07:17 +0300

author
cemkalyoncu
date
Sun, 24 Oct 2021 19:07:17 +0300
branch
4.x-dev
changeset 1741
29e95844622d
parent 1740
fe1c233c3a96
child 1742
6e10cbe21ea3

#337 Resize and move functions
* Location and size properties

Source/Gorgon/Scene.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/ComponentStack.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/ComponentStackWidget.h file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Dialog.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Dialog.h file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Dimension.h file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Organizers/Flow.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Organizers/List.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/RadioControl.h file | annotate | diff | comparison | revisions
Source/Gorgon/UI/TooltipManager.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Widget.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/UI/Widget.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/ColorPicker.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/ColorPlane.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/ColorPlane.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Composer.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Composer.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/DialogWindow.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Dropdown.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Listbox.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Panel.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Panel.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/RadioButtons.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/TabPanel.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Window.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Window.h file | annotate | diff | comparison | revisions
Testing/Source/Manual/UI_Component.cpp file | annotate | diff | comparison | revisions
Testing/Source/Manual/UI_Generate.cpp file | annotate | diff | comparison | revisions
Testing/Source/Manual/UI_WidgetTest.cpp file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/Scene.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Scene.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -35,7 +35,7 @@
         main.Add(graphics);
         
         parent->Add(ui);
-        ui.Resize(parent->GetInteriorSize());
+        ui.Resize(UI::Pixels(parent->GetInteriorSize()));
         
         Animation::Governor::Activate();
 
@@ -174,7 +174,7 @@
         Scene(id, mouseinput)
     {
         this->parent = &parent;
-        ui.Resize(parent.GetInteriorSize());
+        ui.Resize(UI::Pixels(parent.GetInteriorSize()));
     }
 
 }
--- a/Source/Gorgon/UI/ComponentStack.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/ComponentStack.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -3839,8 +3839,8 @@
             }
             else if(widgets.Exists(&temp)) {
                 auto &w = widgets[&temp];
-                w.Move(comp.location + offset + target->GetLocation());
-                w.Resize(comp.size);
+                w.Move(Pixels(comp.location + offset + target->GetLocation()));
+                w.Resize(Pixels(comp.size));
             }
             
             if(imagedata.Exists(ph.GetDataEffect())) {
--- a/Source/Gorgon/UI/ComponentStackWidget.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/ComponentStackWidget.h	Sun Oct 24 19:07:17 2021 +0300
@@ -13,7 +13,10 @@
     */
     class ComponentStackWidget : public Widget {
     public:
-        ComponentStackWidget(const Template &temp, std::map<ComponentTemplate::Tag, std::function<Widget *(const Template &)>> generators = {}) : stack(*new ComponentStack(temp, temp.GetSize(), generators)) {
+        ComponentStackWidget(const Template &temp, std::map<ComponentTemplate::Tag, std::function<Widget *(const Template &)>> generators = {}) :
+            Widget(Pixels(temp.GetSize())),
+            stack(*new ComponentStack(temp, temp.GetSize(), generators))
+        {
             stack.SetCeilToUnitSize([this](int s) {
                 int w;
                 if(HasParent()) {
@@ -37,27 +40,13 @@
             delete &stack;
         }
 
-        virtual Geometry::Point GetLocation() const override {
+        virtual Geometry::Point GetCurrentLocation() const override {
             return stack.GetLocation();
         }
 
-        virtual Geometry::Size GetSize() const override {
+        virtual Geometry::Size GetCurrentSize() const override {
             return stack.GetSize();
         }
-        
-        /// Sets the width of the widget in unit widths.
-        virtual void SetWidthInUnits(int n) override {
-            int w, s;
-            if(HasParent()) {
-                w = GetParent().GetUnitSize();
-                s = GetParent().GetSpacing();
-            }
-            else {
-                w = stack.GetTemplate().GetUnitSize();
-                s = stack.GetTemplate().GetSpacing();
-            }
-            SetWidth(w * n + s * (n-1));
-        }
 
         virtual void SetEnabled(bool value) override {
             if(enabled == value)
--- a/Source/Gorgon/UI/Dialog.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Dialog.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -88,7 +88,7 @@
     }
 
     Geometry::Size negotiatesize(Widgets::DialogWindow *diag, Widget *text, bool allowshrink) {
-        text->SetWidth(diag->GetInteriorSize().Width);
+        text->SetWidth(Pixels(diag->GetInteriorSize().Width));
 
         Geometry::Size sz;
         int maxw = int(diag->GetParent().GetInteriorSize().Width * 0.9);
@@ -96,7 +96,7 @@
         bool compact = false;
         
         for(int i=0; i<5; i++) { //maximum 5 iterations
-            sz = text->GetSize();
+            sz = text->GetCurrentSize();
 
             if(!allowshrink)
                 sz.Width = diag->GetInteriorSize().Width;
@@ -106,7 +106,7 @@
                 sz.Width = diag->GetUnitSize() * 6;
                 break;
             }
-            else if(sz.Width <= maxw && sz.Height > diag->GetHeight()) {
+            else if(sz.Width <= maxw && sz.Height > diag->GetCurrentHeight()) {
                 //too high, increase width
                 sz.Width = int(sz.Width * 1.5);
                 if(sz.Width >= maxw) {
@@ -114,8 +114,8 @@
                     return sz;
                 }
                 else {
-                    diag->SetWidth(sz.Width);
-                    text->SetWidth(diag->GetInteriorSize().Width);
+                    diag->SetWidth(Pixels(sz.Width));
+                    text->SetWidth(Pixels(diag->GetInteriorSize().Width));
                 }
                 
                 compact = true;
@@ -126,12 +126,12 @@
         }
         
         if(compact) {
-            text->Move(diag->GetSpacing(), diag->GetSpacing());
+            text->Move(Pixels(diag->GetSpacing(), diag->GetSpacing()));
             sz.Width  += diag->GetSpacing()*2;
             sz.Height += diag->GetSpacing()*2;
         }
         else {
-            text->Move(diag->GetSpacing()*4, diag->GetSpacing()*4);
+            text->Move(Pixels(diag->GetSpacing()*4, diag->GetSpacing()*4));
             sz.Width  += diag->GetSpacing()*8;
             sz.Height += diag->GetSpacing()*8;
         }
@@ -150,15 +150,15 @@
             auto lp = dynamic_cast<Gorgon::Window*>(&layer.GetTopLevel());
             
             if(lp)
-                location = lp->GetMouseLocation() - Geometry::Point(diag->GetSize()/2) - layer.GetEffectiveBounds().TopLeft();
+                location = lp->GetMouseLocation() - Geometry::Point(diag->GetCurrentSize()/2) - layer.GetEffectiveBounds().TopLeft();
         }
         if(dynamic_cast<Gorgon::Window*>(parent)) {
-            location = dynamic_cast<Gorgon::Window*>(parent)->GetMouseLocation() - Geometry::Point(diag->GetSize()/2);
+            location = dynamic_cast<Gorgon::Window*>(parent)->GetMouseLocation() - Geometry::Point(diag->GetCurrentSize()/2);
         }
         
         if(location != Geometry::Point{std::numeric_limits<int>::min(), std::numeric_limits<int>::min()}) {
             auto psz = diag->GetParent().GetInteriorSize();
-            auto sz  = diag->GetSize();
+            auto sz  = diag->GetCurrentSize();
             
             if(location.X < 0)
                 location.X = 0;
@@ -169,12 +169,12 @@
             if(location.Y + sz.Height > psz.Height)
                 location.Y = psz.Height - sz.Height;
             
-            diag->Move(location);
+            diag->Move(Pixels(location));
         }
         else {
-            auto sz = diag->GetParent().GetInteriorSize() - diag->GetSize();
+            auto sz = diag->GetParent().GetInteriorSize() - diag->GetCurrentSize();
             sz /= 10;
-            diag->Move(Geometry::Point(sz * std::min(10, (int)internal::dialogs.GetCount()+3)));
+            diag->Move(Pixels(Geometry::Point(sz * std::min(10, (int)internal::dialogs.GetCount()+3))));
         }
         
         diag->Focus();
@@ -267,7 +267,7 @@
                 closethis(diag);
                 onselect(index);
             });
-            btn.SetWidthInUnits(10); //allow up to 10 units
+            btn.SetWidth(Units(10)); //allow up to 10 units
             btn.SetHorizonalAutosize(Autosize::Automatic);
             
             buttontexts += opt + " | ";
@@ -295,11 +295,11 @@
 
         int totw = 0;
         for(auto &w : btnsarea) {
-            totw += w.GetWidth();
+            totw += w.GetCurrentWidth();
         }
         totw += diag->ButtonAreaOrganizer().GetSpacing() * (btnsarea.GetCount()-1);
 
-        if(totw > diag->GetWidth())
+        if(totw > diag->GetCurrentWidth())
             diag->ResizeInterior({totw, diag->GetInteriorSize().Height});
 
         diag->ResizeInterior(negotiatesize(diag, text, false));
@@ -411,16 +411,17 @@
         text->SetAutosize(Autosize::Automatic, Autosize::Automatic);
         diag->Add(*text);
         diag->Own(*text);
-        inp->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+        inp->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
         
         Widgets::Label *l = nullptr;
         
         if(!label.empty()) {
             l = new Widgets::Label(label);
             l->SetHorizonalAutosize(Autosize::Automatic);
-            l->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+            l->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
             l->SetHeight(inp->GetHeight());
-            inp->Location.X = l->GetBounds().Right + diag->GetSpacing()*2;
+            //TODO
+            //inp->Location.X = l->GetBounds().Right + diag->GetSpacing()*2;
             
             diag->Add(*l);
             diag->Own(*l);
@@ -464,21 +465,19 @@
         );
         
         diag->ResizeInterior(negotiatesize(diag, text, false));
-        
         if(l) {
-            l->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
+            l->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
             l->SetHeight(inp->GetHeight());
-            inp->Move(l->GetBounds().Right + diag->GetSpacing()*2, l->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - inp->Location.X - text->Location.X);
+            inp->Move(Pixels(l->GetBounds().Right + diag->GetSpacing()*2, l->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - inp->GetCurrentLocation().X - text->GetCurrentLocation().X));
         }
         else {
-            inp->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - text->Location.X*2);
+            inp->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - text->GetCurrentLocation().X*2));
         }
         
         diag->ResizeInterior({diag->GetInteriorSize().Width, inp->GetBounds().Bottom});
-        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->Location));
-        
+        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->GetCurrentLocation()));
         place(diag);
         diag->Center(); //input dialogs will be centered
     }
--- a/Source/Gorgon/UI/Dialog.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Dialog.h	Sun Oct 24 19:07:17 2021 +0300
@@ -329,16 +329,16 @@
         text->SetAutosize(Autosize::Automatic, Autosize::Automatic);
         diag->Add(*text);
         diag->Own(*text);
-        inp->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+        inp->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
         
         Widgets::Label *l = nullptr;
         
         if(!label.empty()) {
             l = new Widgets::Label(label);
             l->SetHorizonalAutosize(Autosize::Automatic);
-            l->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+            l->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
             l->SetHeight(inp->GetHeight());
-            inp->Location.X = l->GetBounds().Right + diag->GetSpacing()*2;
+            inp->Location.X = Pixels(l->GetBounds().Right + diag->GetSpacing()*2);
             
             diag->Add(*l);
             diag->Own(*l);
@@ -375,21 +375,21 @@
         );
         
         diag->ResizeInterior(negotiatesize(diag, text, false));
-        
         if(l) {
-            l->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
+            l->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
             l->SetHeight(inp->GetHeight());
-            inp->Move(l->GetBounds().Right + diag->GetSpacing()*2, l->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - inp->Location.X - text->Location.X);
+            inp->Move(Pixels(l->GetBounds().Right + diag->GetSpacing()*2, l->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - inp->GetCurrentLocation().X - text->GetCurrentLocation().X));
         }
         else {
-            inp->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - text->Location.X*2);
+            inp->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - text->GetCurrentLocation().X*2));
         }
+
         
         diag->ResizeInterior({diag->GetInteriorSize().Width, inp->GetBounds().Bottom});
-        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->Location));
-        
+        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->GetCurrentLocation()));
+
         place(diag);
         diag->Center(); //input dialogs will be centered
     }
@@ -578,16 +578,16 @@
         text->SetAutosize(Autosize::Automatic, Autosize::Automatic);
         diag->Add(*text);
         diag->Own(*text);
-        inp->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+        inp->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
         
         Widgets::Label *l = nullptr;
         
         if(!label.empty()) {
             l = new Widgets::Label(label);
             l->SetHorizonalAutosize(Autosize::Automatic);
-            l->Move(0, text->GetBounds().Bottom + diag->GetSpacing());
+            l->Move(Pixels(0, text->GetBounds().Bottom + diag->GetSpacing()));
             l->SetHeight(inp->GetHeight());
-            inp->Location.X = l->GetBounds().Right + diag->GetSpacing()*2;
+            inp->Location.X = Pixels(l->GetBounds().Right + diag->GetSpacing()*2);
             
             diag->Add(*l);
             diag->Own(*l);
@@ -631,21 +631,19 @@
         );
         
         diag->ResizeInterior(negotiatesize(diag, text, false));
-        
         if(l) {
-            l->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
+            l->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
             l->SetHeight(inp->GetHeight());
-            inp->Move(l->GetBounds().Right + diag->GetSpacing()*2, l->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - inp->Location.X - text->Location.X);
+            inp->Move(Pixels(l->GetBounds().Right + diag->GetSpacing()*2, l->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - inp->GetCurrentLocation().X - text->GetCurrentLocation().X));
         }
         else {
-            inp->Move(text->Location.X, text->GetBounds().Bottom + text->Location.Y);
-            inp->SetWidth(diag->GetInteriorSize().Width - text->Location.X*2);
+            inp->Move(Pixels(text->GetCurrentLocation().X, text->GetBounds().Bottom + text->GetCurrentLocation().Y));
+            inp->SetWidth(Pixels(diag->GetInteriorSize().Width - text->GetCurrentLocation().X*2));
         }
         
         diag->ResizeInterior({diag->GetInteriorSize().Width, inp->GetBounds().Bottom});
-        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->Location));
-        
+        diag->ResizeInterior(Geometry::Size(inp->GetBounds().BottomRight() + text->GetCurrentLocation()));
         place(diag);
         diag->Center(); //input dialogs will be centered
     }
--- a/Source/Gorgon/UI/Dimension.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Dimension.h	Sun Oct 24 19:07:17 2021 +0300
@@ -42,48 +42,48 @@
             MilliUnitSize,
 
         };
+    private:
 
-        /// Constructs a new dimension or type casts integer to dimension
-        Dimension(int value = 0, Unit unit = Pixel) : value(value), unit(unit) {/* implicit */
-        }
-
-
-        /// Constructs a new dimension or type casts real number to dimension
-        Dimension(double value, Unit unit = Percent) {
+        constexpr int dimension_calc(double value, Unit unit) {
             switch(unit) {
             case Percent:
-                Set(int(std::round(value * 100)), unit);
-                break;
+                return int(std::round(value * 100));
             case MilliPixel:
-                Set(int(std::round(value * 1000)), unit);
-                break;
+                return int(std::round(value * 1000));
             case BasisPoint:
-                Set(int(std::round(value * 10000)), unit);
-                break;
+                return int(std::round(value * 10000));
             case EM:
-                Set(int(std::round(value * 100)), unit);
-                break;
+                return int(std::round(value * 100));
             case MilliUnitSize:
-                Set(int(std::round(value * 1000)), unit);
-                break;
+                return int(std::round(value * 1000));
             default:
-                Set(int(std::round(value)), unit);
-                break;
+                return int(std::round(value));
             }
         }
 
+    public:
+
+        /// Constructs a new dimension or type casts integer to dimension
+        constexpr Dimension(int value = 0, Unit unit = Pixel) : value(value), unit(unit) {/* implicit */
+        }
+
         /// Constructs a new dimension or type casts real number to dimension
-        Dimension(float value, Unit unit = Percent) : Dimension((double)value, unit) {
+        constexpr Dimension(double value, Unit unit = Percent) : value(dimension_calc(value, unit)), unit(unit) {
+
+        }
+
+        /// Constructs a new dimension or type casts real number to dimension
+        constexpr Dimension(float value, Unit unit = Percent) : Dimension((double)value, unit) {
 
         }
 
         /// Returns the calculated dimension in pixels
-        int operator ()(int parentwidth, int unitsize, int spacing, int emwidth = 10, bool issize = false) const {
+        constexpr int operator ()(int parentwidth, int unitsize, int spacing, int emwidth = 10, bool issize = false) const {
             return Calculate(parentwidth, unitsize, spacing, emwidth, issize);
         }
 
         /// Returns the calculated dimension in pixels
-        int Calculate(int parentwidth, int unitsize, int spacing, int emwidth = 10, bool issize = false) const {
+        constexpr int Calculate(int parentwidth, int unitsize, int spacing, int emwidth = 10, bool issize = false) const {
             switch(unit) {
                 case Percent:
                     return int(std::round((double)value * parentwidth / 100));
@@ -112,7 +112,7 @@
         }
 
         /// Returns the calculated dimension in pixels
-        float CalculateFloat(float parentwidth, int unitsize, int spacing, float emwidth = 10, bool issize = false) const {
+        constexpr float CalculateFloat(float parentwidth, int unitsize, int spacing, float emwidth = 10, bool issize = false) const {
             switch(unit) {
                 case Percent:
                     return (float)value * parentwidth / 100.f;
@@ -137,32 +137,40 @@
         }
         
         /// Returns if the dimension is relative to the parentwidth
-        bool IsRelative() const {
+        constexpr bool IsRelative() const {
             return unit == Percent || unit == BasisPoint;
         }
 
         /// Returns the value of the dimension, should not be considered as
         /// pixels
-        int GetValue() const {
+        constexpr int GetValue() const {
             return value;
         }
 
         /// Returns the unit of the dimension
-        Unit GetUnit() const {
+        constexpr Unit GetUnit() const {
             return unit;
         }
 
         /// Changes the value of the dimension without modifying the units
-        void Set(int value) {
+        constexpr void Set(int value) {
             this->value = value;
         }
 
         /// Changes the value and unit of the dimension.
-        void Set(int value, Unit unit) {
+        constexpr void Set(int value, Unit unit) {
             this->value = value;
             this->unit = unit;
         }
 
+        constexpr bool operator ==(const Dimension &other) const {
+            return other.unit == unit && other.value == value;
+        }
+
+        constexpr bool operator !=(const Dimension &other) const {
+            return !(*this == other);
+        }
+
     private:
         int value;
         Unit unit;
@@ -172,16 +180,21 @@
     /// doubles for automatic conversion
     class UnitDimension : public Dimension {
     public:
-        UnitDimension(int value, Unit unit = UnitSize) : Dimension(value, unit) {
+        /*constexpr UnitDimension(int value = 0, Unit unit = UnitSize) : Dimension(value, unit) {
+        }*/
+
+        constexpr UnitDimension() : Dimension() { }
+
+        constexpr UnitDimension(int value, Unit unit) : Dimension(value, unit) {
         }
 
-        UnitDimension(double value, Unit unit = MilliUnitSize) : Dimension(value, unit) {
+        constexpr UnitDimension(double value, Unit unit/* = MilliUnitSize*/) : Dimension(value, unit) {
         }
 
-        UnitDimension(float value, Unit unit = MilliUnitSize) : Dimension((double)value, unit) {
+        constexpr UnitDimension(float value, Unit unit/* = MilliUnitSize*/) : Dimension((double)value, unit) {
         }
 
-        UnitDimension(const Dimension &d) : Dimension(d) { }
+        constexpr UnitDimension(const Dimension &d) : Dimension(d) { }
     };
 
     /// This class stores the location information for a box object
@@ -190,6 +203,12 @@
     /// This class stores the size information for a box object
     using Size = Geometry::basic_Size<Dimension>;
 
+    /// This class stores the location information for a box object
+    using UnitPoint = Geometry::basic_Point<UnitDimension>;
+
+    /// This class stores the size information for a box object
+    using UnitSize = Geometry::basic_Size<UnitDimension>;
+
     /// This class stores the margin information for a box object
     using Margin = Geometry::basic_Margin<Dimension>;
     
@@ -197,15 +216,172 @@
     inline Geometry::Point Convert(const Point &p, const Geometry::Size &parent, int unitsize, int spacing, int emwidth = 10) {
         return {p.X(parent.Width, unitsize, spacing, emwidth), p.Y(parent.Height, unitsize, spacing, emwidth)};
     }
-    
+
     /// Converts a dimension based size to pixel based size
     inline Geometry::Size Convert(const Size &s, const Geometry::Size &parent, int unitsize, int spacing, int emwidth = 10) {
         return {s.Width(parent.Width, unitsize, spacing, emwidth, true), s.Height(parent.Height, unitsize, spacing, emwidth, true)};
     }
-    
+
+    /// Converts a dimension based point to pixel based point
+    inline Geometry::Point Convert(const UnitPoint &p, const Geometry::Size &parent, int unitsize, int spacing, int emwidth = 10) {
+        return {p.X(parent.Width, unitsize, spacing, emwidth), p.Y(parent.Height, unitsize, spacing, emwidth)};
+    }
+
+    /// Converts a dimension based size to pixel based size
+    inline Geometry::Size Convert(const UnitSize &s, const Geometry::Size &parent, int unitsize, int spacing, int emwidth = 10) {
+        return {s.Width(parent.Width, unitsize, spacing, emwidth, true), s.Height(parent.Height, unitsize, spacing, emwidth, true)};
+    }
+
     /// Converts a dimension based margin to pixel based margin
     inline Geometry::Margin Convert(const Margin &m, const Geometry::Size &parent, int unitsize, int spacing, int emwidth = 10) {
         return {m.Left(parent.Width, unitsize, spacing, emwidth), m.Top(parent.Height, unitsize, spacing, emwidth), m.Right(parent.Width, unitsize, spacing, emwidth), m.Bottom(parent.Height, unitsize, spacing, emwidth), };
     }
 
+    /// Converts the given value to dimension with pixel units
+    inline constexpr Dimension Pixels(int val) {
+        return {val, Dimension::Pixel};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline constexpr Dimension Percentage(int val) {
+        return {val, Dimension::Percent};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline constexpr Dimension Percentage(double val) {
+        return {val, Dimension::Percent};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline constexpr Dimension Percentage(float val) {
+        return {val, Dimension::Percent};
+    }
+
+    /// Converts the given value to dimension with unit size
+    inline constexpr Dimension Units(int val) {
+        return {val, Dimension::UnitSize};
+    }
+
+    /// Converts the given value to dimension with unit size
+    inline constexpr Dimension Units(float val) {
+        return {val, Dimension::UnitSize};
+    }
+
+    /// Converts the given value to dimension with unit size
+    inline constexpr Dimension Units(double val) {
+        return {val, Dimension::UnitSize};
+    }
+
+    class DualDimension {
+    public:
+        Dimension one, two;
+
+        operator Point() const {
+            return {one, two};
+        }
+
+        operator UnitPoint() const {
+            return {one, two};
+        }
+
+        operator Size() const {
+            return {one, two};
+        }
+
+        operator UnitSize() const {
+            return {one, two};
+        }
+    };
+
+    /// Converts the given value to dimension with pixel units
+    inline constexpr DualDimension Pixels(int one, int two) {
+        return {{one, Dimension::Pixel}, {two, Dimension::Pixel}};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline constexpr DualDimension Percentage(int one, int two) {
+        return {{one, Dimension::Percent}, {two, Dimension::Percent}};
+    }
+
+    /// Converts the given one, given twoue to dimension with percentage units
+    inline constexpr DualDimension Percentage(double one, double two) {
+        return {{one, Dimension::Percent}, {two, Dimension::Percent}};
+    }
+
+    /// Converts the given one, given twoue to dimension with percentage units
+    inline constexpr DualDimension Percentage(float one, float two) {
+        return {{one, Dimension::Percent}, {two, Dimension::Percent}};
+    }
+
+    /// Converts the given one, given twoue to dimension with unit size
+    inline constexpr DualDimension Units(int one, int two) {
+        return {{one, Dimension::UnitSize}, {two, Dimension::UnitSize}};
+    }
+
+    /// Converts the given one, given twoue to dimension with unit size
+    inline constexpr DualDimension Units(float one, float two) {
+        return {{one, Dimension::MilliUnitSize}, {two, Dimension::MilliUnitSize}};
+    }
+
+    /// Converts the given one, given twoue to dimension with unit size
+    inline constexpr DualDimension Units(double one, double two) {
+        return {{one, Dimension::MilliUnitSize}, {two, Dimension::MilliUnitSize}};
+    }
+
+    /// Converts the given value to dimension with pixel units
+    inline Point Pixels(const Geometry::Point &val) {
+        return {{val.X, Dimension::Pixel}, {val.Y, Dimension::Pixel}};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline Point Percentage(const Geometry::Point &val) {
+        return {{val.X, Dimension::Percent}, {val.Y, Dimension::Percent}};
+    }
+
+    /// Converts the given value to dimension with unit size
+    inline Point Units(const Geometry::Point &val) {
+        return {{val.X, Dimension::UnitSize}, {val.Y, Dimension::UnitSize}};
+    }
+
+    /// Converts the given value to dimension with pixel units
+    inline Size Pixels(const Geometry::Size &val) {
+        return {{val.Width, Dimension::Pixel}, {val.Height, Dimension::Pixel}};
+    }
+
+    /// Converts the given value to dimension with percentage units
+    inline Size Percentage(const Geometry::Size &val) {
+        return {{val.Width, Dimension::Percent}, {val.Height, Dimension::Percent}};
+    }
+
+    /// Converts the given value to dimension with unit size
+    inline Size Units(const Geometry::Size &val) {
+        return {{val.Width, Dimension::UnitSize}, {val.Height, Dimension::UnitSize}};
+    }
+
+    namespace literals {
+        inline Dimension operator""_px(unsigned long long val) {
+            return Pixels(int(val));
+        }
+
+        inline Dimension operator""_px(long double val) {
+            return {(double)val, Dimension::MilliPixel};
+        }
+
+        inline Dimension operator""_perc(unsigned long long val) {
+            return Percentage(int(val));
+        }
+
+        inline Dimension operator""_perc(long double val) {
+            return Percentage(double(val));
+        }
+
+        inline Dimension operator""_u(unsigned long long val) {
+            return Units(int(val));
+        }
+
+        inline Dimension operator""_u(long double val) {
+            return Units(double(val));
+        }
+    }
+
 } }
--- a/Source/Gorgon/UI/Organizers/Flow.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Organizers/Flow.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -55,10 +55,10 @@
                 }
                 
                 for(auto &cell : row) {
-                    cell.Move(
-                        cell.GetLocation() + 
-                        Geometry::Point{off, (maxy - cell.GetHeight())/2}
-                    );
+                    cell.Move(Pixels(
+                        cell.GetCurrentLocation() +
+                        Geometry::Point{off, (maxy - cell.GetCurrentHeight())/2}
+                    ));
                 }
                 
                 x = 0;
@@ -103,7 +103,7 @@
                     continue;
                 }
                 
-                int w = widget.GetWidth();
+                int w = widget.GetCurrentWidth();
                 
                 if((x + w > width && rowc > 0) && breaks == 0)
                     breaks = 1;
@@ -119,12 +119,12 @@
                 x += xoff;
                 align = nextalign;
 
-                int h = widget.GetHeight();
+                int h = widget.GetCurrentHeight();
                 if(h > maxy) {
                     maxy = h;
                 }
                 
-                widget.Move(x, y);
+                widget.Move(Pixels(x, y));
                 x += w + s;
                 rowc++;
                 
@@ -182,7 +182,7 @@
 
     Flow &Flow::Add(Widget &widget) {
         if(nextsize != -1) {
-            widget.SetWidthInUnits(nextsize);
+            widget.SetWidth(Units(nextsize));
             nextsize = -1;
         }
         
--- a/Source/Gorgon/UI/Organizers/List.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Organizers/List.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -11,10 +11,10 @@
         
         for(auto &widget : GetAttached()) {
             if(widget.IsVisible() && !widget.IsFloating()) {
-                widget.Move(0, y);
-                widget.SetWidth(w);
+                widget.Move(Pixels(0, y));
+                widget.SetWidth(Pixels(w));
                 
-                y += widget.GetHeight() + s;
+                y += widget.GetCurrentHeight() + s;
             }
         }
     }
--- a/Source/Gorgon/UI/RadioControl.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/RadioControl.h	Sun Oct 24 19:07:17 2021 +0300
@@ -185,16 +185,16 @@
                 
                 container.Add(*w);
                 
-                w->Move(loc);
+                w->Move(Pixels(loc));
                 
                 col++;
                 if(col%columns == 0) {
                     loc.X = start.X;
-                    loc.Y += w->GetSize().Height + spacing;
+                    loc.Y += w->GetCurrentHeight() + spacing;
                     col = 0;
                 }
                 else {
-                    loc.X += w->GetSize().Width + spacing;
+                    loc.X += w->GetCurrentWidth() + spacing;
                 }
             }
         }
--- a/Source/Gorgon/UI/TooltipManager.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/TooltipManager.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -234,7 +234,7 @@
         
         if(target->IsVisible() && target->HasParent()) {
             auto offset = loc - target->GetParent().GetLayer().TranslateToTopLevel({0, 0}) + Geometry::Point(0, Widgets::Registry::Active().GetEmSize());
-            auto size   = target->GetSize();
+            auto size   = target->GetCurrentSize();
             auto csize = target->GetParent().GetLayer().GetCalculatedSize();
             
             if(offset.X + size.Width > csize.Width) {
@@ -245,7 +245,7 @@
                 offset.Y = csize.Height - size.Height;
             }
             
-            target->Move(offset);
+            target->Move(Pixels(offset));
         }
     }
     
--- a/Source/Gorgon/UI/Widget.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Widget.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -1,38 +1,39 @@
 #include "Widget.h"
 #include "WidgetContainer.h"
+#include "../Widgets/Registry.h"
 
 namespace Gorgon { namespace UI {
 
-	bool Widget::Remove() {
-		if(!parent)
-			return true;
+    bool Widget::Remove() {
+        if(!parent)
+            return true;
 
-		return parent->Remove(*this);
-	}
+        return parent->Remove(*this);
+    }
 
-	bool Widget::Focus() {
-		if(!parent)
-			return false;
+    bool Widget::Focus() {
+        if(!parent)
+            return false;
 
-		if(!allowfocus() || !visible || !enabled)
-			return false;
+        if(!allowfocus() || !visible || !enabled)
+            return false;
 
-		return parent->SetFocusTo(*this);
-	}
+        return parent->SetFocusTo(*this);
+    }
 
-	bool Widget::Defocus() {
-		if(!IsFocused() || !parent)
-			return true;
+    bool Widget::Defocus() {
+        if(!IsFocused() || !parent)
+            return true;
 
-		return parent->RemoveFocus();
-	}
+        return parent->RemoveFocus();
+    }
 
-	WidgetContainer &Widget::GetParent() const {
-		if(parent == nullptr)
-			throw std::runtime_error("Widget has no parent");
+    WidgetContainer &Widget::GetParent() const {
+        if(parent == nullptr)
+            throw std::runtime_error("Widget has no parent");
 
-		return *parent;
-	}
+        return *parent;
+    }
 
 
     void Widget::SetVisible(bool value) {
@@ -135,4 +136,59 @@
         MouseLeaveEvent();
     }
 
+
+    void Widget::Move(const UnitPoint &value) {
+        if(location == value)
+            return;
+
+        location = value;
+
+        //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()
+        ));
+    }
+
+    void Widget::Resize(const UnitSize& value) {
+        if(size == value)
+            return;
+
+        size = value;
+
+        //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();
+        }
+
+        resize(Convert(
+            size, sz,
+            unitsize, spacing,
+            Widgets::Registry::Active().GetEmSize()
+        ));
+    }
+
 } }
--- a/Source/Gorgon/UI/Widget.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/UI/Widget.h	Sun Oct 24 19:07:17 2021 +0300
@@ -6,6 +6,7 @@
 #include "../Property.h"
 #include "../Geometry/PointProperty.h"
 #include "../Geometry/SizeProperty.h"
+#include "Dimension.h"
 
 namespace Gorgon { namespace UI {
 
@@ -15,69 +16,70 @@
     * This class is the base for all widgets. 
     */
     class Widget {
-    friend class WidgetContainer;
-        //Non-virtual functions for visual studio
-
-        virtual void resize(const Geometry::Size &size) = 0;
+        friend class WidgetContainer;
 
-        Geometry::Size getsize() const {
-            return GetSize();
-        }
-
-        virtual void move(const Geometry::Point &value) = 0;
-
-        Geometry::Point getlocation() const {
-            return GetLocation();
-        }
-        
     public:
         
-        Widget() : Location(this), Size(this), Tooltip(this) {
+        explicit Widget(const UnitSize &size) : Location(this), Size(this), Tooltip(this), size(size) {
         }
         
         Widget(Widget &&) = default;
         
         virtual ~Widget();
         
-        /// Moves this widget to the given position.
-        void Move(int x, int y) { Move({x, y}); }
+        /// Moves this widget to the given position. Widget might be
+        /// moved by organizers.
+        void Move(UnitDimension x, UnitDimension y) { Move({x, y}); }
         
         /// Moves this widget to the given position.
-        void Move(const Geometry::Point &location) {
-            move(location);
+        void Move(const UnitPoint &value);
+
+        /// Returns the location of the widget. This is the assigned location
+        /// and may not reflect actual position. Widget might be moved by
+        /// organizers.
+        UnitPoint GetLocation() const {
+            return location;
         }
 
-        /// Returns the location of the widget
-        virtual Geometry::Point GetLocation() const = 0;
+        /// Returns the current location of the widget in pixels. This might
+        /// be different than location that is set.
+        virtual Geometry::Point GetCurrentLocation() const = 0;
 
         /// Changes the size of the widget.
-        virtual void Resize(int w, int h) { Resize({w, h}); };
+        virtual void Resize(UnitDimension w, UnitDimension h) { Resize({w, h}); };
 
         /// Changes the size of the widget.
-        virtual void Resize(const Geometry::Size &size) {
-            resize(size);
-        }
+        virtual void Resize(const UnitSize &size);
 
         /// Returns the size of the widget
-        virtual Geometry::Size GetSize() const = 0;
+        UnitSize GetSize() const {
+            return size;
+        }
+
+        /// Returns the current size of the widget in pixels. This might be
+        /// different than the size that is set.
+        virtual Geometry::Size GetCurrentSize() const = 0;
         
-        /// Returns the bounds of the widget
-        Geometry::Bounds GetBounds() const { return {GetLocation(), GetSize()}; }
+        /// Returns the bounds of the widget in pixels.
+        Geometry::Bounds GetBounds() const { return {GetCurrentLocation(), GetCurrentSize()}; }
         
         /// Returns the width of the widget
-        int GetWidth() const { return GetSize().Width; }
+        UnitDimension GetWidth() const { return GetSize().Width; }
         
         /// Returns the height of the widget
-        int GetHeight() const { return GetSize().Height; }
+        UnitDimension GetHeight() const { return GetSize().Height; }
         
+        /// Returns the width of the widget in pixels.
+        int GetCurrentWidth() const { return GetCurrentSize().Width; }
+
+        /// Returns the height of the widget in pixels.
+        int GetCurrentHeight() const { return GetCurrentSize().Height; }
+
         /// Sets the width of the widget
-        void SetWidth(int width) { Resize(width, GetHeight()); }
-        
-        /// Sets the width of the widget in unit widths.
-        virtual void SetWidthInUnits(int n) = 0;
+        void SetWidth(UnitDimension width) { Resize(width, GetHeight()); }
         
         /// Sets the height of the widget
-        void SetHeight(int height) { Resize(GetWidth(), height); }
+        void SetHeight(UnitDimension height) { Resize(GetWidth(), height); }
         
         /// Activates the widget. This might perform the action if the
         /// widget is a button, forward the focus if it is a label or
@@ -221,8 +223,8 @@
         /// invalidated in the event handlers registered to this function.
         Event<Widget> DestroyedEvent        = Event<Widget>{*this};
         
-        Geometry::PointProperty<Widget, &Widget::getlocation, &Widget::Move> Location;
-        Geometry::SizeProperty<Widget, &Widget::getsize, &Widget::Resize> Size;
+        Geometry::basic_PointProperty<Widget, UnitPoint, &Widget::GetLocation, &Widget::Move> Location;
+        Geometry::basic_SizeProperty<Widget, UnitSize, &Widget::GetSize, &Widget::Resize> Size;
         TextualProperty<Widget, std::string, &Widget::GetTooltip, &Widget::SetTooltip> Tooltip;
         
         /// This is a debug feature
@@ -237,6 +239,12 @@
 #endif
 
     protected:
+        /// Should resize the widget in pixels
+        virtual void resize(const Geometry::Size &size) = 0;
+
+        /// Should move the widget in pixels
+        virtual void move(const Geometry::Point &value) = 0;
+
         /// Called when it is about to be added to the given container
         virtual bool addingto(WidgetContainer &) { return true; }
         
@@ -293,12 +301,16 @@
         virtual void mouseleave();
         
         std::string tooltip;
+
         
     private:
         bool visible = true;
         bool enabled = true;
         bool focus   = false;
         bool floating= false;
+
+        UnitPoint location;
+        UnitSize  size;
         
         /// Never call this function
         virtual void hide() = 0;
@@ -310,4 +322,12 @@
     };
     
     
-} }
+}
+namespace Widgets {
+    using UI::Pixels;
+    using UI::Percentage;
+    using UI::Units;
+    using UI::Dimension;
+    using UI::UnitDimension;
+}
+}
--- a/Source/Gorgon/Widgets/ColorPicker.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/ColorPicker.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -13,7 +13,7 @@
     {
         stack.AddGenerator(UI::ComponentTemplate::ListTag, {}); 
         
-        defaultsize  = plane.GetSize();
+        defaultsize  = plane.GetCurrentSize();
         
         updatevaluedisplay(false);
         
@@ -96,7 +96,7 @@
         
         opened = true;
         
-        int below = res.TotalSize.Height-res.CoordinatesInExtender.Y-GetHeight();
+        int below = res.TotalSize.Height - res.CoordinatesInExtender.Y - GetCurrentHeight();
         int above = res.CoordinatesInExtender.Y;
         reversed  = false;
         
@@ -105,31 +105,31 @@
         plane.LCDensity  = lcdensity;
         
         if(below < defaultsize.Height && above > below) {
-            plane.SetHeight(std::min(defaultsize.Height, above));
+            plane.SetHeight(Pixels(std::min(defaultsize.Height, above)));
                 
             reversed = true;
         }
         else {
-            plane.SetHeight(std::min(defaultsize.Height, below));
+            plane.SetHeight(Pixels(std::min(defaultsize.Height, below)));
         }
         
-        int targetx = res.CoordinatesInExtender.X - (defaultsize.Width - GetWidth());
+        int targetx = res.CoordinatesInExtender.X - (defaultsize.Width - GetCurrentWidth());
         
         if(targetx < 0) {
-            plane.SetWidth(std::min(defaultsize.Width, res.TotalSize.Width - res.CoordinatesInExtender.X));
+            plane.SetWidth(Pixels(std::min(defaultsize.Width, res.TotalSize.Width - res.CoordinatesInExtender.X)));
             
             targetx = 0;
         }
         else {
-            plane.SetWidth(defaultsize.Width);
+            plane.SetWidth(Pixels(defaultsize.Width));
         }
         
         
         if(reversed) {
-            plane.Move(targetx, res.CoordinatesInExtender.Y - plane.GetHeight());
+            plane.Move(Pixels(targetx, res.CoordinatesInExtender.Y - plane.GetCurrentHeight()));
         }
         else {
-            plane.Move(targetx, res.CoordinatesInExtender.Y + GetHeight());
+            plane.Move(Pixels(targetx, res.CoordinatesInExtender.Y + GetCurrentHeight()));
         }
         
         //plane.SetWidth(GetWidth());
--- a/Source/Gorgon/Widgets/ColorPlane.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/ColorPlane.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -18,10 +18,10 @@
         inputlayer.SetClick(this, &ColorPlane::click);
     }
     
-    void ColorPlane::Resize(const Geometry::Size &size) {
+    void ColorPlane::resize(const Geometry::Size &size) {
         auto oldsz = getinteriorsize();
 
-        ComponentStackWidget::Resize(size);
+        ComponentStackWidget::resize(size);
         
         auto newsz = getinteriorsize();
 
--- a/Source/Gorgon/Widgets/ColorPlane.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/ColorPlane.h	Sun Oct 24 19:07:17 2021 +0300
@@ -80,9 +80,6 @@
         
         //SetCellSize
         
-        using ComponentStackWidget::Resize;
-        
-        virtual void Resize(const Geometry::Size &size) override;
         
         void Refresh();
         
@@ -120,6 +117,8 @@
         ColorType color = Graphics::Color::Black;
     
     protected:
+        virtual void resize(const Geometry::Size &size) override;
+
         void click(Geometry::Point location);
         
         Gorgon::Layer &getlayer() const {
--- a/Source/Gorgon/Widgets/Composer.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Composer.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -4,7 +4,10 @@
 
 namespace Gorgon { namespace Widgets {
 
-    Composer::Composer() {
+    Composer::Composer(const UI::UnitSize &size) :
+        Widget(Pixels(0, 0)) //Resize is needed to convert unitsize to pixels
+    {
+        Resize(size);
         base.Add(inputlayer);
         
         inputlayer.SetOver([this]{
@@ -88,7 +91,7 @@
 
             if(ans.Extender) {
                 if(!ans.Transformed)
-                    ans.CoordinatesInExtender += GetLocation();
+                    ans.CoordinatesInExtender += GetCurrentLocation();
 
                 return ans;
             }
@@ -117,22 +120,6 @@
     }
     
 
-    void Composer::SetWidthInUnits(int n) {
-        int w, s;
-
-        if(HasParent()) {
-            w = GetParent().GetUnitSize();
-            s = GetParent().GetSpacing();
-        }
-        else {
-            w = Registry::Active().GetUnitSize();
-            s = Registry::Active().GetSpacing();
-        }
-
-        SetWidth(w * n + s * (n - 1));
-    }
-
-    
     bool ComponentStackComposer::Activate() {
         if(!Focus())
             return false;
@@ -196,7 +183,7 @@
 
             if(ans.Extender) {
                 if(!ans.Transformed)
-                    ans.CoordinatesInExtender += GetLocation();
+                    ans.CoordinatesInExtender += GetCurrentLocation();
 
                 return ans;
             }
@@ -224,19 +211,4 @@
         }
     }
 
-    void ComponentStackComposer::SetWidthInUnits(int n) {
-        int w, s;
-
-        if(HasParent()) {
-            w = GetParent().GetUnitSize();
-            s = GetParent().GetSpacing();
-        }
-        else {
-            w = Registry::Active().GetUnitSize();
-            s = Registry::Active().GetSpacing();
-        }
-
-        SetWidth(w * n + s * (n - 1));
-    }
-
 } }
--- a/Source/Gorgon/Widgets/Composer.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Composer.h	Sun Oct 24 19:07:17 2021 +0300
@@ -24,8 +24,6 @@
     public:
         ~Composer() { }
         
-        using Widget::Resize;
-    
         using Widget::Move;
 
         using Widget::Remove;
@@ -39,18 +37,17 @@
             return base.IsVisible() && IsVisible() && HasParent() && GetParent().IsDisplayed();
         }
 
-        
-        virtual Geometry::Size GetSize() const override {
+        virtual Geometry::Size GetCurrentSize() const override {
             return base.GetSize();
         }
 
         virtual bool ResizeInterior(Geometry::Size size) override {
-            Resize(size);
+            Resize(Pixels(size));
             
             return true;
         }
 
-        virtual Geometry::Point GetLocation() const override {
+        virtual Geometry::Point GetCurrentLocation() const override {
             return base.GetLocation();
         }
         
@@ -77,9 +74,6 @@
         virtual bool IsEnabled() const override {
             return enabled;
         }
-
-        /// Sets the width of the widget in unit widths.
-        void SetWidthInUnits(int n) override;
         
         /// This function should be called whenever a key is pressed or released.
         virtual bool KeyPressed(Input::Key key, float state) override { return distributekeyevent(key, state, true); }
@@ -90,7 +84,7 @@
 
     protected:
         //ensure this object is derived
-        Composer();
+        Composer(const UI::UnitSize &size);
         
         virtual bool allowfocus() const override;
         
@@ -171,12 +165,12 @@
         }
         
         
-    private:
-        
         virtual void resize(const Geometry::Size &size) override;
 
         virtual void move(const Geometry::Point &location) override;
 
+
+    private:
         bool enabled = true;
         
         virtual void hide() override;
@@ -222,12 +216,12 @@
         }
 
         
-        virtual Geometry::Size GetSize() const override {
+        virtual Geometry::Size GetCurrentSize() const override {
             return stack.GetSize();
         }
 
         virtual bool ResizeInterior(Geometry::Size size) override {
-            Resize(size + GetSize() - GetInteriorSize());
+            Resize(Pixels(size + GetCurrentSize() - GetInteriorSize()));
             
             return GetInteriorSize() == size;
         }
@@ -254,9 +248,6 @@
         virtual bool IsEnabled() const override {
             return ComponentStackWidget::IsEnabled();
         }
-
-        /// Sets the width of the widget in unit widths.
-        void SetWidthInUnits(int n) override;
         
         /// This function should be called whenever a key is pressed or released.
         virtual bool KeyPressed(Input::Key key, float state) override { return distributekeyevent(key, state, true); }
--- a/Source/Gorgon/Widgets/DialogWindow.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/DialogWindow.h	Sun Oct 24 19:07:17 2021 +0300
@@ -70,16 +70,14 @@
             owned.Delete(w);
         }
         
-        using Window::Resize;
-        
-        virtual void Resize(const Geometry::Size &size) override {
-            Window::Resize(size);
-            
+    protected:
+        virtual void resize(const Geometry::Size &size) override {
+            Window::resize(size);
+
             stack.Refresh();
             btnorg.Reorganize();
         }
-        
-    protected:
+
         UI::LayerAdapter buttonsarea;
         UI::Organizers::Flow btnorg;
     };
--- a/Source/Gorgon/Widgets/Dropdown.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Dropdown.h	Sun Oct 24 19:07:17 2021 +0300
@@ -54,7 +54,7 @@
                 Toggle();
             });
             list.SetOverscroll(0.5);
-            defaultheight = list.GetHeight();
+            defaultheight = list.GetCurrentHeight();
         }
         
         template <class ...A_>
@@ -100,7 +100,7 @@
             
             opened = true;
             
-            int below = res.TotalSize.Height-res.CoordinatesInExtender.Y-GetHeight();
+            int below = res.TotalSize.Height-res.CoordinatesInExtender.Y-GetCurrentHeight();
             int above = res.CoordinatesInExtender.Y;
             reversed  = false;
             
@@ -109,7 +109,7 @@
                 if(!fit) {
                     fit = list.FitHeight(above);
                     if(!fit)
-                        list.SetHeight(above);
+                        list.SetHeight(Pixels(above));
                     
                     reversed = true;
                 }
@@ -119,10 +119,10 @@
             }
             
             if(reversed) {
-                list.Move(res.CoordinatesInExtender.X, res.CoordinatesInExtender.Y - list.GetHeight());
+                list.Move(Pixels(res.CoordinatesInExtender.X, res.CoordinatesInExtender.Y - list.GetCurrentHeight()));
             }
             else {
-                list.Move(res.CoordinatesInExtender.X, res.CoordinatesInExtender.Y + GetHeight());
+                list.Move(Pixels(res.CoordinatesInExtender.X, res.CoordinatesInExtender.Y + GetCurrentHeight()));
             }
             
             list.SetWidth(GetWidth());
--- a/Source/Gorgon/Widgets/Listbox.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Listbox.h	Sun Oct 24 19:07:17 2021 +0300
@@ -1623,17 +1623,17 @@
                 this->sel_apply(i, *w, v);
                 
                 if(y == 0) {
-                    y = -int(std::round(w->GetHeight() * (scrolloffset - int(scrolloffset))));
+                    y = -int(std::round(w->GetCurrentHeight() * (scrolloffset - int(scrolloffset))));
                 }
                 
                 indexes.insert({w, i});
                 widgetlist.insert({i, w});
                 
-                w->Move(0, y);
+                w->Move(Pixels(0, y));
                 
                 //to be moved to resize
-                w->SetWidth(b.Width());
-                auto advance = w->GetHeight() + stack.GetTemplate().GetSpacing() / 2;
+                w->SetWidth(Pixels(b.Width()));
+                auto advance = w->GetCurrentHeight() + stack.GetTemplate().GetSpacing() / 2;
                 y += advance;
                 totalh += advance;
                 i++;
@@ -1810,7 +1810,7 @@
         /// elements have different heights. But it will never surpass maxpixels.
         bool FitHeight(int maxpixels) {
             int curh = GetInteriorSize().Height;
-            int overhead = GetHeight() - curh;
+            int overhead = GetCurrentHeight() - curh;
             int defh = stack.GetTemplate().GetUnitSize();
             
             auto li = stack.GetTemplate(UI::ComponentTemplate::ItemTag);
@@ -1826,7 +1826,7 @@
                 int tried = 0;
                 
                 do {
-                    SetHeight(expected);
+                    SetHeight(Pixels(expected));
                     stack.Update(true);
                     Refresh();
                     
@@ -1837,7 +1837,7 @@
                         return true;
                     
                     curh = GetInteriorSize().Height;
-                    overhead = GetHeight() - curh;
+                    overhead = GetCurrentHeight() - curh;
                     int curexpected = int( std::ceil( (this->GetCount()+overscroll) * (curh/maxdisplay) ) ) + overhead;
                     
                     if(abs(expected - curexpected) == 0) { //no progress, exit
@@ -1855,7 +1855,7 @@
                 
             }
             
-            SetHeight(maxpixels);
+            SetHeight(Pixels(maxpixels));
             return false;
         }
         
--- a/Source/Gorgon/Widgets/Panel.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Panel.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -112,9 +112,9 @@
         auto innersize = stack.TagBounds(UI::ComponentTemplate::ViewPortTag).GetSize();
         
         if(innersize.Area() != 0)
-            border = GetSize() - innersize;
+            border = GetCurrentSize() - innersize;
         
-        Resize(size + border);
+        Resize(Pixels(size + border));
 
         return stack.TagBounds(UI::ComponentTemplate::ContentsTag).GetSize() == size;
     }
@@ -235,7 +235,7 @@
                 if(!ans.Transformed) {
                     Geometry::Point offset = stack.TagBounds(UI::ComponentTemplate::ContentsTag).TopLeft();
                     
-                    ans.CoordinatesInExtender += GetLocation() + offset;
+                    ans.CoordinatesInExtender += GetCurrentLocation() + offset;
                 }
 
                 return ans;
--- a/Source/Gorgon/Widgets/Panel.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Panel.h	Sun Oct 24 19:07:17 2021 +0300
@@ -258,13 +258,13 @@
         int spacing   = 0;
         int unitwidth = 0;
         bool issizesset = false;
-        
-    private:
                 
         virtual void resize(const Geometry::Size &size) override;
         
         virtual void move(const Geometry::Point &location) override;
 
+    private:
+
     };
     
 } }
--- a/Source/Gorgon/Widgets/RadioButtons.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/RadioButtons.h	Sun Oct 24 19:07:17 2021 +0300
@@ -21,23 +21,13 @@
     class RadioButtons : public Composer, protected UI::RadioControl<T_, W_> {
         friend class UI::WidgetContainer;
     public:
-        explicit RadioButtons(const UI::Template &temp) : temp(temp) { 
+        explicit RadioButtons(const UI::Template &temp) : Composer(Pixels(temp.GetSize())), temp(temp) {
             spacing = temp.GetSpacing();
-            SetWidth(temp.GetWidth());
             this->own = true;
         }
         
         explicit RadioButtons(Registry::TemplateType type = Registry::Radio_Regular) : RadioButtons(Registry::Active()[type]) {  
         }
-        
-        /// Radio buttons height is automatically adjusted. Only width will be used.
-        virtual void Resize(const Geometry::Size &size) override {
-            Composer::Resize(size);
-            
-            for(auto p : this->elements) {
-                p.second.SetWidth((GetWidth() - spacing * (GetColumns() - 1)) / GetColumns());
-            }
-        }
 
         virtual bool Activate() override {
             return false;
@@ -52,20 +42,6 @@
             rearrange();
         }
         
-        /// Sets the width of the widget in unit widths.
-        void SetWidthInUnits(int n) override {
-            int w, s;
-            if(HasParent()) {
-                w = GetParent().GetUnitSize();
-                s = GetParent().GetSpacing();
-            }
-            else {
-                w = temp.GetUnitSize();
-                s = temp.GetSpacing();
-            }
-            SetWidth(w * n + s * (n-1));
-        }
-
         W_ &Add(const T_ value) {
             return Add(value, String::From(value));
         }
@@ -79,7 +55,7 @@
             auto &c = *new W_(temp, text);
             UI::RadioControl<T_, W_>::Add(value, c);
             
-            c.SetWidth((GetWidth() - spacing * (GetColumns() - 1)) / GetColumns());
+            c.SetWidth(Pixels((GetCurrentWidth() - spacing * (GetColumns() - 1)) / GetColumns()));
             
             if(value == this->Get())
                 c.Check();
@@ -87,7 +63,7 @@
             if(IsVisible())
                 this->PlaceIn((UI::WidgetContainer&)*this, {0, 0}, spacing);
                 
-            SetHeight(this->widgets.Last()->GetBounds().Bottom);
+            SetHeight(Pixels(this->widgets.Last()->GetBounds().Bottom));
             
             boundschanged();
             childboundschanged(&c);
@@ -112,7 +88,7 @@
                 if(IsVisible())
                     this->PlaceIn((UI::WidgetContainer&)*this, {0, 0}, spacing);
                 
-                SetHeight(this->widgets.Last()->GetBounds().Bottom);
+                SetHeight(Pixels(this->widgets.Last()->GetBounds().Bottom));
                 
                 boundschanged();
                 childboundschanged(&elm);
@@ -173,13 +149,13 @@
 
 
         Geometry::Size GetInteriorSize() const override {
-            return GetSize();
+            return GetCurrentSize();
         }
         
         bool ResizeInterior(Geometry::Size size) override {
             Resize(size);
             
-            return size == GetSize();
+            return size == GetCurrentSize();
         }
         
         using Widget::Resize;
@@ -259,6 +235,15 @@
 
     protected:
 
+        /// Radio buttons height is automatically adjusted. Only width will be used.
+        virtual void resize(const Geometry::Size &size) override {
+            Composer::Resize(size);
+
+            for(auto p : this->elements) {
+                p.second.SetWidth(Pixels((GetCurrentWidth() - spacing * (GetColumns() - 1)) / GetColumns()));
+            }
+        }
+
         virtual bool allowfocus() const override {
             return !HasParent() || GetParent().CurrentFocusStrategy() == UI::WidgetContainer::AllowAll;
         }
@@ -292,15 +277,15 @@
             int total = 0, col = 0;
             for(auto p : this->elements) {
                 if(col % GetColumns() == 0)
-                    total += p.second.GetHeight() + spacing;
+                    total += p.second.GetCurrentHeight() + spacing;
                 
-                p.second.SetWidth((GetWidth() - spacing * (GetColumns() - 1)) / GetColumns());
+                p.second.SetWidth(Pixels((GetCurrentWidth() - spacing * (GetColumns() - 1)) / GetColumns()));
                 col++;
             }
             
             if(total > 0) total -= spacing;
             
-            SetHeight(total);
+            SetHeight(Pixels(total));
             
             this->PlaceIn((UI::WidgetContainer&)*this, {0, 0}, spacing);
         }
@@ -311,7 +296,7 @@
 
                 if(ans.Extender) {
                     if(!ans.Transformed) {
-                        ans.CoordinatesInExtender += GetLocation();
+                        ans.CoordinatesInExtender += GetCurrentLocation();
                     }
 
                     return ans;
--- a/Source/Gorgon/Widgets/TabPanel.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/TabPanel.h	Sun Oct 24 19:07:17 2021 +0300
@@ -252,7 +252,7 @@
                     updating = false;
                 }
 
-                mapping[key].Resize(stack.BoundsOf(stack.IndexOfTag(UI::ComponentTemplate::ContentsTag)).GetSize());
+                mapping[key].Resize(Pixels(stack.BoundsOf(stack.IndexOfTag(UI::ComponentTemplate::ContentsTag)).GetSize()));
                 //stack.SetWidget(UI::ComponentTemplate::ContentsTag, &mapping[key]);
                 Clear();
                 Add(mapping[key]);
@@ -449,13 +449,12 @@
                 auto &tab    = tabs[i];
                 button.SetText(tab.GetTitle());
 
-                if(button.GetWidth() + x > w && overflow == ExpandLines) {
+                if(button.GetCurrentWidth() + x > w && overflow == ExpandLines) {
                     y += curh + GetSpacing();
                     x = 0;
                 }
 
-                button.Location.X = x;
-                button.Location.Y = y;
+                button.Move(Pixels(x, y));
 
                 button.SetTextWrap(buttontextwrap);
 
@@ -464,19 +463,19 @@
                 }
 
                 x = button.GetBounds().Right + GetSpacing();
-                if(button.GetHeight() > curh)
-                    curh = button.GetHeight();
+                if(button.GetCurrentHeight() > curh)
+                    curh = button.GetCurrentHeight();
             }
 
             if(buttonspnl) {
                 if(buttons.GetSize()) {
-                    buttonspnl->Resize(maxw, buttons.Last()->GetBounds().Bottom);
+                    buttonspnl->Resize(Pixels(maxw, buttons.Last()->GetBounds().Bottom));
                 }
                 else {
-                    buttonspnl->Resize({0, GetUnitSize()});
+                    buttonspnl->Resize(Pixels(0, GetUnitSize()));
                 }
 
-                stack.SetTagSize(UI::ComponentTemplate::ButtonsTag, {0, buttonspnl->GetHeight()});
+                stack.SetTagSize(UI::ComponentTemplate::ButtonsTag, {0, buttonspnl->GetCurrentHeight()});
             }
 
             stack.Update(true);
--- a/Source/Gorgon/Widgets/Window.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Window.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -47,10 +47,11 @@
             Center();
         }
         
-        minsize = GetSize() - GetInteriorSize() + Geometry::Size(stack.GetTemplate().GetUnitSize()*2, stack.GetTemplate().GetUnitSize());
+        //TODO interior sizing
+        minsize = GetCurrentSize() - GetInteriorSize() + Geometry::Size(stack.GetTemplate().GetUnitSize()*2, stack.GetTemplate().GetUnitSize());
     }
     
-    Window::Window(const UI::Template &temp, const std::string &title, const Geometry::Size size, bool autoplace) : 
+    Window::Window(const UI::Template &temp, const std::string &title, const UI::UnitSize size, bool autoplace) :
         Window(temp, title, autoplace)
     {
         Resize(size);
@@ -186,7 +187,7 @@
                 dragoffset = location;
             }
             else if(allowresize && tag == UI::ComponentTemplate::ResizeTag) {
-                auto size = GetSize();
+                auto size = GetCurrentSize();
                 int maxdist = stack.GetTemplate().GetResizeHandleSize();
                 
                 int leftdist = location.X, rightdist  = size.Width  - location.X;
@@ -283,7 +284,7 @@
             }
         }
         else if(allowresize && tag == UI::ComponentTemplate::ResizeTag) {
-            auto size = GetSize();
+            auto size = GetCurrentSize();
             int maxdist = stack.GetTemplate().GetResizeHandleSize();
             
             int leftdist = location.X, rightdist  = size.Width  - location.X;
@@ -357,43 +358,43 @@
             return;
         
         if(moving) {
-            auto newlocation = GetLocation() + location-dragoffset;
+            auto newlocation = GetCurrentLocation() + location-dragoffset;
             if(HasParent()) {
-                FitInto(newlocation.X, 0, GetParent().GetInteriorSize().Width - GetWidth()/2);
-                FitInto(newlocation.Y, 0, GetParent().GetInteriorSize().Height - GetHeight()/2);
+                FitInto(newlocation.X, 0, GetParent().GetInteriorSize().Width - GetCurrentWidth()/2);
+                FitInto(newlocation.Y, 0, GetParent().GetInteriorSize().Height - GetCurrentHeight()/2);
             }
             
-            Move(newlocation);
+            Move(Pixels(newlocation));
         }
         
         switch(resizing) {
         case bottomleft:
         case bottomright:
         case bottom: {
-            int ch = GetHeight();
+            int ch = GetCurrentHeight();
             int h = ch + location.Y - dragoffset.Y;
             
             if(HasParent()) {
-                FitInto(h, minsize.Height, std::min((GetParent().GetInteriorSize().Height - GetLocation().Y) * 2, GetParent().GetInteriorSize().Height));
+                FitInto(h, minsize.Height, std::min((GetParent().GetInteriorSize().Height - GetCurrentLocation().Y) * 2, GetParent().GetInteriorSize().Height));
             }
             
-            SetHeight(h);
+            SetHeight(Pixels(h));
             dragoffset.Y = location.Y;
             break;
         }
         case topleft:
         case topright:
         case top: {
-            int ch = GetHeight();
+            int ch = GetCurrentHeight();
             int h = ch - location.Y + dragoffset.Y;
             
             if(HasParent()) {
-                FitInto(h, minsize.Height, GetHeight()+GetLocation().Y);
+                FitInto(h, minsize.Height, GetCurrentHeight()+GetCurrentLocation().Y);
             }
             
-            SetHeight(h);
+            SetHeight(Pixels(h));
             
-            Move(GetLocation() + Geometry::Point(0, ch-h));
+            Move(Pixels(GetCurrentLocation() + Geometry::Point(0, ch-h)));
             
             break;
         }
@@ -406,14 +407,14 @@
         case topright:
         case bottomright:
         case right: {
-            int cw = GetWidth();
+            int cw = GetCurrentWidth();
             int w = cw + location.X - dragoffset.X;
             
             if(HasParent()) {
-                FitInto(w, minsize.Width, std::min((GetParent().GetInteriorSize().Width - GetLocation().X) * 2, GetParent().GetInteriorSize().Width));
+                FitInto(w, minsize.Width, std::min((GetParent().GetInteriorSize().Width - GetCurrentLocation().X) * 2, GetParent().GetInteriorSize().Width));
             }
             
-            SetWidth(w);
+            SetWidth(Pixels(w));
             
             dragoffset.X = location.X;
             break;
@@ -421,16 +422,16 @@
         case topleft:
         case bottomleft:
         case left: {
-            int cw = GetWidth();
+            int cw = GetCurrentWidth();
             int w = cw - location.X + dragoffset.X;
             
             if(HasParent()) {
-                FitInto(w, minsize.Width, GetWidth()+GetLocation().X);
+                FitInto(w, minsize.Width, GetCurrentWidth()+GetCurrentLocation().X);
             }
             
-            SetWidth(w);
+            SetWidth(Pixels(w));
             
-            Move(GetLocation() + Geometry::Point(cw-w, 0));
+            Move(Pixels(GetCurrentLocation() + Geometry::Point(cw-w, 0)));
             
             break;
         }
@@ -518,7 +519,7 @@
 
     void Window::Center() {
         if(HasParent())
-            Move(Geometry::Point((GetParent().GetInteriorSize() - GetSize())/2));
+            Move(Pixels(Geometry::Point((GetParent().GetInteriorSize() - GetCurrentSize())/2)));
     }
     
     bool Window::allowfocus() const {
--- a/Source/Gorgon/Widgets/Window.h	Sat Oct 23 08:10:10 2021 +0300
+++ b/Source/Gorgon/Widgets/Window.h	Sun Oct 24 19:07:17 2021 +0300
@@ -22,7 +22,7 @@
         
         explicit Window(const UI::Template &temp, const std::string &title = "", bool autoplace = true);
         
-                 Window(const UI::Template &temp, const std::string &title, const Geometry::Size size, bool autoplace = true);
+                 Window(const UI::Template &temp, const std::string &title, const UI::UnitSize size, bool autoplace = true);
         
                  Window(const UI::Template &temp, const Geometry::Size size, bool autoplace = true) : Window(temp, "", size, autoplace) { }
         
--- a/Testing/Source/Manual/UI_Component.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Testing/Source/Manual/UI_Component.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -3334,7 +3334,7 @@
 
 std::vector<std::function<TestData(Layer &)>> tests = {
     //BEGIN layout
-    /*&test_graphic,
+    &test_graphic,
     &test_text,
     
     &test_setsize,
@@ -3371,9 +3371,9 @@
     &test_relanch2,
     &test_relanchvert,
     &test_relanchvertrelsize,
-    &test_anchtozero,*/
+    &test_anchtozero,
     &test_anchtoreverseside,
-    /*
+
     &test_anchbaseline,
     &test_anchsetbaseline,
     &test_anchbaseline2,
@@ -3480,7 +3480,7 @@
     &test_anchacc,
     &test_ignored,
     //END
-    */
+
 };
 
 //END tests
--- a/Testing/Source/Manual/UI_Generate.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Testing/Source/Manual/UI_Generate.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -28,6 +28,9 @@
 #include <Gorgon/UI/Dialog.h>
 #include <Gorgon/OS.h>
 
+using Gorgon::UI::Pixels;
+using namespace Gorgon::UI::literals;
+
 enum DaysOfWeek {
     Monday,
     Tuesday,
@@ -106,8 +109,8 @@
 //     generator.Activate();
 
     Widgets::Panel blank(Widgets::Registry::Panel_Right);
-    blank.Move(5, 50);
-    blank.SetHeight(300);
+    blank.Move(Pixels(5, 50));
+    blank.SetHeight(300_px);
     auto icon = Triangle(5, 10);
     icon.Prepare();
     Graphics::TintedBitmapProvider icon2(icon.Rotate270(), Graphics::Color::Charcoal);
@@ -137,24 +140,26 @@
     Gorgon::Widgets::Checkbox chkbutton("C", Gorgon::Widgets::Registry::Checkbox_Button);
     Gorgon::Widgets::Progressbar bar(Gorgon::Widgets::Registry::Progress_Regular);
     Gorgon::Widgets::Panel toppanel(Gorgon::Widgets::Registry::Panel_Top);
-    toppanel.Resize({ 30,30 });
+    toppanel.Resize(Pixels( 30,30 ));
     Gorgon::Widgets::Label toplabel("Panel Top");
     Gorgon::Widgets::Button topbtn("regular",Gorgon::Widgets::Registry::Button_Regular);
     toppanel.Add(toplabel);
     toppanel.Add(topbtn);
-    topbtn.Move(toplabel.GetLocation().X, toplabel.GetLocation().Y + toplabel.GetSize().Height);
+    topbtn.Move(Pixels(toplabel.GetCurrentLocation().X, toplabel.GetCurrentLocation().Y + toplabel.GetCurrentSize().Height));
+
+    chk.SetWidth(5_u);
     
     chkbutton.SetIconProvider(icon2);
 
     Gorgon::Widgets::Panel leftpanel(Gorgon::Widgets::Registry::Panel_Left);
-    leftpanel.Resize({ 30,30 });
+    leftpanel.Resize(Pixels( 30,30 ));
     Gorgon::Widgets::Label leftlabel("Panel Left");
     leftpanel.Add(leftlabel);
 
     Gorgon::Widgets::Panel rightpanel(Gorgon::Widgets::Registry::Panel_Right);
     Gorgon::Widgets::Label rightlabel("Panel Right");
     rightpanel.Add(rightlabel);
-    rightpanel.Resize({ 30,30 });
+    rightpanel.Resize(Pixels( 30,30 ));
 
     Gorgon::Widgets::Panel bottompanel(Gorgon::Widgets::Registry::Panel_Bottom);
     Gorgon::Widgets::Label bottomlabel("Panel bottom");
@@ -213,7 +218,7 @@
     list.AddToSelection(3);
     list.AddToSelection(1, 4);
     list.InvertSelection();
-    list.SetWidthInUnits(5);
+    list.SetWidth(5_u);
 //     std::ofstream file("fonts.txt");
 //     OS::DumpFontFamilies(file);
 //     file.close();
@@ -315,7 +320,7 @@
         if(!allow)
             std::cout << "Click once more to close." << std::endl;
     });
-    btn.Move(0,0);
+    btn.Move(Pixels(0,0));
     btn.Disable();
     Widgets::Checkbox enableclosebtn("Enable close button", true);
     enableclosebtn.SetAutosize(Gorgon::UI::Autosize::Unit, Gorgon::UI::Autosize::Automatic);
@@ -356,11 +361,13 @@
             }, 2
         );
     }).SetHorizonalAutosize(Gorgon::UI::Autosize::Automatic);
+
+    wind.Move(20_perc, 5_perc);
     
     Widgets::Label tiplabel("Some text here", Gorgon::Widgets::Registry::Label_Info);
     tiplabel.SetAutosize(Gorgon::UI::Autosize::None, Gorgon::UI::Autosize::Automatic);
     app.wind.Add(tiplabel);
-    tiplabel.Move(0, 550);
+    tiplabel.Move(0_px, 550_px);
 
     blank.Tooltip = "This is the container.\n\n* Yehaaw there is tons of text here. \n   * With markdown support \n\nA potential for next line. Even one more...";
     app.wind.Add(blank);
--- a/Testing/Source/Manual/UI_WidgetTest.cpp	Sat Oct 23 08:10:10 2021 +0300
+++ b/Testing/Source/Manual/UI_WidgetTest.cpp	Sun Oct 24 19:07:17 2021 +0300
@@ -44,9 +44,9 @@
     wgt1["Tab 2"].Add(lbl1);
     wgt1["Tab 2"].Add(lbl2);
     wgt1["Tab 2"].Add(btn2);
-    lbl2.Location.Y = lbl1.GetBounds().Bottom + Widgets::Registry::Active().GetSpacing();
-    btn2.Location.Y = 400;
-    btn2.Location.X = Widgets::Registry::Active().GetUnitSize(3) + Widgets::Registry::Active().GetSpacing();
+    //lbl2.Location.Y = lbl1.GetBounds().Bottom + Widgets::Registry::Active().GetSpacing();
+    //btn2.Location.Y = 400;
+    //btn2.Location.X = Widgets::Registry::Active().GetUnitSize(3) + Widgets::Registry::Active().GetSpacing();
 
     wgt1.ActivateNext();
         

mercurial