]>
git.saurik.com Git - wxWidgets.git/blob - interface/icon.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxIcon
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @ingroup group_class_gdi
14 An icon is a small rectangular bitmap usually used for denoting a
15 minimized application. It differs from a wxBitmap in always
16 having a mask associated with it for transparent drawing. On some platforms,
17 icons and bitmaps are implemented identically, since there is no real
19 a wxBitmap with a mask and an icon; and there is no specific icon format on
20 some platforms (X-based applications usually standardize on XPMs for small
22 and icons). However, some platforms (such as Windows) make the distinction, so
23 a separate class is provided.
29 ::Objects:, ::wxNullIcon,
31 @see @ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
32 overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
34 class wxIcon
: public wxBitmap
39 Loads an icon from the specified location().
42 Specifies an array of pixel values.
44 Specifies the width of the icon.
46 Specifies the height of the icon.
48 Specifies the desired width of the icon. This
49 parameter only has an effect in Windows (32-bit) where icon resources can
51 several icons of different sizes.
53 Specifies the desired height of the icon. This
54 parameter only has an effect in Windows (32-bit) where icon resources can
56 several icons of different sizes.
58 Specifies the depth of the icon. If this is omitted, the display depth of
62 This can refer to a resource name under MS Windows, or a filename under MS
64 Its meaning is determined by the flags parameter.
66 The object describing the location of the native icon, see
69 May be one of the following:
82 Load a Windows icon file.
88 wxBITMAP_TYPE_ICO_RESOURCE
93 Load a Windows icon from the resource database.
104 Load a GIF bitmap file.
115 Load an X bitmap file.
126 Load an XPM bitmap file.
132 The validity of these flags depends on the platform and wxWidgets
134 If all possible wxWidgets settings are used, the Windows platform supports
135 ICO file, ICO resource,
136 XPM data, and XPM file. Under wxGTK, the available formats are BMP file,
137 XPM data, XPM file, and PNG file.
138 Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM
141 @remarks The first form constructs an icon object with no data; an
142 assignment or another member function such as Create or
143 LoadFile must be called subsequently.
146 wxIcon(const wxIcon
& icon
);
147 wxIcon(void* data
, int type
, int width
, int height
,
149 wxIcon(const char bits
[], int width
, int height
,
151 wxIcon(int width
, int height
, int depth
= -1);
152 wxIcon(const char* const* bits
);
153 wxIcon(const wxString
& name
, wxBitmapType type
,
154 int desiredWidth
= -1,
155 int desiredHeight
= -1);
156 wxIcon(const wxIconLocation
& loc
);
161 See @ref overview_refcountdestruct "reference-counted object destruction" for
163 If the application omits to delete the icon explicitly, the icon will be
164 destroyed automatically by wxWidgets when the application exits.
165 Do not delete an icon that is selected into a memory device context.
170 Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
171 must have mask colour set.
175 Wx::Icon-new( width, height, depth = -1 )
176 Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
177 Wx::Icon-newFromBits( bits, width, height, depth = 1 )
178 Wx::Icon-newFromXPM( data )
180 void CopyFromBitmap(const wxBitmap
& bmp
);
183 Gets the colour depth of the icon. A value of 1 indicates a
186 int GetDepth() const;
189 Gets the height of the icon in pixels.
191 int GetHeight() const;
194 Gets the width of the icon in pixels.
198 int GetWidth() const;
201 Returns @true if icon data is present.
206 Loads an icon from a file or resource.
209 Either a filename or a Windows resource name.
210 The meaning of name is determined by the type parameter.
212 One of the following values:
225 Load a Windows icon file.
231 wxBITMAP_TYPE_ICO_RESOURCE
236 Load a Windows icon from the resource database.
247 Load a GIF bitmap file.
258 Load an X bitmap file.
269 Load an XPM bitmap file.
275 The validity of these flags depends on the platform and wxWidgets
278 @returns @true if the operation succeeded, @false otherwise.
282 bool LoadFile(const wxString
& name
, wxBitmapType type
);
285 Sets the depth member (does not affect the icon data).
290 void SetDepth(int depth
);
293 Sets the height member (does not affect the icon data).
296 Icon height in pixels.
298 void SetHeight(int height
);
301 Sets the width member (does not affect the icon data).
304 Icon width in pixels.
306 void SetWidth(int width
);
309 Assignment operator, using @ref overview_trefcount "reference counting".
314 wxIcon
operator =(const wxIcon
& icon
);