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