]>
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 /////////////////////////////////////////////////////////////////////////////
13 A wxImageList contains a list of images, which are stored in
14 an unspecified form. Images can have masks for transparent
15 drawing, and can be made from a variety of sources including bitmaps
18 wxImageList is used principally in conjunction with wxTreeCtrl and
24 @see wxTreeCtrl, wxListCtrl
26 class wxImageList
: public wxObject
31 Constructor specifying the image size, whether image masks should be created,
32 and the initial size of the list.
35 Width of the images in the list.
37 Height of the images in the list.
39 @true if masks should be created for all images.
41 The initial size of the list.
46 wxImageList(int width
, int height
, bool mask
= true,
47 int initialCount
= 1);
52 Adds a new image using an icon.
55 Bitmap representing the opaque areas of the image.
57 Monochrome mask bitmap, representing the transparent areas of the image.
59 Colour indicating which parts of the image are transparent.
61 Icon to use as the image.
63 @return The new zero-based image index.
65 @remarks The original bitmap or icon is not affected by the Add
66 operation, and can be deleted afterwards.
68 int Add(const wxBitmap
& bitmap
,
69 const wxBitmap
& mask
= wxNullBitmap
);
70 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
71 int Add(const wxIcon
& icon
);
75 Initializes the list. See wxImageList() for details.
77 bool Create(int width
, int height
, bool mask
= true,
78 int initialCount
= 1);
81 Draws a specified image onto a device context.
84 Image index, starting from zero.
86 Device context to draw on.
88 X position on the device context.
90 Y position on the device context.
92 How to draw the image. A bitlist of a selection of the following:
99 wxIMAGELIST_DRAW_NORMAL
104 Draw the image normally.
110 wxIMAGELIST_DRAW_TRANSPARENT
115 Draw the image with transparency.
121 wxIMAGELIST_DRAW_SELECTED
126 Draw the image in selected state.
132 wxIMAGELIST_DRAW_FOCUSED
137 Draw the image in a focused state.
138 @param solidBackground
139 For optimisation - drawing can be faster if the function is told
140 that the background is solid.
142 bool Draw(int index
, wxDC
& dc
, int x
, int y
,
143 int flags
= wxIMAGELIST_DRAW_NORMAL
,
144 bool solidBackground
= false);
147 Returns the bitmap corresponding to the given index.
149 wxBitmap
GetBitmap(int index
) const;
152 Returns the icon corresponding to the given index.
154 wxIcon
GetIcon(int index
) const;
157 Returns the number of images in the list.
159 int GetImageCount() const;
162 Retrieves the size of the images in the list. Currently, the @a index
163 parameter is ignored as all images in the list have the same size.
166 currently unused, should be 0
168 receives the width of the images in the list
170 receives the height of the images in the list
172 @return @true if the function succeeded, @false if it failed (for example,
173 if the image list was not yet initialized).
175 bool GetSize(int index
, int& width
, int& height
) const;
178 Removes the image at the given position.
180 bool Remove(int index
);
183 Removes all the images in the list.
189 Replaces the existing image with the new image.
192 Bitmap representing the opaque areas of the image.
194 Monochrome mask bitmap, representing the transparent areas of the image.
196 Icon to use as the image.
198 @return @true if the replacement was successful, @false otherwise.
200 @remarks The original bitmap or icon is not affected by the Replace
201 operation, and can be deleted afterwards.
203 bool Replace(int index
, const wxBitmap
& bitmap
,
204 const wxBitmap
& mask
= wxNullBitmap
);
205 bool Replace(int index
, const wxIcon
& icon
);