]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/icon.h
e7187457473cdaa0ba519e519b8d5343c1eed69f
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxIcon
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 An icon is a small rectangular bitmap usually used for denoting a
13 minimized application. It differs from a wxBitmap in always
14 having a mask associated with it for transparent drawing. On some platforms,
15 icons and bitmaps are implemented identically, since there is no real
17 a wxBitmap with a mask and an icon; and there is no specific icon format on
18 some platforms (X-based applications usually standardize on XPMs for small
20 and icons). However, some platforms (such as Windows) make the distinction, so
21 a separate class is provided.
29 @see @ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
30 overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
32 class wxIcon
: public wxBitmap
37 Loads an icon from the specified location().
40 Specifies an array of pixel values.
42 Specifies the width of the icon.
44 Specifies the height of the icon.
46 Specifies the desired width of the icon. This
47 parameter only has an effect in Windows (32-bit) where icon resources can
49 several icons of different sizes.
51 Specifies the desired height of the icon. This
52 parameter only has an effect in Windows (32-bit) where icon resources can
54 several icons of different sizes.
56 Specifies the depth of the icon. If this is omitted, the display depth of
60 This can refer to a resource name under MS Windows, or a filename under MS
62 Its meaning is determined by the flags parameter.
64 The object describing the location of the native icon, see
67 May be one of the following:
80 Load a Windows icon file.
86 wxBITMAP_TYPE_ICO_RESOURCE
91 Load a Windows icon from the resource database.
102 Load a GIF bitmap file.
113 Load an X bitmap file.
124 Load an XPM bitmap file.
130 The validity of these flags depends on the platform and wxWidgets
132 If all possible wxWidgets settings are used, the Windows platform supports
133 ICO file, ICO resource,
134 XPM data, and XPM file. Under wxGTK, the available formats are BMP file,
135 XPM data, XPM file, and PNG file.
136 Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM
139 @remarks The first form constructs an icon object with no data; an
140 assignment or another member function such as Create or
141 LoadFile must be called subsequently.
144 wxIcon(const wxIcon
& icon
);
145 wxIcon(void* data
, int type
, int width
, int height
,
147 wxIcon(const char bits
[], int width
, int height
,
149 wxIcon(int width
, int height
, int depth
= -1);
150 wxIcon(const char* const* bits
);
151 wxIcon(const wxString
& name
, wxBitmapType type
,
152 int desiredWidth
= -1,
153 int desiredHeight
= -1);
154 wxIcon(const wxIconLocation
& loc
);
159 See @ref overview_refcountdestruct "reference-counted object destruction" for
161 If the application omits to delete the icon explicitly, the icon will be
162 destroyed automatically by wxWidgets when the application exits.
163 Do not delete an icon that is selected into a memory device context.
168 Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
169 must have mask colour set.
173 Wx::Icon-new( width, height, depth = -1 )
174 Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
175 Wx::Icon-newFromBits( bits, width, height, depth = 1 )
176 Wx::Icon-newFromXPM( data )
178 void CopyFromBitmap(const wxBitmap
& bmp
);
181 Gets the colour depth of the icon. A value of 1 indicates a
184 int GetDepth() const;
187 Gets the height of the icon in pixels.
189 int GetHeight() const;
192 Gets the width of the icon in pixels.
196 int GetWidth() const;
199 Returns @true if icon data is present.
204 Loads an icon from a file or resource.
207 Either a filename or a Windows resource name.
208 The meaning of name is determined by the type parameter.
210 One of the following values:
223 Load a Windows icon file.
229 wxBITMAP_TYPE_ICO_RESOURCE
234 Load a Windows icon from the resource database.
245 Load a GIF bitmap file.
256 Load an X bitmap file.
267 Load an XPM bitmap file.
273 The validity of these flags depends on the platform and wxWidgets
276 @return @true if the operation succeeded, @false otherwise.
280 bool LoadFile(const wxString
& name
, wxBitmapType type
);
283 Sets the depth member (does not affect the icon data).
288 void SetDepth(int depth
);
291 Sets the height member (does not affect the icon data).
294 Icon height in pixels.
296 void SetHeight(int height
);
299 Sets the width member (does not affect the icon data).
302 Icon width in pixels.
304 void SetWidth(int width
);
307 Assignment operator, using @ref overview_trefcount "reference counting".
312 wxIcon
operator =(const wxIcon
& icon
);