MultiImage Class Reference

Inherits Symbol.

List of all members.

Public Member Functions

void _measure (int &, int &) const
void _draw (const Rectangle &) const
const Symbolcurrent_image () const
void inset (Rectangle &) const
bool fills_rectangle () const
bool is_frame () const
 MultiImage ()
 MultiImage (unsigned count, const Symbol *img0, va_list ap)
void set (unsigned count, const Symbol *img0,...)
void add (Flags flags, const Symbol &image)
void release ()
 MultiImage (const Symbol &img0)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2, Flags f3, const Symbol &img3)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2, Flags f3, const Symbol &img3, Flags f4, const Symbol &img4)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2, Flags f3, const Symbol &img3, Flags f4, const Symbol &img4, Flags f5, const Symbol &img5)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2, Flags f3, const Symbol &img3, Flags f4, const Symbol &img4, Flags f5, const Symbol &img5, Flags f6, const Symbol &img6)
 MultiImage (const Symbol &img0, Flags f1, const Symbol &img1, Flags f2, const Symbol &img2, Flags f3, const Symbol &img3, Flags f4, const Symbol &img4, Flags f5, const Symbol &img5, Flags f6, const Symbol &img6, Flags f7, const Symbol &img7)


Detailed Description

A Symbol containing pointers to a set of different Symbols. The drawflags() are used to select which one to draw. This is most useful for making an image for a button that is different depending on whether it is pushed in, the current value is on, or when the mouse is over it.

The basic constructor takes the "image0" which is the image that is drawn if no other image is used. You can then use add() or replace() to add pairs of images and flags. These are searched and the last one where all it's flags are turned on is used. There are also inline constructors so that a fully-populated MultiImage with up to 8 images can be declared inline.

Typical example:

  MultiImage buttonImage(OffImage,
        HIGHLIGHT, BrightOffImage,
        STATE, OnImage,
        HIGHLIGHT|STATE, BrightOnImage,
        INACTIVE_R, DimOffImage,
        INACTIVE_R|VALUE, DimOnImage);

Useful flags are:


Constructor & Destructor Documentation

MultiImage::MultiImage  )  [inline]
 

for MultiImage arrays construction using set() for post initialization

MultiImage::MultiImage unsigned  count,
const Symbol img0,
va_list  ap
[inline]
 

constructor for unlimited images state affectation

MultiImage::MultiImage const Symbol image0  )  [inline]
 

Constructor where only the "image0" is provided. Unless you call add(), this will always just draw image0.

MultiImage::MultiImage const Symbol image0,
Flags  flags1,
const Symbol image1
[inline]
 

If all of flags1 are on in drawimage(), then image1 will be drawn, otherwise image0 will be drawn.

MultiImage::MultiImage const Symbol image0,
Flags  flags1,
const Symbol image1,
Flags  flags2,
const Symbol image2
[inline]
 

If all of flags2 are on in drawimage(), then image2 will be drawn, else if all of flags1 are on then image1 will be drawn, otherwise image0 will be drawn.

This pattern continues for the other inline constructors. The last image and flags are checked first, and then backwards.


Member Function Documentation

void MultiImage::_draw const Rectangle r  )  const [virtual]
 

Select one of the images and draw it. The last image with all the flags specified for it turned on will be drawn. If none of them match then Image0 is drawn.

Implements Symbol.

void MultiImage::_measure int &  w,
int &  h
const [virtual]
 

It probably is useless for the images to be different sizes. However if they are, Image0 (the first one passed to the constructor) is used to figure out the size.

Reimplemented from Symbol.

void MultiImage::add Flags  flags,
const Symbol image
 

Makes it draw image if all of the flags are turned on in drawflags().

If flags is zero, this replaces the image0 that was provided to the constructor. Otherwise, if any image with flags has already been specified, it is replaced with this image. Otherwise a new pair of flags and image is added to the end of the list.

const Symbol * MultiImage::current_image  )  const
 

Return the image that will be drawn according to the current value of drawflags(). The last image with all the flags specified for it turned on will be drawn. If none of them match then image0 (the first one passed to the constructor) is returned.

bool MultiImage::fills_rectangle  )  const [virtual]
 

Returns the info from the first image given to the constructor.

Reimplemented from Symbol.

void MultiImage::inset Rectangle r  )  const [virtual]
 

Calls the same image that _draw() will call to get the inset.

Reimplemented from Symbol.

bool MultiImage::is_frame  )  const [virtual]
 

Returns the info from the first image given to the constructor.

Reimplemented from Symbol.

void MultiImage::release  )  [inline]
 

Destroys everything except image0.

void MultiImage::set unsigned  count,
const Symbol img0,
  ...
 

Innards of the inline constructors.


The documentation for this class was generated from the following files:
Sun Jan 7 00:55:18 2007. FLTK ©2006 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.