rafa wrote:
> Sorry, perhaps is a simple question, but there is a bitmap button on FLTK? If
> no, how I can to get?
You can attach an image/bitmap to a button (or just about any widget)
using the widget's image() method.
Here's an example of how to attach an inline xpm image
to a button:
//////////////////////////////////////////////////// <-- snip
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Shared_Image.H> // fl_register_images
static const char *cat_xpm[] = { // this is a .xpm file
"50 34 4 1",
" c black",
"o c #ff9900",
"@ c #ffffff",
"# c None",
"##################################################",
"### ############################## ####",
"### ooooo ########################### ooooo ####",
"### oo oo ######################### oo oo ####",
"### oo oo ####################### oo oo ####",
"### oo oo ##################### oo oo ####",
"### oo oo ################### oo oo ####",
"### oo oo oo oo ####",
"### oo oo ooooooooooooooo oo oo ####",
"### oo ooooooooooooooooooooo oo ####",
"### oo ooooooooooooooooooooooooooo ooo ####",
"#### oo ooooooo ooooooooooooo ooooooo oo #####",
"#### oo oooooooo ooooooooooooo oooooooo oo #####",
"##### oo oooooooo ooooooooooooo oooooooo oo ######",
"##### o ooooooooooooooooooooooooooooooo o ######",
"###### ooooooooooooooooooooooooooooooooooo #######",
"##### ooooooooo ooooooooo ooooooooo ######",
"##### oooooooo @@@ ooooooo @@@ oooooooo ######",
"##### oooooooo @@@@@ ooooooo @@@@@ oooooooo ######",
"##### oooooooo @@@@@ ooooooo @@@@@ oooooooo ######",
"##### oooooooo @@@ ooooooo @@@ oooooooo ######",
"##### ooooooooo ooooooooo ooooooooo ######",
"###### oooooooooooooo oooooooooooooo #######",
"###### oooooooo@@@@@@@ @@@@@@@oooooooo #######",
"###### ooooooo@@@@@@@@@ @@@@@@@@@ooooooo #######",
"####### ooooo@@@@@@@@@@@ @@@@@@@@@@@ooooo ########",
"######### oo@@@@@@@@@@@@ @@@@@@@@@@@@oo ##########",
"########## o@@@@@@ @@@@@ @@@@@ @@@@@@o ###########",
"########### @@@@@@@ @ @@@@@@@ ############",
"############ @@@@@@@@@@@@@@@@@@@@@ #############",
"############## @@@@@@@@@@@@@@@@@ ###############",
"################ @@@@@@@@@ #################",
"#################### #####################",
"##################################################",
};
int main() {
fl_register_images(); // initialize image lib
Fl_Window win(720,486); // make a window
Fl_Button but(10,10,100,100); // make a button
Fl_Pixmap cat(cat_xpm); // assign xpm to a pixmap
but.image(cat); // attach pixmap to button
win.show();
return(Fl::run());
}
//////////////////////////////////////////////////// <-- snip
..and here's an example that shows how to load eg. a jpg
image from disk and assign it to a box (which can also
be a button):
http://seriss.com/people/erco/fltk/#Fl_JPG_Image
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk