#include <wx/imaglist.h>
A wxImageList contains a list of images, which are stored in an unspecified form.
Images can have masks for transparent drawing, and can be made from a variety of sources including bitmaps and icons.
wxImageList is used principally in conjunction with wxTreeCtrl and wxListCtrl classes.
Public Member Functions | |
wxImageList () | |
Default ctor. | |
wxImageList (int width, int height, bool mask=true, int initialCount=1) | |
Constructor specifying the image size, whether image masks should be created, and the initial size of the list. | |
int | Add (const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap) |
Adds a new image or images using a bitmap and optional mask bitmap. | |
int | Add (const wxBitmap &bitmap, const wxColour &maskColour) |
Adds a new image or images using a bitmap and mask colour. | |
int | Add (const wxIcon &icon) |
Adds a new image using an icon. | |
bool | Create (int width, int height, bool mask=true, int initialCount=1) |
Initializes the list. | |
virtual bool | Draw (int index, wxDC &dc, int x, int y, int flags=wxIMAGELIST_DRAW_NORMAL, bool solidBackground=false) |
Draws a specified image onto a device context. | |
wxBitmap | GetBitmap (int index) const |
Returns the bitmap corresponding to the given index. | |
wxIcon | GetIcon (int index) const |
Returns the icon corresponding to the given index. | |
virtual int | GetImageCount () const |
Returns the number of images in the list. | |
virtual bool | GetSize (int index, int &width, int &height) const |
Retrieves the size of the images in the list. | |
bool | Remove (int index) |
Removes the image at the given position. | |
bool | RemoveAll () |
Removes all the images in the list. | |
bool | Replace (int index, const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap) |
Replaces the existing image with the new image. | |
bool | Replace (int index, const wxIcon &icon) |
Replaces the existing image with the new image. |
wxImageList::wxImageList | ( | ) |
Default ctor.
wxImageList::wxImageList | ( | int | width, |
int | height, | ||
bool | mask = true , |
||
int | initialCount = 1 |
||
) |
Constructor specifying the image size, whether image masks should be created, and the initial size of the list.
width | Width of the images in the list. |
height | Height of the images in the list. |
mask | true if masks should be created for all images. |
initialCount | The initial size of the list. |
int wxImageList::Add | ( | const wxBitmap & | bitmap, |
const wxBitmap & | mask = wxNullBitmap |
||
) |
Adds a new image or images using a bitmap and optional mask bitmap.
bitmap | Bitmap representing the opaque areas of the image. |
mask | Monochrome mask bitmap, representing the transparent areas of the image. |
Adds a new image or images using a bitmap and mask colour.
bitmap | Bitmap representing the opaque areas of the image. |
maskColour | Colour indicating which parts of the image are transparent. |
int wxImageList::Add | ( | const wxIcon & | icon | ) |
Adds a new image using an icon.
icon | Icon to use as the image. |
bool wxImageList::Create | ( | int | width, |
int | height, | ||
bool | mask = true , |
||
int | initialCount = 1 |
||
) |
Initializes the list.
See wxImageList() for details.
virtual bool wxImageList::Draw | ( | int | index, |
wxDC & | dc, | ||
int | x, | ||
int | y, | ||
int | flags = wxIMAGELIST_DRAW_NORMAL , |
||
bool | solidBackground = false |
||
) | [virtual] |
Draws a specified image onto a device context.
index | Image index, starting from zero. |
dc | Device context to draw on. |
x | X position on the device context. |
y | Y position on the device context. |
flags | How to draw the image. A bitlist of a selection of the following:
|
solidBackground | For optimisation - drawing can be faster if the function is told that the background is solid. |
wxBitmap wxImageList::GetBitmap | ( | int | index | ) | const |
Returns the bitmap corresponding to the given index.
wxIcon wxImageList::GetIcon | ( | int | index | ) | const |
Returns the icon corresponding to the given index.
virtual int wxImageList::GetImageCount | ( | ) | const [virtual] |
Returns the number of images in the list.
virtual bool wxImageList::GetSize | ( | int | index, |
int & | width, | ||
int & | height | ||
) | const [virtual] |
Retrieves the size of the images in the list.
Currently, the index parameter is ignored as all images in the list have the same size.
index | currently unused, should be 0 |
width | receives the width of the images in the list |
height | receives the height of the images in the list |
bool wxImageList::Remove | ( | int | index | ) |
Removes the image at the given position.
bool wxImageList::RemoveAll | ( | ) |
Removes all the images in the list.
bool wxImageList::Replace | ( | int | index, |
const wxIcon & | icon | ||
) |
Replaces the existing image with the new image.
index | The index of the bitmap to be replaced. |
icon | Icon to use as the image. |
bool wxImageList::Replace | ( | int | index, |
const wxBitmap & | bitmap, | ||
const wxBitmap & | mask = wxNullBitmap |
||
) |
Replaces the existing image with the new image.
Windows only.
index | The index of the bitmap to be replaced. |
bitmap | Bitmap representing the opaque areas of the image. |
mask | Monochrome mask bitmap, representing the transparent areas of the image. |