* A few fixes in generator 4.x-dev

Fri, 01 Oct 2021 14:45:24 +0300

author
cemkalyoncu
date
Fri, 01 Oct 2021 14:45:24 +0300
branch
4.x-dev
changeset 1732
53fcfbba9755
parent 1731
b972732e8fcc
child 1733
5035795e8794

* A few fixes in generator

Source/Gorgon/Property.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Generator.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Generator.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/TabPanel.h file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/Property.h	Thu Sep 30 00:34:57 2021 +0300
+++ b/Source/Gorgon/Property.h	Fri Oct 01 14:45:24 2021 +0300
@@ -863,8 +863,8 @@
     void set##name(const type &v) { variable=v; } \
     type variable
 
-/// If property is there to call Update every time the value is changed, this mapper can handle this situation.
-/// Names the member variable as m_name. For proptype use the prefix part of the property name: Numeric for 
+/// This map the property to getter and setter
+/// For proptype use the prefix part of the property name: Numeric for 
 /// NumericProperty
 #define PROPERTY_GETSET(cls, proptype, type, name) \
     Gorgon::proptype##Property<cls, type, &cls::Get##name, &cls::Set##name> name = Gorgon::proptype##Property<cls, type, &cls::Get##name, &cls::Set##name>{this}
--- a/Source/Gorgon/Widgets/Generator.cpp	Thu Sep 30 00:34:57 2021 +0300
+++ b/Source/Gorgon/Widgets/Generator.cpp	Fri Oct 01 14:45:24 2021 +0300
@@ -550,7 +550,7 @@
         return *prov;
     }
     
-    Graphics::BitmapRectangleProvider *SimpleGenerator::makeborder(Graphics::RGBA border, Graphics::RGBA bg, AssetID::BorderSide borders, int w, int r) {
+    Graphics::RectangularAnimationProvider *SimpleGenerator::makeborder(Graphics::RGBA border, Graphics::RGBA bg, AssetID::BorderSide borders, int w, int r) {
         if(w == -1)
             w = Border.Width;
         
@@ -564,7 +564,12 @@
         auto &bi = *new Graphics::Bitmap({bsize, bsize}, Graphics::ColorMode::RGBA);
         bi.Clear();
         
-        if(r == 0 || (AssetID::TotalBorders(borders) > 0 && AssetID::TotalBorders(borders) < 3)) {
+        if(r == 0 || AssetID::TotalBorders(borders) < 3) {
+            if(borders == AssetID::None) {
+                coff = 0;
+                off  = 0;
+            }
+            
             Geometry::PointList<Geometry::Pointf> list = {{off, bsize-off}, {bsize-off, bsize-off}, {bsize-off, off}, {off,off}};
             
             CGI::Polyfill(bi.GetData(), list, CGI::SolidFill<>(bg));
@@ -691,19 +696,26 @@
                 bi = bi.Rotate270();
             }
         }
-        
-        drawables.Add(bi);
 
-        auto ret = new Graphics::BitmapRectangleProvider(Graphics::Slice(bi, {
-            coff, 
-            coff, 
-            bsize-coff,
-            bsize-coff
-        }));
-        
-        ret->Prepare();
-        
-        return ret;
+        if(coff > 0) {
+            drawables.Add(bi);
+            
+            auto ret = new Graphics::BitmapRectangleProvider(Graphics::Slice(bi, {
+                coff, 
+                coff, 
+                bsize-coff,
+                bsize-coff
+            }));
+            
+            ret->Prepare();
+            
+            return ret;
+        }
+        else {
+            bi.Prepare();
+            
+            return &bi;
+        }
     }
     
     Graphics::BitmapRectangleProvider *SimpleGenerator::makecheckeredbg() {
@@ -2729,11 +2741,13 @@
         ;
 
         //Button container
-        temp.AddContainer(1, UI::ComponentCondition::Always)
-            .AddIndex(3) //button panel
+        auto &buttonsarea = temp.AddContainer(1, UI::ComponentCondition::Always)
+            //.AddIndex(3) //button panel
             .AddIndex(4) //additional graphics
-            .SetSizing(UI::ComponentTemplate::Fixed, UI::ComponentTemplate::Automatic)
         ;
+        buttonsarea.SetSizing(UI::ComponentTemplate::Fixed, UI::ComponentTemplate::GrowOnly);
+        buttonsarea.SetSize({100, UI::Dimension::Percent}, unitsize);
+        //buttonsarea.Background.SetAnimation(A(Background, Regular, None));
 
         auto &buttonspanel = temp.AddPlaceholder(3, UI::ComponentCondition::Always);
         buttonspanel.SetTag(UI::ComponentTemplate::ButtonsTag);
@@ -2742,9 +2756,13 @@
 
         auto &graph = temp.AddGraphics(4, UI::ComponentCondition::Always);
         graph.Content.SetAnimation(A(BorderFilled, Regular, None));
+        graph.SetSize({100, UI::Dimension::Percent}, {Border.Width, UI::Dimension::Pixel});
+        graph.SetFillArea(true);
+        graph.SetSizing(UI::ComponentTemplate::Fixed);
+        graph.SetAnchor(UI::Anchor::BottomRight, UI::Anchor::BottomLeft, UI::Anchor::BottomLeft);
 
         auto &btn = temp.AddPlaceholder(5, UI::ComponentCondition::Always);
-        btn.SetTemplate((*this)[Listbox_Regular]); // TODO replace
+        btn.SetTemplate((*this)[Checkbox_Button]); // TODO replace
         btn.SetTag(UI::ComponentTemplate::ButtonTag);
         btn.SetPositioning(UI::ComponentTemplate::Absolute);
 
--- a/Source/Gorgon/Widgets/Generator.h	Thu Sep 30 00:34:57 2021 +0300
+++ b/Source/Gorgon/Widgets/Generator.h	Fri Oct 01 14:45:24 2021 +0300
@@ -686,7 +686,7 @@
         const FocusInfo  &Focus  = focus;
 
     private:
-        Graphics::BitmapRectangleProvider *makeborder(Graphics::RGBA border, Graphics::RGBA bg, AssetID::BorderSide borders, int borderwidth = -1, int borderradius = -1);
+        Graphics::RectangularAnimationProvider* makeborder(Graphics::RGBA border, Graphics::RGBA bg, SimpleGenerator::AssetID::BorderSide borders, int w = -1, int r = -1);
         Graphics::BitmapRectangleProvider *makecheckeredbg();
         Graphics::RectangleProvider *makefocusborder();
         UI::Template makepanel(SimpleGenerator::AssetID::BorderSide edge, bool scrollers, bool spacing = true, bool nobg = false);
--- a/Source/Gorgon/Widgets/TabPanel.h	Thu Sep 30 00:34:57 2021 +0300
+++ b/Source/Gorgon/Widgets/TabPanel.h	Fri Oct 01 14:45:24 2021 +0300
@@ -17,14 +17,23 @@
     class Tab : public Panel {
         friend class basic_TabPanel<Key_>;
     public:
-        //TODO index, key, text, icon
+        //TODO icon
         //blankpanel
+        
+        
 
     private:
-        Tab(basic_TabPanel<Key_> &parent, const UI::Template &temp) : Panel(temp), parent(&parent) {
+        Tab(basic_TabPanel<Key_> &parent, const UI::Template &temp, 
+            const Key_ &key, const std::string &title
+        ) : 
+            Panel(temp), parent(&parent), 
+            key(key), title(title)
+        {
         }
 
         basic_TabPanel<Key_> *parent;
+        Key_ key;
+        std::string title;
     };
 
     /**
@@ -69,7 +78,11 @@
         };
 
         /// Construct a new panel
-        explicit basic_TabPanel(const UI::Template &temp) : ComponentStackComposer(temp) {
+        explicit basic_TabPanel(const UI::Template &temp) : 
+            ComponentStackComposer(temp, {
+                {UI::ComponentTemplate::ButtonTag, {}}
+            }) 
+        {
         }
 
         /// Construct a new panel
@@ -77,7 +90,9 @@
         }
 
         /// Create a new tab with the given key and title
-        Tab<Key_> &New(const Key_ &key, const std::string &title);
+        Tab<Key_> &New(const Key_ &key, const std::string &title) {
+            
+        }
 
         /// Create a new tab with the given key, title will be determined from the key
         Tab<Key_> &New(const Key_ &key) {

mercurial