]>
git.saurik.com Git - wxWidgets.git/blob - interface/icon.h
d520862da0d184152c15ba523ad4e48002df40e2
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxIcon class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
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
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
21 and icons). However, some platforms (such as Windows) make the distinction, so
22 a separate class is provided.
32 @ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
33 overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
35 class wxIcon
: public wxBitmap
40 Loads an icon from the specified location.
43 Specifies an array of pixel values.
45 Specifies the width of the icon.
47 Specifies the height of the icon.
49 Specifies the desired width of the icon. This
50 parameter only has an effect in Windows (32-bit) where icon resources can
52 several icons of different sizes.
54 Specifies the desired height of the icon. This
55 parameter only has an effect in Windows (32-bit) where icon resources can
57 several icons of different sizes.
59 Specifies the depth of the icon. If this is omitted, the display depth of
63 This can refer to a resource name under MS Windows, or a filename under MS
65 Its meaning is determined by the flags parameter.
67 The object describing the location of the native icon, see
70 May be one of the following:
83 Load a Windows icon file.
89 wxBITMAP_TYPE_ICO_RESOURCE
94 Load a Windows icon from the resource database.
105 Load a GIF bitmap file.
116 Load an X bitmap file.
127 Load an XPM bitmap file.
133 The validity of these flags depends on the platform and wxWidgets
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
142 @remarks The first form constructs an icon object with no data; an
143 assignment or another member function such as Create or
144 LoadFile must be called subsequently.
147 wxIcon(const wxIcon
& icon
);
148 wxIcon(void* data
, int type
, int width
, int height
,
150 wxIcon(const char bits
[], int width
, int height
,
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
);
162 See @ref overview_refcountdestruct "reference-counted object destruction" for
164 If the application omits to delete the icon explicitly, the icon will be
165 destroyed automatically by wxWidgets when the application exits.
166 Do not delete an icon that is selected into a memory device context.
171 Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
172 must have mask colour set.
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 )
181 void CopyFromBitmap(const wxBitmap
& bmp
);
184 Gets the colour depth of the icon. A value of 1 indicates a
187 int GetDepth() const;
190 Gets the height of the icon in pixels.
192 int GetHeight() const;
195 Gets the width of the icon in pixels.
199 int GetWidth() const;
202 Returns @true if icon data is present.
207 Loads an icon from a file or resource.
210 Either a filename or a Windows resource name.
211 The meaning of name is determined by the type parameter.
213 One of the following values:
226 Load a Windows icon file.
232 wxBITMAP_TYPE_ICO_RESOURCE
237 Load a Windows icon from the resource database.
248 Load a GIF bitmap file.
259 Load an X bitmap file.
270 Load an XPM bitmap file.
276 The validity of these flags depends on the platform and wxWidgets
279 @returns @true if the operation succeeded, @false otherwise.
283 bool LoadFile(const wxString
& name
, wxBitmapType type
);
286 Sets the depth member (does not affect the icon data).
291 void SetDepth(int depth
);
294 Sets the height member (does not affect the icon data).
297 Icon height in pixels.
299 void SetHeight(int height
);
302 Sets the width member (does not affect the icon data).
305 Icon width in pixels.
307 void SetWidth(int width
);
310 Assignment operator, using @ref overview_trefcount "reference counting".
315 wxIcon
operator =(const wxIcon
& icon
);