Pyrgen wrote:
> Hi,
> Does anyone have any example where can be seen creating/applying of any theme 
> in FLTK2?
> 
> I have noticed that FLTK2 comes with some existing themes ('themes' 
> directory), but I couldn't make them work in my applications.
> _______________________________________________
> fltk mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk
> 

Currently the fltk2 theme stuff is pretty ugly.  It's basically a 
callback function that fltk calls before opening the window.  You then 
change a bunch of static stuff kind of directly.  The new Style class 
does have accessors now, so you should use them instead.
Some very important widgets do not have named styles, like Group, which 
is a royal pain, as set_background() is not often what you want.

Here's a (snipped) sample which should be self explanatory I hope - it 
changes colors, text sizes and some edge styles on a slider and the 
default widget type colors

   // fltk group named style bug
   extern fltk::NamedStyle* group_style;

   bool my_theme()
   {
     // Reset to fltk's default theme
     fltk::reset_theme();

     // Change some widget's defaults
     int bgcolor = 0x43434300;
     int textcolor = 0xababab00;
     int selectioncolor = 0x97a8a800;

     style = fltk::Style::find( "Slider" );
     if ( style )
       {
        style->color( bgcolor );
        style->textcolor( textcolor );
        style->buttoncolor( bgcolor );
        style->textsize( 8 );
        style->labelsize( 10 );
        style->labelcolor( textcolor );


        style->highlight_textcolor( 0xFFFF0000 );
       }

     // this is broken...
     // style = fltk::Style::find( "Group" );
     style = group_style;
     if ( style )
       {
        style->color( bgcolor );
        style->textcolor( textcolor );
        style->buttoncolor( bgcolor );
        style->textsize( 10 );
        style->labelsize( 10 );
        style->labelcolor( textcolor );
       }

     style = fltk::Style::find( "Widget" );
     if ( style )
       {
        style->color( bgcolor );
        style->textcolor( textcolor );
        style->buttoncolor( bgcolor );
        style->textsize( 14 );
        style->labelsize( 14 );
        style->labelcolor( textcolor );
        style->selection_color( selectioncolor );
       }

     // change down box to draw a tad darker than default
     fltk::FrameBox* box;
     box = (fltk::FrameBox*) fltk::Symbol::find( "down_" );
     if ( box ) box->data(  "2HHOOAA" );


     return true;
   }

   int main()
    {
        fltk::theme( &my_theme );

        // create widgets normally.
        // Any widget with default settings gets the defaults we
        // just set.
    }

-- 
Gonzalo Garramuño
[EMAIL PROTECTED]

AMD4400 - ASUS48N-E
GeForce7300GT
Kubuntu Edgy

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to