]>
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 /////////////////////////////////////////////////////////////////////////////
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.
28 ::Objects:, ::wxNullIcon,
30 @see @ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
31 overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
33 class wxIcon
: public wxBitmap
38 Loads an icon from the specified location().
41 Specifies an array of pixel values.
43 Specifies the width of the icon.
45 Specifies the height of the icon.
47 Specifies the desired width of the icon. This
48 parameter only has an effect in Windows (32-bit) where icon resources can
50 several icons of different sizes.
52 Specifies the desired height of the icon. This
53 parameter only has an effect in Windows (32-bit) where icon resources can
55 several icons of different sizes.
57 Specifies the depth of the icon. If this is omitted, the display depth of
61 This can refer to a resource name under MS Windows, or a filename under MS
63 Its meaning is determined by the flags parameter.
65 The object describing the location of the native icon, see
68 May be one of the following:
81 Load a Windows icon file.
87 wxBITMAP_TYPE_ICO_RESOURCE
92 Load a Windows icon from the resource database.
103 Load a GIF bitmap file.
114 Load an X bitmap file.
125 Load an XPM bitmap file.
131 The validity of these flags depends on the platform and wxWidgets
133 If all possible wxWidgets settings are used, the Windows platform supports
134 ICO file, ICO resource,
135 XPM data, and XPM file. Under wxGTK, the available formats are BMP file,
136 XPM data, XPM file, and PNG file.
137 Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM
140 @remarks The first form constructs an icon object with no data; an
141 assignment or another member function such as Create or
142 LoadFile must be called subsequently.
145 wxIcon(const wxIcon
& icon
);
146 wxIcon(void* data
, int type
, int width
, int height
,
148 wxIcon(const char bits
[], int width
, int height
,
150 wxIcon(int width
, int height
, int depth
= -1);
151 wxIcon(const char* const* bits
);
152 wxIcon(const wxString
& name
, wxBitmapType type
,
153 int desiredWidth
= -1,
154 int desiredHeight
= -1);
155 wxIcon(const wxIconLocation
& loc
);
160 See @ref overview_refcountdestruct "reference-counted object destruction" for
162 If the application omits to delete the icon explicitly, the icon will be
163 destroyed automatically by wxWidgets when the application exits.
164 Do not delete an icon that is selected into a memory device context.
169 Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
170 must have mask colour set.
174 Wx::Icon-new( width, height, depth = -1 )
175 Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
176 Wx::Icon-newFromBits( bits, width, height, depth = 1 )
177 Wx::Icon-newFromXPM( data )
179 void CopyFromBitmap(const wxBitmap
& bmp
);
182 Gets the colour depth of the icon. A value of 1 indicates a
185 int GetDepth() const;
188 Gets the height of the icon in pixels.
190 int GetHeight() const;
193 Gets the width of the icon in pixels.
197 int GetWidth() const;
200 Returns @true if icon data is present.
205 Loads an icon from a file or resource.
208 Either a filename or a Windows resource name.
209 The meaning of name is determined by the type parameter.
211 One of the following values:
224 Load a Windows icon file.
230 wxBITMAP_TYPE_ICO_RESOURCE
235 Load a Windows icon from the resource database.
246 Load a GIF bitmap file.
257 Load an X bitmap file.
268 Load an XPM bitmap file.
274 The validity of these flags depends on the platform and wxWidgets
277 @returns @true if the operation succeeded, @false otherwise.
281 bool LoadFile(const wxString
& name
, wxBitmapType type
);
284 Sets the depth member (does not affect the icon data).
289 void SetDepth(int depth
);
292 Sets the height member (does not affect the icon data).
295 Icon height in pixels.
297 void SetHeight(int height
);
300 Sets the width member (does not affect the icon data).
303 Icon width in pixels.
305 void SetWidth(int width
);
308 Assignment operator, using @ref overview_trefcount "reference counting".
313 wxIcon
operator =(const wxIcon
& icon
);