Alvin wrote:
> Hello,
> 
> I would like to skin a Fl_Double_Window (not any of the widgets that lye on 
> the window - they would be default gtk+ scheme). My vision is to replace the 
> solid colour of the window (grey in my colour scheme). Has anyone else done 
> this before?

        FLTK supports a couple of built in 'schemes' that can
        be set easily at the beginning of your program:

                Fl::scheme("gtk+");             // a gtk-ish look for widgets
                Fl::scheme("plastic");          // a plastic look for widgets

        The gtk+ look is available in fltk 1.3.x, and plastic
        has been around for a while.

        I think these all work by defining custom behavior for
        drawing "boxes". I don't remember the details, but I think
        it's just a matter of redirecting FLTK to call your own
        functions for drawing certain kinds of FL_BOX types.

> My thoughts are to simply derive from Fl_Double_Window and override the 
> draw() and draw an image. But then I thought about issues relating to 
> resizing the window. Is this the way to accomplish this?

        That should work too. Resizing is handled automatically,
        so the x/y/w/h values will adjust appropriately when
        the window is resized; just do all your window size calculations
        based on those, and your draw() code will be called automatically
        whenever the window needs to be redrawn during/after its been
        resized.

> What about tiling an image on a Fl_Double_Window? Has anyone done that 
> before?

        I believe there is code in FLTK that does this.. I /think/
        the "plastic" scheme makes use of this to draw the "lined"
        background for Fl_Windows.. it was a Mac inspired thing
        that I think was added right around when OSX 10.0 was popular
        (early 2003 or so).

> I'm just looking to jazz-up the app so it doesn't appear just grey.

        You can also change the color map around for the grayscale
        that the default widgets use. For instance, the following
        changes the colormap to a 'tan' ramp, similar to the one
        FLTK uses on winXP (when Fl::args(argc,argv) is called).

        To use this so that it works on all platforms, just call it
        near the top of your app like this:

int main(..) {
    Fl::scheme("gtk+");
    TanColormap();
    [..your app init here..]
}

        Here's the code for TanColormap():

// CHANGE THE GRAYSCALE RAMP TO A 'WINXP' STYLE TAN RAMP
void TanColormap(void)
{
    // WIN XP 24 COLOR GRAY SCALE (32-56)
    int c = 32;
    Fl::set_color(Fl_Color(c),0  ,0  ,0   ); c++;
    Fl::set_color(Fl_Color(c),114,100,46  ); c++;
    Fl::set_color(Fl_Color(c),120,107,56  ); c++;
    Fl::set_color(Fl_Color(c),127,114,65  ); c++;
    Fl::set_color(Fl_Color(c),133,121,75  ); c++;
    Fl::set_color(Fl_Color(c),140,128,84  ); c++;
    Fl::set_color(Fl_Color(c),146,135,94  ); c++;
    Fl::set_color(Fl_Color(c),152,142,103 ); c++;
    Fl::set_color(Fl_Color(c),159,149,113 ); c++;
    Fl::set_color(Fl_Color(c),165,156,122 ); c++;
    Fl::set_color(Fl_Color(c),172,163,132 ); c++;
    Fl::set_color(Fl_Color(c),178,170,141 ); c++;
    Fl::set_color(Fl_Color(c),185,178,151 ); c++;
    Fl::set_color(Fl_Color(c),191,185,160 ); c++;
    Fl::set_color(Fl_Color(c),197,192,170 ); c++;
    Fl::set_color(Fl_Color(c),204,199,179 ); c++;
    Fl::set_color(Fl_Color(c),210,206,189 ); c++;
    Fl::set_color(Fl_Color(c),217,213,198 ); c++;
    Fl::set_color(Fl_Color(c),223,220,208 ); c++;
    Fl::set_color(Fl_Color(c),229,227,217 ); c++;
    Fl::set_color(Fl_Color(c),236,234,227 ); c++;
    Fl::set_color(Fl_Color(c),242,241,236 ); c++;
    Fl::set_color(Fl_Color(c),249,248,246 ); c++;
    Fl::set_color(Fl_Color(c),255,255,255 ); c++;
    Fl::reload_scheme();                // update scheme with new colors
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to