]>
git.saurik.com Git - wxWidgets.git/blob - interface/icon.h
b7f071603db0a7218e2ddc6623bdd2828e948828
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.
46 Specifies the width of the icon.
49 Specifies the height of the icon.
52 Specifies the desired width of the icon. This
53 parameter only has an effect in Windows (32-bit) where icon resources can
55 several icons of different sizes.
58 Specifies the desired height of the icon. This
59 parameter only has an effect in Windows (32-bit) where icon resources can
61 several icons of different sizes.
64 Specifies the depth of the icon. If this is omitted, the display depth of the
68 This can refer to a resource name under MS Windows, or a filename under MS
70 Its meaning is determined by the flags parameter.
73 The object describing the location of the native icon, see
77 May be one of the following:
83 Load a Windows icon file.
85 wxBITMAP_TYPE_ICO_RESOURCE
88 Load a Windows icon from the resource database.
93 Load a GIF bitmap file.
98 Load an X bitmap file.
103 Load an XPM bitmap file.
105 The validity of these flags depends on the platform and wxWidgets configuration.
106 If all possible wxWidgets settings are used, the Windows platform supports ICO
108 XPM data, and XPM file. Under wxGTK, the available formats are BMP file, XPM
109 data, XPM file, and PNG file.
110 Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file.
112 @remarks The first form constructs an icon object with no data; an
113 assignment or another member function such as Create
114 or LoadFile must be called subsequently.
117 wxIcon(const wxIcon
& icon
);
118 wxIcon(void* data
, int type
, int width
, int height
,
120 wxIcon(const char bits
[], int width
, int height
,
122 wxIcon(int width
, int height
, int depth
= -1);
123 wxIcon(const char* const* bits
);
124 wxIcon(const wxString
& name
, wxBitmapType type
,
125 int desiredWidth
= -1,
126 int desiredHeight
= -1);
127 wxIcon(const wxIconLocation
& loc
);
132 See @ref overview_refcountdestruct "reference-counted object destruction" for
135 If the application omits to delete the icon explicitly, the icon will be
136 destroyed automatically by wxWidgets when the application exits.
138 Do not delete an icon that is selected into a memory device context.
143 Copies @e bmp bitmap to this icon. Under MS Windows the bitmap
144 must have mask colour set.
147 Wx::Icon-new( width, height, depth = -1 )
148 Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
149 Wx::Icon-newFromBits( bits, width, height, depth = 1 )
150 Wx::Icon-newFromXPM( data )
152 void CopyFromBitmap(const wxBitmap
& bmp
);
155 Gets the colour depth of the icon. A value of 1 indicates a
161 Gets the height of the icon in pixels.
166 Gets the width of the icon in pixels.
173 Returns @true if icon data is present.
175 #define bool IsOk() /* implementation is private */
178 Loads an icon from a file or resource.
181 Either a filename or a Windows resource name.
182 The meaning of name is determined by the type parameter.
185 One of the following values:
191 Load a Windows icon file.
193 wxBITMAP_TYPE_ICO_RESOURCE
196 Load a Windows icon from the resource database.
201 Load a GIF bitmap file.
206 Load an X bitmap file.
211 Load an XPM bitmap file.
213 The validity of these flags depends on the platform and wxWidgets configuration.
215 @returns @true if the operation succeeded, @false otherwise.
219 bool LoadFile(const wxString
& name
, wxBitmapType type
);
222 Sets the depth member (does not affect the icon data).
227 void SetDepth(int depth
);
230 Sets the height member (does not affect the icon data).
233 Icon height in pixels.
235 void SetHeight(int height
);
238 Sets the width member (does not affect the icon data).
241 Icon width in pixels.
243 void SetWidth(int width
);
246 Assignment operator, using @ref overview_trefcount "reference counting".
251 wxIcon
operator =(const wxIcon
& icon
);