]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/imaglist.h
added support for wxCAL_SHOW_WEEK_NUMBERS to generic version of wxCalendarCtrl (...
[wxWidgets.git] / interface / wx / imaglist.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: imaglist.h
e54c96f1 3// Purpose: interface of wxImageList
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxImageList
7c913512 11
89bb3f02
FM
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.
7c913512 15
23324ae1
FM
16 wxImageList is used principally in conjunction with wxTreeCtrl and
17 wxListCtrl classes.
7c913512 18
23324ae1
FM
19 @library{wxcore}
20 @category{gdi}
7c913512 21
e54c96f1 22 @see wxTreeCtrl, wxListCtrl
23324ae1
FM
23*/
24class wxImageList : public wxObject
25{
26public:
89bb3f02
FM
27 /**
28 Default ctor.
29 */
30 wxImageList();
31
23324ae1
FM
32 /**
33 Constructor specifying the image size, whether image masks should be created,
34 and the initial size of the list.
3c4f71cc 35
7c913512 36 @param width
4cc4bfaf 37 Width of the images in the list.
7c913512 38 @param height
4cc4bfaf 39 Height of the images in the list.
7c913512 40 @param mask
4cc4bfaf 41 @true if masks should be created for all images.
7c913512 42 @param initialCount
4cc4bfaf 43 The initial size of the list.
3c4f71cc 44
4cc4bfaf 45 @see Create()
23324ae1 46 */
4cc4bfaf 47 wxImageList(int width, int height, bool mask = true,
7c913512 48 int initialCount = 1);
23324ae1 49
23324ae1 50 /**
89bb3f02 51 Adds a new image or images using a bitmap and optional mask bitmap.
3c4f71cc 52
7c913512 53 @param bitmap
4cc4bfaf 54 Bitmap representing the opaque areas of the image.
7c913512 55 @param mask
4cc4bfaf 56 Monochrome mask bitmap, representing the transparent areas of the image.
89bb3f02
FM
57
58 @return The new zero-based image index.
59
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.
66 */
67 int Add(const wxBitmap& bitmap,
68 const wxBitmap& mask = wxNullBitmap);
69
70 /**
71 Adds a new image or images using a bitmap and mask colour.
72
73 @param bitmap
74 Bitmap representing the opaque areas of the image.
7c913512 75 @param maskColour
4cc4bfaf 76 Colour indicating which parts of the image are transparent.
89bb3f02
FM
77
78 @return The new zero-based image index.
79
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.
86 */
87 int Add(const wxBitmap& bitmap, const wxColour& maskColour);
88
89 /**
90 Adds a new image using an icon.
91
7c913512 92 @param icon
4cc4bfaf 93 Icon to use as the image.
3c4f71cc 94
d29a9a8a 95 @return The new zero-based image index.
3c4f71cc 96
89bb3f02 97 @remarks The original bitmap or icon is not affected by the Add()
4cc4bfaf 98 operation, and can be deleted afterwards.
89bb3f02
FM
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.
0a98423e
FM
103
104 @onlyfor{wxmsw,wxmac}
23324ae1 105 */
7c913512 106 int Add(const wxIcon& icon);
23324ae1
FM
107
108 /**
109 Initializes the list. See wxImageList() for details.
110 */
4cc4bfaf 111 bool Create(int width, int height, bool mask = true,
23324ae1
FM
112 int initialCount = 1);
113
114 /**
115 Draws a specified image onto a device context.
3c4f71cc 116
7c913512 117 @param index
4cc4bfaf 118 Image index, starting from zero.
7c913512 119 @param dc
4cc4bfaf 120 Device context to draw on.
7c913512 121 @param x
4cc4bfaf 122 X position on the device context.
7c913512 123 @param y
4cc4bfaf 124 Y position on the device context.
7c913512 125 @param flags
4cc4bfaf 126 How to draw the image. A bitlist of a selection of the following:
89bb3f02
FM
127 - wxIMAGELIST_DRAW_NORMAL: Draw the image normally.
128 - wxIMAGELIST_DRAW_TRANSPARENT: Draw the image with transparency.
129 - wxIMAGELIST_DRAW_SELECTED: Draw the image in selected state.
130 - wxIMAGELIST_DRAW_FOCUSED: Draw the image in a focused state.
7c913512 131 @param solidBackground
4cc4bfaf
FM
132 For optimisation - drawing can be faster if the function is told
133 that the background is solid.
23324ae1 134 */
adaaa686
FM
135 virtual bool Draw(int index, wxDC& dc, int x, int y,
136 int flags = wxIMAGELIST_DRAW_NORMAL,
137 bool solidBackground = false);
23324ae1
FM
138
139 /**
140 Returns the bitmap corresponding to the given index.
141 */
328f5751 142 wxBitmap GetBitmap(int index) const;
23324ae1
FM
143
144 /**
145 Returns the icon corresponding to the given index.
146 */
328f5751 147 wxIcon GetIcon(int index) const;
23324ae1
FM
148
149 /**
150 Returns the number of images in the list.
151 */
adaaa686 152 virtual int GetImageCount() const;
23324ae1
FM
153
154 /**
4cc4bfaf 155 Retrieves the size of the images in the list. Currently, the @a index
23324ae1 156 parameter is ignored as all images in the list have the same size.
3c4f71cc 157
7c913512 158 @param index
4cc4bfaf 159 currently unused, should be 0
7c913512 160 @param width
4cc4bfaf 161 receives the width of the images in the list
7c913512 162 @param height
4cc4bfaf 163 receives the height of the images in the list
3c4f71cc 164
89bb3f02
FM
165 @return @true if the function succeeded, @false if it failed
166 (for example, if the image list was not yet initialized).
23324ae1 167 */
adaaa686 168 virtual bool GetSize(int index, int& width, int& height) const;
23324ae1
FM
169
170 /**
171 Removes the image at the given position.
172 */
173 bool Remove(int index);
174
175 /**
176 Removes all the images in the list.
177 */
178 bool RemoveAll();
179
23324ae1
FM
180 /**
181 Replaces the existing image with the new image.
89bb3f02 182 Windows only.
3c4f71cc 183
89bb3f02
FM
184 @param index
185 The index of the bitmap to be replaced.
7c913512 186 @param bitmap
4cc4bfaf 187 Bitmap representing the opaque areas of the image.
7c913512 188 @param mask
4cc4bfaf 189 Monochrome mask bitmap, representing the transparent areas of the image.
3c4f71cc 190
d29a9a8a 191 @return @true if the replacement was successful, @false otherwise.
3c4f71cc 192
89bb3f02 193 @remarks The original bitmap or icon is not affected by the Replace()
4cc4bfaf 194 operation, and can be deleted afterwards.
23324ae1
FM
195 */
196 bool Replace(int index, const wxBitmap& bitmap,
197 const wxBitmap& mask = wxNullBitmap);
89bb3f02
FM
198
199 /**
200 Replaces the existing image with the new image.
201
202 @param index
203 The index of the bitmap to be replaced.
204 @param icon
205 Icon to use as the image.
206
207 @return @true if the replacement was successful, @false otherwise.
208
209 @remarks The original bitmap or icon is not affected by the Replace()
210 operation, and can be deleted afterwards.
0a98423e
FM
211
212 @onlyfor{wxmsw,wxmac}
89bb3f02 213 */
7c913512 214 bool Replace(int index, const wxIcon& icon);
23324ae1 215};
e54c96f1 216