qPCR4vir / nana

a modern C++ GUI library
http://nanapro.org
Boost Software License 1.0
16 stars 2 forks source link

a set of static color scheme to initialize and actualize all scheme #4

Open qPCR4vir opened 9 years ago

qPCR4vir commented 9 years ago

the idea is like this: (need more work! ... I´m not sure how...)

// in namespace nana
    struct widget_colors
    {
        virtual ~widget_colors() = default;
        widget_colors(){}
        widget_colors(color_proxy ac,  color_proxy bg , color_proxy fg):
                      activated(ac), background(bg), foreground(fg){}

        color_proxy activated   {def.activated };
        color_proxy background  {def.background};
        color_proxy foreground  {def.background};

        static widget_colors def; 
    };
// in cpp
    widget_colors widget_colors::def  {color_proxy(static_cast<color_rgb>(0x60C8FD)), 
                                       color_proxy(colors::button_face), 
                                       color_proxy(colors::black)}; 

template<typename Category, typename DrawerTrigger, typename Events = general_events, typename Scheme = widget_colors>
 class nana::widget_object< Category, DrawerTrigger, Events, Scheme >
{
     //...
    using  scheme_type = Scheme ;
    static  scheme_type  def_scheme{};
    scheme_type &  scheme () const  ;  // const ?
    widget_object()  : events_{ std::make_shared<Events>() } {  }
private:
    std::unique_ptr<Scheme> scheme_{ API::dev::make_scheme<Scheme>(def_scheme) }

 //...
};
//...
listbox::scheme_type scheme_type():widget_colors(widget::def_widget_colors){/* ... */}}
//...
widget_colors::def.background=colors::aqua;
form::def_scheme.activate=colors::red; // for all class and object derived from form
form myForm1, myForm2;  // bg will aqua, activate red

And then to have a way of switch the entery application from one "style" to other

qPCR4vir commented 8 years ago

try