Matthias Melcher wrote:
> In FLTK 1.3, you can use FL_ALIGN_IMAGE_BACKDROP for alignment.
> It will first draw the boxtype, then draw a centered image, then draw a 
> centered text.
> PS: There are a lot of new alignment values in FLTK 1.3... .

        Cool! I've added a comment about that on the cheat page
        for my 'text over image' examples.

        Here's a simple working example showing how to use that flag;
        now one doesn't have to derive a widget just to get an image
        to appear under button text.


#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Pixmap.H>
#include "gradient.xpm"
//
// Demonstrate how to draw text over an image using new FLTK 1.3.x 
"FL_ALIGN_IMAGE_BACKDROP" feature -- erco 10/25/10
// For the example 'gradient.xpm' image, see: 
http://seriss.com/people/erco/fltk/gradient.xpm
//
int main(int argc, char **argv) {
    Fl_Pixmap gradient(gradient_xpm);                         // see 
"gradient.xpm"
    Fl_Window *win = new Fl_Window(160, 75, "test");          // create window

    Fl_Button *but1 = new Fl_Button(10,10,140,25,"Button 1"); // create custom 
button
    but1->image(&gradient);                                   // assign image 
to button
    but1->align(FL_ALIGN_IMAGE_BACKDROP|but1->align());       // enable align 
to use image as a 'backdrop'

    win->end();
    win->show(argc,argv);
    return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to