2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: imaglist.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxImageList
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxImageList
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
wxImageList is used principally in conjunction with wxTreeCtrl and
|
|
|
|
wxListCtrl classes.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxTreeCtrl, wxListCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxImageList : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor specifying the image size, whether image masks should be created,
|
|
|
|
and the initial size of the list.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param width
|
2008-03-09 12:33:59 +00:00
|
|
|
Width of the images in the list.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param height
|
2008-03-09 12:33:59 +00:00
|
|
|
Height of the images in the list.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param mask
|
2008-03-09 12:33:59 +00:00
|
|
|
@true if masks should be created for all images.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param initialCount
|
2008-03-09 12:33:59 +00:00
|
|
|
The initial size of the list.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see Create()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxImageList();
|
2008-03-09 12:33:59 +00:00
|
|
|
wxImageList(int width, int height, bool mask = true,
|
2008-03-08 14:43:31 +00:00
|
|
|
int initialCount = 1);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Adds a new image using an icon.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param bitmap
|
2008-03-09 12:33:59 +00:00
|
|
|
Bitmap representing the opaque areas of the image.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param mask
|
2008-03-09 12:33:59 +00:00
|
|
|
Monochrome mask bitmap, representing the transparent areas of the image.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param maskColour
|
2008-03-09 12:33:59 +00:00
|
|
|
Colour indicating which parts of the image are transparent.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param icon
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon to use as the image.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return The new zero-based image index.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@remarks The original bitmap or icon is not affected by the Add
|
2008-03-09 12:33:59 +00:00
|
|
|
operation, and can be deleted afterwards.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
int Add(const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& mask = wxNullBitmap);
|
2008-03-08 14:43:31 +00:00
|
|
|
int Add(const wxBitmap& bitmap, const wxColour& maskColour);
|
|
|
|
int Add(const wxIcon& icon);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initializes the list. See wxImageList() for details.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(int width, int height, bool mask = true,
|
2008-03-08 13:52:38 +00:00
|
|
|
int initialCount = 1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Draws a specified image onto a device context.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param index
|
2008-03-09 12:33:59 +00:00
|
|
|
Image index, starting from zero.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param dc
|
2008-03-09 12:33:59 +00:00
|
|
|
Device context to draw on.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param x
|
2008-03-09 12:33:59 +00:00
|
|
|
X position on the device context.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param y
|
2008-03-09 12:33:59 +00:00
|
|
|
Y position on the device context.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param flags
|
2008-03-09 12:33:59 +00:00
|
|
|
How to draw the image. A bitlist of a selection of the following:
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxIMAGELIST_DRAW_NORMAL
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Draw the image normally.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxIMAGELIST_DRAW_TRANSPARENT
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Draw the image with transparency.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxIMAGELIST_DRAW_SELECTED
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Draw the image in selected state.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxIMAGELIST_DRAW_FOCUSED
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Draw the image in a focused state.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param solidBackground
|
2008-03-09 12:33:59 +00:00
|
|
|
For optimisation - drawing can be faster if the function is told
|
|
|
|
that the background is solid.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool Draw(int index, wxDC& dc, int x, int y,
|
|
|
|
int flags = wxIMAGELIST_DRAW_NORMAL,
|
|
|
|
bool solidBackground = false);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the bitmap corresponding to the given index.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxBitmap GetBitmap(int index) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the icon corresponding to the given index.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxIcon GetIcon(int index) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of images in the list.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual int GetImageCount() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Retrieves the size of the images in the list. Currently, the @a index
|
2008-03-08 13:52:38 +00:00
|
|
|
parameter is ignored as all images in the list have the same size.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param index
|
2008-03-09 12:33:59 +00:00
|
|
|
currently unused, should be 0
|
2008-03-08 14:43:31 +00:00
|
|
|
@param width
|
2008-03-09 12:33:59 +00:00
|
|
|
receives the width of the images in the list
|
2008-03-08 14:43:31 +00:00
|
|
|
@param height
|
2008-03-09 12:33:59 +00:00
|
|
|
receives the height of the images in the list
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return @true if the function succeeded, @false if it failed (for example,
|
2008-03-09 12:33:59 +00:00
|
|
|
if the image list was not yet initialized).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool GetSize(int index, int& width, int& height) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Removes the image at the given position.
|
|
|
|
*/
|
|
|
|
bool Remove(int index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Removes all the images in the list.
|
|
|
|
*/
|
|
|
|
bool RemoveAll();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Replaces the existing image with the new image.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param bitmap
|
2008-03-09 12:33:59 +00:00
|
|
|
Bitmap representing the opaque areas of the image.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param mask
|
2008-03-09 12:33:59 +00:00
|
|
|
Monochrome mask bitmap, representing the transparent areas of the image.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param icon
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon to use as the image.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return @true if the replacement was successful, @false otherwise.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@remarks The original bitmap or icon is not affected by the Replace
|
2008-03-09 12:33:59 +00:00
|
|
|
operation, and can be deleted afterwards.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Replace(int index, const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& mask = wxNullBitmap);
|
2008-03-08 14:43:31 +00:00
|
|
|
bool Replace(int index, const wxIcon& icon);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|