class fltk::MultiImage
This subclass of fltk::Image
allows a different image to be used for different states of the
widget. For instance a different image can be drawn when a button is
pushed in, or when it has the focus, or when it is highlighted by the
mouse.
fltk::MultiImage(fltk::Image& image0,
fltk::Flags flags1, fltk::Image& image1,
fltk::Flags flags2, fltk::Image& image2,
...)
The constructors takes references to the base image0, and up to
seven pairs of flags and supplemental images. There are actually many
constructors, for each possible number of supplemental images up to 7.
You want the images with fewer flags first. See the description of
draw for the exact algorithim, but basically the last matching image
is used. Useful flags (which may be or'd together) are:
- fltk::VALUE : true when the button is pushed in or turned on.
- fltk::SELECTED : true for selected browser items, or for
buttons, menu items, or other widgets that have the focus. If you use
this to indicate focus you may want to turn off the "dotted box" by
doing widget->focus_box(fltk::NO_BOX).
- fltk::HIGHLIGHT : true when the mouse cursor is pointing at
the button. To make this work you must also set
widget->highlight_color(fltk::GRAY> (the actual color is
ignored) so fltk knows it need to redraw it to show highlighting.
- fltk::INACTIVE : true when the widget is inactive.
~MultiImage()
The destructor does not destroy or touch any of the referenced
images.
void draw(int x, int y, int w, int h, fltk::Flags flags)
Draw searches all the images supplied to the constructor. For each
image it compares flags to the flags supplied to the
constructor for that image. All flags supplied to the constructor must
be turned on, however other flags may also be turned on. After
searching, the last image that had matching flags is the one that is
drawn. If no images had matching flags then image0 is drawn.
void draw(int x, int y, fltk::Flags = 0)
Draws the image with the upper-left corner at x,y. This is
the same as doing draw(x, y, this->w, this->h, flags).