]> git.saurik.com Git - wxWidgets.git/blame - interface/icon.h
fixed links to global variables; fixed categories; use @see instead of @seealso
[wxWidgets.git] / interface / icon.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
3// Purpose: documentation for wxIcon class
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxIcon
11 @wxheader{icon.h}
7c913512 12
23324ae1
FM
13 An icon is a small rectangular bitmap usually used for denoting a
14 minimized application. It differs from a wxBitmap in always
15 having a mask associated with it for transparent drawing. On some platforms,
16 icons and bitmaps are implemented identically, since there is no real
17 distinction between
18 a wxBitmap with a mask and an icon; and there is no specific icon format on
19 some platforms (X-based applications usually standardize on XPMs for small
20 bitmaps
21 and icons). However, some platforms (such as Windows) make the distinction, so
22 a separate class is provided.
7c913512 23
23324ae1
FM
24 @library{wxcore}
25 @category{gdi}
7c913512 26
23324ae1
FM
27 @stdobjects
28 Objects:
29 wxNullIcon
7c913512 30
23324ae1
FM
31 @seealso
32 @ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
33 overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
34*/
35class wxIcon : public wxBitmap
36{
37public:
38 //@{
39 /**
40 Loads an icon from the specified location.
41
7c913512 42 @param bits
4cc4bfaf 43 Specifies an array of pixel values.
7c913512 44 @param width
4cc4bfaf 45 Specifies the width of the icon.
7c913512 46 @param height
4cc4bfaf 47 Specifies the height of the icon.
7c913512 48 @param desiredWidth
4cc4bfaf
FM
49 Specifies the desired width of the icon. This
50 parameter only has an effect in Windows (32-bit) where icon resources can
23324ae1 51 contain
4cc4bfaf 52 several icons of different sizes.
7c913512 53 @param desiredWidth
4cc4bfaf
FM
54 Specifies the desired height of the icon. This
55 parameter only has an effect in Windows (32-bit) where icon resources can
23324ae1 56 contain
4cc4bfaf 57 several icons of different sizes.
7c913512 58 @param depth
4cc4bfaf
FM
59 Specifies the depth of the icon. If this is omitted, the display depth of
60 the
61 screen is used.
7c913512 62 @param name
4cc4bfaf 63 This can refer to a resource name under MS Windows, or a filename under MS
23324ae1 64 Windows and X.
4cc4bfaf 65 Its meaning is determined by the flags parameter.
7c913512 66 @param loc
4cc4bfaf
FM
67 The object describing the location of the native icon, see
68 wxIconLocation.
7c913512 69 @param type
4cc4bfaf
FM
70 May be one of the following:
71
72
73
74
75
76
77
78 wxBITMAP_TYPE_ICO
79
80
81
82
83 Load a Windows icon file.
84
85
86
87
88
89 wxBITMAP_TYPE_ICO_RESOURCE
90
91
92
93
94 Load a Windows icon from the resource database.
95
96
97
98
99
100 wxBITMAP_TYPE_GIF
101
102
103
104
105 Load a GIF bitmap file.
106
107
108
109
23324ae1 110
4cc4bfaf 111 wxBITMAP_TYPE_XBM
23324ae1 112
23324ae1
FM
113
114
23324ae1 115
4cc4bfaf 116 Load an X bitmap file.
23324ae1
FM
117
118
23324ae1 119
23324ae1
FM
120
121
4cc4bfaf 122 wxBITMAP_TYPE_XPM
23324ae1 123
23324ae1
FM
124
125
23324ae1 126
4cc4bfaf 127 Load an XPM bitmap file.
23324ae1
FM
128
129
23324ae1 130
4cc4bfaf
FM
131
132
133 The validity of these flags depends on the platform and wxWidgets
134 configuration.
135 If all possible wxWidgets settings are used, the Windows platform supports
136 ICO file, ICO resource,
137 XPM data, and XPM file. Under wxGTK, the available formats are BMP file,
138 XPM data, XPM file, and PNG file.
139 Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM
140 file.
23324ae1
FM
141
142 @remarks The first form constructs an icon object with no data; an
4cc4bfaf
FM
143 assignment or another member function such as Create or
144 LoadFile must be called subsequently.
23324ae1
FM
145 */
146 wxIcon();
7c913512
FM
147 wxIcon(const wxIcon& icon);
148 wxIcon(void* data, int type, int width, int height,
149 int depth = -1);
150 wxIcon(const char bits[], int width, int height,
151 int depth = 1);
152 wxIcon(int width, int height, int depth = -1);
153 wxIcon(const char* const* bits);
154 wxIcon(const wxString& name, wxBitmapType type,
155 int desiredWidth = -1,
156 int desiredHeight = -1);
157 wxIcon(const wxIconLocation& loc);
23324ae1
FM
158 //@}
159
160 /**
161 Destructor.
162 See @ref overview_refcountdestruct "reference-counted object destruction" for
163 more info.
23324ae1
FM
164 If the application omits to delete the icon explicitly, the icon will be
165 destroyed automatically by wxWidgets when the application exits.
23324ae1
FM
166 Do not delete an icon that is selected into a memory device context.
167 */
168 ~wxIcon();
169
170 /**
4cc4bfaf 171 Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
23324ae1 172 must have mask colour set.
4cc4bfaf 173
23324ae1
FM
174 LoadFile()
175
176 Wx::Icon-new( width, height, depth = -1 )
177 Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
178 Wx::Icon-newFromBits( bits, width, height, depth = 1 )
179 Wx::Icon-newFromXPM( data )
180 */
181 void CopyFromBitmap(const wxBitmap& bmp);
182
183 /**
184 Gets the colour depth of the icon. A value of 1 indicates a
185 monochrome icon.
186 */
328f5751 187 int GetDepth() const;
23324ae1
FM
188
189 /**
190 Gets the height of the icon in pixels.
191 */
328f5751 192 int GetHeight() const;
23324ae1
FM
193
194 /**
195 Gets the width of the icon in pixels.
196
4cc4bfaf 197 @see GetHeight()
23324ae1 198 */
328f5751 199 int GetWidth() const;
23324ae1
FM
200
201 /**
202 Returns @true if icon data is present.
203 */
328f5751 204 bool IsOk() const;
23324ae1
FM
205
206 /**
207 Loads an icon from a file or resource.
208
7c913512 209 @param name
4cc4bfaf
FM
210 Either a filename or a Windows resource name.
211 The meaning of name is determined by the type parameter.
7c913512 212 @param type
4cc4bfaf
FM
213 One of the following values:
214
215
216
217
218
219
220
221 wxBITMAP_TYPE_ICO
222
223
224
225
226 Load a Windows icon file.
227
228
229
230
231
232 wxBITMAP_TYPE_ICO_RESOURCE
233
234
235
236
237 Load a Windows icon from the resource database.
238
239
240
241
242
243 wxBITMAP_TYPE_GIF
244
245
246
247
248 Load a GIF bitmap file.
249
250
251
252
253
254 wxBITMAP_TYPE_XBM
255
23324ae1
FM
256
257
23324ae1 258
4cc4bfaf 259 Load an X bitmap file.
23324ae1 260
23324ae1 261
23324ae1
FM
262
263
23324ae1 264
4cc4bfaf 265 wxBITMAP_TYPE_XPM
23324ae1
FM
266
267
23324ae1 268
23324ae1 269
4cc4bfaf 270 Load an XPM bitmap file.
23324ae1 271
23324ae1 272
23324ae1
FM
273
274
23324ae1 275
4cc4bfaf
FM
276 The validity of these flags depends on the platform and wxWidgets
277 configuration.
23324ae1
FM
278
279 @returns @true if the operation succeeded, @false otherwise.
280
4cc4bfaf 281 @see wxIcon()
23324ae1
FM
282 */
283 bool LoadFile(const wxString& name, wxBitmapType type);
284
285 /**
286 Sets the depth member (does not affect the icon data).
287
7c913512 288 @param depth
4cc4bfaf 289 Icon depth.
23324ae1
FM
290 */
291 void SetDepth(int depth);
292
293 /**
294 Sets the height member (does not affect the icon data).
295
7c913512 296 @param height
4cc4bfaf 297 Icon height in pixels.
23324ae1
FM
298 */
299 void SetHeight(int height);
300
301 /**
302 Sets the width member (does not affect the icon data).
303
7c913512 304 @param width
4cc4bfaf 305 Icon width in pixels.
23324ae1
FM
306 */
307 void SetWidth(int width);
308
309 /**
310 Assignment operator, using @ref overview_trefcount "reference counting".
311
7c913512 312 @param icon
4cc4bfaf 313 Icon to assign.
23324ae1
FM
314 */
315 wxIcon operator =(const wxIcon& icon);
316};