]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/imaglist.h
ab2cd24a0c725a8539e063bf77b235707fda246a
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxImageList
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 Flag values for Set/GetImageList
14 wxIMAGE_LIST_NORMAL
, // Normal icons
15 wxIMAGE_LIST_SMALL
, // Small icons
16 wxIMAGE_LIST_STATE
// State icons: unimplemented (see WIN32 documentation)
22 #define wxIMAGELIST_DRAW_NORMAL 0x0001
23 #define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
24 #define wxIMAGELIST_DRAW_SELECTED 0x0004
25 #define wxIMAGELIST_DRAW_FOCUSED 0x0008
31 A wxImageList contains a list of images, which are stored in an unspecified
32 form. Images can have masks for transparent drawing, and can be made from a
33 variety of sources including bitmaps and icons.
35 wxImageList is used principally in conjunction with wxTreeCtrl and
41 @see wxTreeCtrl, wxListCtrl
43 class wxImageList
: public wxObject
52 Constructor specifying the image size, whether image masks should be created,
53 and the initial size of the list.
56 Width of the images in the list.
58 Height of the images in the list.
60 @true if masks should be created for all images.
62 The initial size of the list.
66 wxImageList(int width
, int height
, bool mask
= true,
67 int initialCount
= 1);
70 Adds a new image or images using a bitmap and optional mask bitmap.
73 Bitmap representing the opaque areas of the image.
75 Monochrome mask bitmap, representing the transparent areas of the image.
77 @return The new zero-based image index.
79 @remarks The original bitmap or icon is not affected by the Add()
80 operation, and can be deleted afterwards.
81 If the bitmap is wider than the images in the list, then the
82 bitmap will automatically be split into smaller images, each
83 matching the dimensions of the image list.
84 This does not apply when adding icons.
86 int Add(const wxBitmap
& bitmap
,
87 const wxBitmap
& mask
= wxNullBitmap
);
90 Adds a new image or images using a bitmap and mask colour.
93 Bitmap representing the opaque areas of the image.
95 Colour indicating which parts of the image are transparent.
97 @return The new zero-based image index.
99 @remarks The original bitmap or icon is not affected by the Add()
100 operation, and can be deleted afterwards.
101 If the bitmap is wider than the images in the list, then the
102 bitmap will automatically be split into smaller images, each
103 matching the dimensions of the image list.
104 This does not apply when adding icons.
106 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
109 Adds a new image using an icon.
112 Icon to use as the image.
114 @return The new zero-based image index.
116 @remarks The original bitmap or icon is not affected by the Add()
117 operation, and can be deleted afterwards.
118 If the bitmap is wider than the images in the list, then the
119 bitmap will automatically be split into smaller images, each
120 matching the dimensions of the image list.
121 This does not apply when adding icons.
123 @onlyfor{wxmsw,wxosx}
125 int Add(const wxIcon
& icon
);
128 Initializes the list. See wxImageList() for details.
130 bool Create(int width
, int height
, bool mask
= true,
131 int initialCount
= 1);
134 Draws a specified image onto a device context.
137 Image index, starting from zero.
139 Device context to draw on.
141 X position on the device context.
143 Y position on the device context.
145 How to draw the image. A bitlist of a selection of the following:
146 - wxIMAGELIST_DRAW_NORMAL: Draw the image normally.
147 - wxIMAGELIST_DRAW_TRANSPARENT: Draw the image with transparency.
148 - wxIMAGELIST_DRAW_SELECTED: Draw the image in selected state.
149 - wxIMAGELIST_DRAW_FOCUSED: Draw the image in a focused state.
150 @param solidBackground
151 For optimisation - drawing can be faster if the function is told
152 that the background is solid.
154 virtual bool Draw(int index
, wxDC
& dc
, int x
, int y
,
155 int flags
= wxIMAGELIST_DRAW_NORMAL
,
156 bool solidBackground
= false);
159 Returns the bitmap corresponding to the given index.
161 wxBitmap
GetBitmap(int index
) const;
164 Returns the icon corresponding to the given index.
166 wxIcon
GetIcon(int index
) const;
169 Returns the number of images in the list.
171 virtual int GetImageCount() const;
174 Retrieves the size of the images in the list. Currently, the @a index
175 parameter is ignored as all images in the list have the same size.
178 currently unused, should be 0
180 receives the width of the images in the list
182 receives the height of the images in the list
184 @return @true if the function succeeded, @false if it failed
185 (for example, if the image list was not yet initialized).
187 virtual bool GetSize(int index
, int& width
, int& height
) const;
190 Removes the image at the given position.
192 bool Remove(int index
);
195 Removes all the images in the list.
200 Replaces the existing image with the new image.
204 The index of the bitmap to be replaced.
206 Bitmap representing the opaque areas of the image.
208 Monochrome mask bitmap, representing the transparent areas of the image.
210 @return @true if the replacement was successful, @false otherwise.
212 @remarks The original bitmap or icon is not affected by the Replace()
213 operation, and can be deleted afterwards.
215 bool Replace(int index
, const wxBitmap
& bitmap
,
216 const wxBitmap
& mask
= wxNullBitmap
);
219 Replaces the existing image with the new image.
222 The index of the bitmap to be replaced.
224 Icon to use as the image.
226 @return @true if the replacement was successful, @false otherwise.
228 @remarks The original bitmap or icon is not affected by the Replace()
229 operation, and can be deleted afterwards.
231 @onlyfor{wxmsw,wxosx}
233 bool Replace(int index
, const wxIcon
& icon
);