2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: icon.h
|
|
|
|
// Purpose: documentation for wxIcon class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxIcon
|
|
|
|
@wxheader{icon.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
An icon is a small rectangular bitmap usually used for denoting a
|
|
|
|
minimized application. It differs from a wxBitmap in always
|
|
|
|
having a mask associated with it for transparent drawing. On some platforms,
|
|
|
|
icons and bitmaps are implemented identically, since there is no real
|
|
|
|
distinction between
|
|
|
|
a wxBitmap with a mask and an icon; and there is no specific icon format on
|
|
|
|
some platforms (X-based applications usually standardize on XPMs for small
|
|
|
|
bitmaps
|
|
|
|
and icons). However, some platforms (such as Windows) make the distinction, so
|
|
|
|
a separate class is provided.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@stdobjects
|
|
|
|
Objects:
|
|
|
|
wxNullIcon
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@seealso
|
|
|
|
@ref overview_wxbitmapoverview "Bitmap and icon overview", @ref
|
|
|
|
overview_supportedbitmapformats "supported bitmap file formats", wxDC::DrawIcon, wxCursor
|
|
|
|
*/
|
|
|
|
class wxIcon : public wxBitmap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Loads an icon from the specified location.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param bits
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies an array of pixel values.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param width
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies the width of the icon.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param height
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies the height of the icon.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param desiredWidth
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies the desired width of the icon. This
|
|
|
|
parameter only has an effect in Windows (32-bit) where icon resources can
|
2008-03-08 13:52:38 +00:00
|
|
|
contain
|
2008-03-09 12:33:59 +00:00
|
|
|
several icons of different sizes.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param desiredWidth
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies the desired height of the icon. This
|
|
|
|
parameter only has an effect in Windows (32-bit) where icon resources can
|
2008-03-08 13:52:38 +00:00
|
|
|
contain
|
2008-03-09 12:33:59 +00:00
|
|
|
several icons of different sizes.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param depth
|
2008-03-09 12:33:59 +00:00
|
|
|
Specifies the depth of the icon. If this is omitted, the display depth of
|
|
|
|
the
|
|
|
|
screen is used.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
This can refer to a resource name under MS Windows, or a filename under MS
|
2008-03-08 13:52:38 +00:00
|
|
|
Windows and X.
|
2008-03-09 12:33:59 +00:00
|
|
|
Its meaning is determined by the flags parameter.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param loc
|
2008-03-09 12:33:59 +00:00
|
|
|
The object describing the location of the native icon, see
|
|
|
|
wxIconLocation.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param type
|
2008-03-09 12:33:59 +00:00
|
|
|
May be one of the following:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_ICO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a Windows icon file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a Windows icon from the resource database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_GIF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a GIF bitmap file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxBITMAP_TYPE_XBM
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Load an X bitmap file.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxBITMAP_TYPE_XPM
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Load an XPM bitmap file.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
The validity of these flags depends on the platform and wxWidgets
|
|
|
|
configuration.
|
|
|
|
If all possible wxWidgets settings are used, the Windows platform supports
|
|
|
|
ICO file, ICO resource,
|
|
|
|
XPM data, and XPM file. Under wxGTK, the available formats are BMP file,
|
|
|
|
XPM data, XPM file, and PNG file.
|
|
|
|
Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM
|
|
|
|
file.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@remarks The first form constructs an icon object with no data; an
|
2008-03-09 12:33:59 +00:00
|
|
|
assignment or another member function such as Create or
|
|
|
|
LoadFile must be called subsequently.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxIcon();
|
2008-03-08 14:43:31 +00:00
|
|
|
wxIcon(const wxIcon& icon);
|
|
|
|
wxIcon(void* data, int type, int width, int height,
|
|
|
|
int depth = -1);
|
|
|
|
wxIcon(const char bits[], int width, int height,
|
|
|
|
int depth = 1);
|
|
|
|
wxIcon(int width, int height, int depth = -1);
|
|
|
|
wxIcon(const char* const* bits);
|
|
|
|
wxIcon(const wxString& name, wxBitmapType type,
|
|
|
|
int desiredWidth = -1,
|
|
|
|
int desiredHeight = -1);
|
|
|
|
wxIcon(const wxIconLocation& loc);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
|
|
|
more info.
|
|
|
|
If the application omits to delete the icon explicitly, the icon will be
|
|
|
|
destroyed automatically by wxWidgets when the application exits.
|
|
|
|
Do not delete an icon that is selected into a memory device context.
|
|
|
|
*/
|
|
|
|
~wxIcon();
|
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Copies @a bmp bitmap to this icon. Under MS Windows the bitmap
|
2008-03-08 13:52:38 +00:00
|
|
|
must have mask colour set.
|
2008-03-09 12:33:59 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
LoadFile()
|
|
|
|
|
|
|
|
Wx::Icon-new( width, height, depth = -1 )
|
|
|
|
Wx::Icon-new( name, type, desiredWidth = -1, desiredHeight = -1 )
|
|
|
|
Wx::Icon-newFromBits( bits, width, height, depth = 1 )
|
|
|
|
Wx::Icon-newFromXPM( data )
|
|
|
|
*/
|
|
|
|
void CopyFromBitmap(const wxBitmap& bmp);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the colour depth of the icon. A value of 1 indicates a
|
|
|
|
monochrome icon.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetDepth() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the height of the icon in pixels.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetHeight() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the width of the icon in pixels.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetHeight()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetWidth() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if icon data is present.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsOk() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Loads an icon from a file or resource.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Either a filename or a Windows resource name.
|
|
|
|
The meaning of name is determined by the type parameter.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param type
|
2008-03-09 12:33:59 +00:00
|
|
|
One of the following values:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_ICO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a Windows icon file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a Windows icon from the resource database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_GIF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load a GIF bitmap file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBITMAP_TYPE_XBM
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Load an X bitmap file.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxBITMAP_TYPE_XPM
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Load an XPM bitmap file.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
The validity of these flags depends on the platform and wxWidgets
|
|
|
|
configuration.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@returns @true if the operation succeeded, @false otherwise.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxIcon()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool LoadFile(const wxString& name, wxBitmapType type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the depth member (does not affect the icon data).
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param depth
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon depth.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetDepth(int depth);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the height member (does not affect the icon data).
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param height
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon height in pixels.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetHeight(int height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the width member (does not affect the icon data).
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param width
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon width in pixels.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetWidth(int width);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param icon
|
2008-03-09 12:33:59 +00:00
|
|
|
Icon to assign.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxIcon operator =(const wxIcon& icon);
|
|
|
|
};
|