]>
git.saurik.com Git - wxWidgets.git/blob - interface/imaglist.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxImageList
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @ingroup group_class_gdi
14 A wxImageList contains a list of images, which are stored in
15 an unspecified form. Images can have masks for transparent
16 drawing, and can be made from a variety of sources including bitmaps
19 wxImageList is used principally in conjunction with wxTreeCtrl and
25 @see wxTreeCtrl, wxListCtrl
27 class wxImageList
: public wxObject
32 Constructor specifying the image size, whether image masks should be created,
33 and the initial size of the list.
36 Width of the images in the list.
38 Height of the images in the list.
40 @true if masks should be created for all images.
42 The initial size of the list.
47 wxImageList(int width
, int height
, bool mask
= true,
48 int initialCount
= 1);
53 Adds a new image using an icon.
56 Bitmap representing the opaque areas of the image.
58 Monochrome mask bitmap, representing the transparent areas of the image.
60 Colour indicating which parts of the image are transparent.
62 Icon to use as the image.
64 @returns The new zero-based image index.
66 @remarks The original bitmap or icon is not affected by the Add
67 operation, and can be deleted afterwards.
69 int Add(const wxBitmap
& bitmap
,
70 const wxBitmap
& mask
= wxNullBitmap
);
71 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
72 int Add(const wxIcon
& icon
);
76 Initializes the list. See wxImageList() for details.
78 bool Create(int width
, int height
, bool mask
= true,
79 int initialCount
= 1);
82 Draws a specified image onto a device context.
85 Image index, starting from zero.
87 Device context to draw on.
89 X position on the device context.
91 Y position on the device context.
93 How to draw the image. A bitlist of a selection of the following:
100 wxIMAGELIST_DRAW_NORMAL
105 Draw the image normally.
111 wxIMAGELIST_DRAW_TRANSPARENT
116 Draw the image with transparency.
122 wxIMAGELIST_DRAW_SELECTED
127 Draw the image in selected state.
133 wxIMAGELIST_DRAW_FOCUSED
138 Draw the image in a focused state.
139 @param solidBackground
140 For optimisation - drawing can be faster if the function is told
141 that the background is solid.
143 bool Draw(int index
, wxDC
& dc
, int x
, int y
,
144 int flags
= wxIMAGELIST_DRAW_NORMAL
,
145 bool solidBackground
= false);
148 Returns the bitmap corresponding to the given index.
150 wxBitmap
GetBitmap(int index
) const;
153 Returns the icon corresponding to the given index.
155 wxIcon
GetIcon(int index
) const;
158 Returns the number of images in the list.
160 int GetImageCount() const;
163 Retrieves the size of the images in the list. Currently, the @a index
164 parameter is ignored as all images in the list have the same size.
167 currently unused, should be 0
169 receives the width of the images in the list
171 receives the height of the images in the list
173 @returns @true if the function succeeded, @false if it failed (for example,
174 if the image list was not yet initialized).
176 bool GetSize(int index
, int& width
, int& height
) const;
179 Removes the image at the given position.
181 bool Remove(int index
);
184 Removes all the images in the list.
190 Replaces the existing image with the new image.
193 Bitmap representing the opaque areas of the image.
195 Monochrome mask bitmap, representing the transparent areas of the image.
197 Icon to use as the image.
199 @returns @true if the replacement was successful, @false otherwise.
201 @remarks The original bitmap or icon is not affected by the Replace
202 operation, and can be deleted afterwards.
204 bool Replace(int index
, const wxBitmap
& bitmap
,
205 const wxBitmap
& mask
= wxNullBitmap
);
206 bool Replace(int index
, const wxIcon
& icon
);