]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/imaglist.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxImageList
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 A wxImageList contains a list of images, which are stored in
13 an unspecified form. Images can have masks for transparent
14 drawing, and can be made from a variety of sources including bitmaps
17 wxImageList is used principally in conjunction with wxTreeCtrl and
23 @see wxTreeCtrl, wxListCtrl
25 class wxImageList
: public wxObject
30 Constructor specifying the image size, whether image masks should be created,
31 and the initial size of the list.
34 Width of the images in the list.
36 Height of the images in the list.
38 @true if masks should be created for all images.
40 The initial size of the list.
45 wxImageList(int width
, int height
, bool mask
= true,
46 int initialCount
= 1);
51 Adds a new image using an icon.
54 Bitmap representing the opaque areas of the image.
56 Monochrome mask bitmap, representing the transparent areas of the image.
58 Colour indicating which parts of the image are transparent.
60 Icon to use as the image.
62 @return The new zero-based image index.
64 @remarks The original bitmap or icon is not affected by the Add
65 operation, and can be deleted afterwards.
67 int Add(const wxBitmap
& bitmap
,
68 const wxBitmap
& mask
= wxNullBitmap
);
69 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
70 int Add(const wxIcon
& icon
);
74 Initializes the list. See wxImageList() for details.
76 bool Create(int width
, int height
, bool mask
= true,
77 int initialCount
= 1);
80 Draws a specified image onto a device context.
83 Image index, starting from zero.
85 Device context to draw on.
87 X position on the device context.
89 Y position on the device context.
91 How to draw the image. A bitlist of a selection of the following:
98 wxIMAGELIST_DRAW_NORMAL
103 Draw the image normally.
109 wxIMAGELIST_DRAW_TRANSPARENT
114 Draw the image with transparency.
120 wxIMAGELIST_DRAW_SELECTED
125 Draw the image in selected state.
131 wxIMAGELIST_DRAW_FOCUSED
136 Draw the image in a focused state.
137 @param solidBackground
138 For optimisation - drawing can be faster if the function is told
139 that the background is solid.
141 virtual bool Draw(int index
, wxDC
& dc
, int x
, int y
,
142 int flags
= wxIMAGELIST_DRAW_NORMAL
,
143 bool solidBackground
= false);
146 Returns the bitmap corresponding to the given index.
148 wxBitmap
GetBitmap(int index
) const;
151 Returns the icon corresponding to the given index.
153 wxIcon
GetIcon(int index
) const;
156 Returns the number of images in the list.
158 virtual int GetImageCount() const;
161 Retrieves the size of the images in the list. Currently, the @a index
162 parameter is ignored as all images in the list have the same size.
165 currently unused, should be 0
167 receives the width of the images in the list
169 receives the height of the images in the list
171 @return @true if the function succeeded, @false if it failed (for example,
172 if the image list was not yet initialized).
174 virtual bool GetSize(int index
, int& width
, int& height
) const;
177 Removes the image at the given position.
179 bool Remove(int index
);
182 Removes all the images in the list.
188 Replaces the existing image with the new image.
191 Bitmap representing the opaque areas of the image.
193 Monochrome mask bitmap, representing the transparent areas of the image.
195 Icon to use as the image.
197 @return @true if the replacement was successful, @false otherwise.
199 @remarks The original bitmap or icon is not affected by the Replace
200 operation, and can be deleted afterwards.
202 bool Replace(int index
, const wxBitmap
& bitmap
,
203 const wxBitmap
& mask
= wxNullBitmap
);
204 bool Replace(int index
, const wxIcon
& icon
);