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