]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/imaglist.h
76a8eaf5dbc0fd0fa91c209c154159a69538146b
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 an unspecified
13 form. Images can have masks for transparent drawing, and can be made from a
14 variety of sources including bitmaps and icons.
16 wxImageList is used principally in conjunction with wxTreeCtrl and
22 @see wxTreeCtrl, wxListCtrl
24 class wxImageList
: public wxObject
33 Constructor specifying the image size, whether image masks should be created,
34 and the initial size of the list.
37 Width of the images in the list.
39 Height of the images in the list.
41 @true if masks should be created for all images.
43 The initial size of the list.
47 wxImageList(int width
, int height
, bool mask
= true,
48 int initialCount
= 1);
51 Adds a new image or images using a bitmap and optional mask bitmap.
54 Bitmap representing the opaque areas of the image.
56 Monochrome mask bitmap, representing the transparent areas of the image.
58 @return The new zero-based image index.
60 @remarks The original bitmap or icon is not affected by the Add()
61 operation, and can be deleted afterwards.
62 If the bitmap is wider than the images in the list, then the
63 bitmap will automatically be split into smaller images, each
64 matching the dimensions of the image list.
65 This does not apply when adding icons.
67 int Add(const wxBitmap
& bitmap
,
68 const wxBitmap
& mask
= wxNullBitmap
);
71 Adds a new image or images using a bitmap and mask colour.
74 Bitmap representing the opaque areas of the image.
76 Colour indicating which parts of the image are transparent.
78 @return The new zero-based image index.
80 @remarks The original bitmap or icon is not affected by the Add()
81 operation, and can be deleted afterwards.
82 If the bitmap is wider than the images in the list, then the
83 bitmap will automatically be split into smaller images, each
84 matching the dimensions of the image list.
85 This does not apply when adding icons.
87 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
90 Adds a new image using an icon.
93 Icon to use as the image.
95 @return The new zero-based image index.
97 @remarks The original bitmap or icon is not affected by the Add()
98 operation, and can be deleted afterwards.
99 If the bitmap is wider than the images in the list, then the
100 bitmap will automatically be split into smaller images, each
101 matching the dimensions of the image list.
102 This does not apply when adding icons.
104 int Add(const wxIcon
& icon
);
107 Initializes the list. See wxImageList() for details.
109 bool Create(int width
, int height
, bool mask
= true,
110 int initialCount
= 1);
113 Draws a specified image onto a device context.
116 Image index, starting from zero.
118 Device context to draw on.
120 X position on the device context.
122 Y position on the device context.
124 How to draw the image. A bitlist of a selection of the following:
125 - wxIMAGELIST_DRAW_NORMAL: Draw the image normally.
126 - wxIMAGELIST_DRAW_TRANSPARENT: Draw the image with transparency.
127 - wxIMAGELIST_DRAW_SELECTED: Draw the image in selected state.
128 - wxIMAGELIST_DRAW_FOCUSED: Draw the image in a focused state.
129 @param solidBackground
130 For optimisation - drawing can be faster if the function is told
131 that the background is solid.
133 virtual bool Draw(int index
, wxDC
& dc
, int x
, int y
,
134 int flags
= wxIMAGELIST_DRAW_NORMAL
,
135 bool solidBackground
= false);
138 Returns the bitmap corresponding to the given index.
140 wxBitmap
GetBitmap(int index
) const;
143 Returns the icon corresponding to the given index.
145 wxIcon
GetIcon(int index
) const;
148 Returns the number of images in the list.
150 virtual int GetImageCount() const;
153 Retrieves the size of the images in the list. Currently, the @a index
154 parameter is ignored as all images in the list have the same size.
157 currently unused, should be 0
159 receives the width of the images in the list
161 receives the height of the images in the list
163 @return @true if the function succeeded, @false if it failed
164 (for example, if the image list was not yet initialized).
166 virtual bool GetSize(int index
, int& width
, int& height
) const;
169 Removes the image at the given position.
171 bool Remove(int index
);
174 Removes all the images in the list.
179 Replaces the existing image with the new image.
183 The index of the bitmap to be replaced.
185 Bitmap representing the opaque areas of the image.
187 Monochrome mask bitmap, representing the transparent areas of the image.
189 @return @true if the replacement was successful, @false otherwise.
191 @remarks The original bitmap or icon is not affected by the Replace()
192 operation, and can be deleted afterwards.
194 bool Replace(int index
, const wxBitmap
& bitmap
,
195 const wxBitmap
& mask
= wxNullBitmap
);
198 Replaces the existing image with the new image.
201 The index of the bitmap to be replaced.
203 Icon to use as the image.
205 @return @true if the replacement was successful, @false otherwise.
207 @remarks The original bitmap or icon is not affected by the Replace()
208 operation, and can be deleted afterwards.
210 bool Replace(int index
, const wxIcon
& icon
);