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