Wed, 01 Apr 2020 15:48:59 +0300
Getspacing added to registry
Source/Gorgon/Widgets/Generator.h | file | annotate | diff | comparison | revisions | |
Source/Gorgon/Widgets/Registry.h | file | annotate | diff | comparison | revisions |
--- a/Source/Gorgon/Widgets/Generator.h Tue Mar 31 16:33:50 2020 +0300 +++ b/Source/Gorgon/Widgets/Generator.h Wed Apr 01 15:48:59 2020 +0300 @@ -113,7 +113,7 @@ /// is undefined behaviour. SimpleGenerator() : Generator(false) { } - + /// Initializes the generator void Init(int fontsize = 14, std::string fontname = ""); @@ -154,6 +154,11 @@ virtual UI::Template Progressbar() override; + + virtual int GetSpacing()const override { + return Spacing; + } + Graphics::BitmapRectangleProvider &NormalBorder(); Graphics::BitmapRectangleProvider &HoverBorder(); Graphics::BitmapRectangleProvider &DownBorder();
--- a/Source/Gorgon/Widgets/Registry.h Tue Mar 31 16:33:50 2020 +0300 +++ b/Source/Gorgon/Widgets/Registry.h Wed Apr 01 15:48:59 2020 +0300 @@ -75,8 +75,12 @@ return *templates[type]; } - + + virtual int GetSpacing()const = 0; + protected: + + /// This function should return a template for the given type. Due to /// being used in constructors you are not allowed to reject template type. /// If the generator is capable of generating a similar template, simply @@ -88,6 +92,7 @@ /// Stores the templates. Mutable to allow late loading. mutable std::array<UI::Template*, Max> templates; + private: static Registry *active; //initialized in UI.cpp }; @@ -108,11 +113,22 @@ templates[type] = &temp; } + void SetSpacing(const int tspacing) { + spacing = tspacing; + } + + virtual int GetSpacing()const override { + return spacing; + } + protected: virtual UI::Template &generate(Gorgon::Widgets::Registry::TemplateType) override { return *new UI::Template(); } + + int spacing = 5; + }; - + } }