1998-05-20 14:25:30 +00:00
|
|
|
\section{\class{wxIcon}}\label{wxicon}
|
|
|
|
|
|
|
|
An icon is a small rectangular bitmap usually used for denoting a
|
1999-01-16 22:17:13 +00:00
|
|
|
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.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-03-01 13:06:15 +00:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxBitmap}{wxbitmap}\\
|
|
|
|
\helpref{wxGDIObject}{wxgdiobject}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/icon.h>
|
|
|
|
|
|
|
|
\wxheading{Predefined objects}
|
|
|
|
|
|
|
|
Objects:
|
|
|
|
|
|
|
|
{\bf wxNullIcon}
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\wxheading{Remarks}
|
|
|
|
|
1999-01-16 22:17:13 +00:00
|
|
|
It is usually desirable to associate a pertinent icon with a frame. Icons
|
|
|
|
can also be used for other purposes, for example with \helpref{wxTreeCtrl}{wxtreectrl}
|
|
|
|
and \helpref{wxListCtrl}{wxlistctrl}.
|
|
|
|
|
|
|
|
Icons have different formats on different platforms.
|
|
|
|
Therefore, separate icons will usually be created for the different
|
1998-05-20 14:25:30 +00:00
|
|
|
environments. Platform-specific methods for creating a {\bf wxIcon}\rtfsp
|
|
|
|
structure are catered for, and this is an occasion where conditional
|
|
|
|
compilation will probably be required.
|
|
|
|
|
|
|
|
Note that a new icon must be created for every time the icon is to be
|
1999-01-16 22:17:13 +00:00
|
|
|
used for a new window. In Windows, the icon will not be
|
1998-05-20 14:25:30 +00:00
|
|
|
reloaded if it has already been used. An icon allocated to a frame will
|
|
|
|
be deleted when the frame is deleted.
|
|
|
|
|
1999-01-16 22:17:13 +00:00
|
|
|
For more information please see \helpref{Bitmap and icon overview}{wxbitmapoverview}.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-16 22:17:13 +00:00
|
|
|
\helpref{Bitmap and icon overview}{wxbitmapoverview}, \helpref{supported bitmap file formats}{supportedbitmapformats},
|
|
|
|
\helpref{wxDC::DrawIcon}{wxdcdrawicon}, \helpref{wxCursor}{wxcursor}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxIcon::wxIcon}\label{wxiconconstr}
|
|
|
|
|
|
|
|
\func{}{wxIcon}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
\func{}{wxIcon}{\param{const wxIcon\& }{icon}}
|
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
Copy constructor.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1998-06-14 12:11:50 +00:00
|
|
|
\func{}{wxIcon}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Creates an icon from the given data, which can be of arbitrary type.
|
|
|
|
|
1998-06-14 12:11:50 +00:00
|
|
|
\func{}{wxIcon}{\param{const char}{ bits[]}, \param{int}{ width}, \param{int}{ height}\\
|
|
|
|
\param{int}{ depth = 1}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Creates an icon from an array of bits.
|
|
|
|
|
1998-06-14 12:11:50 +00:00
|
|
|
\func{}{wxIcon}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Creates a new icon.
|
|
|
|
|
|
|
|
\func{}{wxIcon}{\param{const char**}{ bits}}
|
|
|
|
|
|
|
|
Creates an icon from XPM data.
|
|
|
|
|
1998-12-23 09:58:02 +00:00
|
|
|
\func{}{wxIcon}{\param{const wxString\& }{name}, \param{long}{ type},
|
|
|
|
\param{int}{ desiredWidth = -1}, \param{int}{ desiredHeight = -1}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Loads an icon from a file or resource.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{bits}{Specifies an array of pixel values.}
|
|
|
|
|
|
|
|
\docparam{width}{Specifies the width of the icon.}
|
|
|
|
|
|
|
|
\docparam{height}{Specifies the height of the icon.}
|
|
|
|
|
1998-12-23 09:58:02 +00:00
|
|
|
\docparam{desiredWidth}{Specifies the desired width of the icon. This
|
|
|
|
parameter only has an effect in Windows (32-bit) where icon resources can contain
|
|
|
|
several icons of different sizes.}
|
|
|
|
|
|
|
|
\docparam{desiredWidth}{Specifies the desired height of the icon. This
|
|
|
|
parameter only has an effect in Windows (32-bit) where icon resources can contain
|
|
|
|
several icons of different sizes.}
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\docparam{depth}{Specifies the depth of the icon. If this is omitted, the display depth of the
|
|
|
|
screen is used.}
|
|
|
|
|
|
|
|
\docparam{name}{This can refer to a resource name under MS Windows, or a filename under MS Windows and X.
|
|
|
|
Its meaning is determined by the {\it flags} parameter.}
|
|
|
|
|
|
|
|
\docparam{type}{May be one of the following:
|
|
|
|
|
|
|
|
\twocolwidtha{5cm}
|
|
|
|
\begin{twocollist}
|
|
|
|
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_ICO}}}{Load a Windows icon file.}
|
|
|
|
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_ICO\_RESOURCE}}}{Load a Windows icon from the resource database.}
|
|
|
|
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_GIF}}}{Load a GIF bitmap file.}
|
|
|
|
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XBM}}}{Load an X bitmap file.}
|
|
|
|
\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XPM}}}{Load an XPM bitmap file.}
|
|
|
|
%\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_RESOURCE}}}{Load a Windows resource name.}
|
|
|
|
\end{twocollist}
|
|
|
|
|
|
|
|
The validity of these flags depends on the platform and wxWindows configuration.
|
1999-01-16 22:17:13 +00:00
|
|
|
If all possible wxWindows 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.}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
The first form constructs an icon object with no data; an assignment or another member function such as Create
|
|
|
|
or LoadFile must be called subsequently.
|
|
|
|
|
|
|
|
The second and third forms provide copy constructors. Note that these do not copy the
|
|
|
|
icon data, but instead a pointer to the data, keeping a reference count. They are therefore
|
|
|
|
very efficient operations.
|
|
|
|
|
|
|
|
The fourth form constructs an icon from data whose type and value depends on
|
|
|
|
the value of the {\it type} argument.
|
|
|
|
|
|
|
|
The fifth form constructs a (usually monochrome) icon from an array of pixel values, under both
|
|
|
|
X and Windows.
|
|
|
|
|
|
|
|
The sixth form constructs a new icon.
|
|
|
|
|
|
|
|
The seventh form constructs an icon from pixmap (XPM) data, if wxWindows has been configured
|
|
|
|
to incorporate this feature.
|
|
|
|
|
|
|
|
To use this constructor, you must first include an XPM file. For
|
|
|
|
example, assuming that the file {\tt mybitmap.xpm} contains an XPM array
|
|
|
|
of character pointers called mybitmap:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
#include "mybitmap.xpm"
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
wxIcon *icon = new wxIcon(mybitmap);
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-01-16 22:17:13 +00:00
|
|
|
A macro, wxICON, is available which creates an icon using an XPM
|
|
|
|
on the appropriate platform, or an icon resource on Windows.
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
wxIcon icon(wxICON(mondrian));
|
|
|
|
|
|
|
|
// Equivalent to:
|
|
|
|
|
|
|
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
|
|
|
wxIcon icon(mondrian_xpm);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__WXMSW__)
|
|
|
|
wxIcon icon("mondrian");
|
|
|
|
#endif
|
|
|
|
\end{verbatim}
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
The eighth form constructs an icon from a file or resource. {\it name} can refer
|
|
|
|
to a resource name under MS Windows, or a filename under MS Windows and X.
|
|
|
|
|
|
|
|
Under Windows, {\it type} defaults to wxBITMAP\_TYPE\_ICO\_RESOURCE.
|
1999-01-16 22:17:13 +00:00
|
|
|
Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxIcon::LoadFile}{wxiconloadfile}
|
|
|
|
|
|
|
|
\membersection{wxIcon::\destruct{wxIcon}}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxIcon}}{\void}
|
|
|
|
|
|
|
|
Destroys the wxIcon object and possibly the underlying icon data.
|
|
|
|
Because reference counting is used, the icon may not actually be
|
|
|
|
destroyed at this point - only when the reference count is zero will the
|
|
|
|
data be deleted.
|
|
|
|
|
|
|
|
If the application omits to delete the icon explicitly, the icon will be
|
|
|
|
destroyed automatically by wxWindows when the application exits.
|
|
|
|
|
|
|
|
Do not delete an icon that is selected into a memory device context.
|
|
|
|
|
|
|
|
\membersection{wxIcon::GetDepth}
|
|
|
|
|
|
|
|
\constfunc{int}{GetDepth}{\void}
|
|
|
|
|
|
|
|
Gets the colour depth of the icon. A value of 1 indicates a
|
|
|
|
monochrome icon.
|
|
|
|
|
|
|
|
\membersection{wxIcon::GetHeight}\label{wxicongetheight}
|
|
|
|
|
|
|
|
\constfunc{int}{GetHeight}{\void}
|
|
|
|
|
|
|
|
Gets the height of the icon in pixels.
|
|
|
|
|
|
|
|
\membersection{wxIcon::GetWidth}\label{wxicongetwidth}
|
|
|
|
|
|
|
|
\constfunc{int}{GetWidth}{\void}
|
|
|
|
|
|
|
|
Gets the width of the icon in pixels.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxIcon::GetHeight}{wxicongetheight}
|
|
|
|
|
|
|
|
\membersection{wxIcon::LoadFile}\label{wxiconloadfile}
|
|
|
|
|
1998-06-14 12:11:50 +00:00
|
|
|
\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Loads an icon from a file or resource.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{name}{Either a filename or a Windows resource name.
|
|
|
|
The meaning of {\it name} is determined by the {\it type} parameter.}
|
|
|
|
|
|
|
|
\docparam{type}{One of the following values:
|
|
|
|
|
|
|
|
\twocolwidtha{5cm}
|
|
|
|
\begin{twocollist}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file.}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_ICO\_RESOURCE}}{Load a Windows icon from the resource database.}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.}
|
|
|
|
\end{twocollist}
|
|
|
|
|
|
|
|
The validity of these flags depends on the platform and wxWindows configuration.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
TRUE if the operation succeeded, FALSE otherwise.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxIcon::wxIcon}{wxiconconstr}
|
|
|
|
|
|
|
|
\membersection{wxIcon::Ok}\label{wxiconok}
|
|
|
|
|
|
|
|
\constfunc{bool}{Ok}{\void}
|
|
|
|
|
|
|
|
Returns TRUE if icon data is present.
|
|
|
|
|
|
|
|
\begin{comment}
|
|
|
|
\membersection{wxIcon::SaveFile}\label{wxiconsavefile}
|
|
|
|
|
|
|
|
\func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}}
|
|
|
|
|
|
|
|
Saves an icon in the named file.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
|
|
|
|
|
|
|
|
\docparam{type}{One of the following values:
|
|
|
|
|
|
|
|
\twocolwidtha{5cm}
|
|
|
|
\begin{twocollist}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Save a Windows icon file.}
|
|
|
|
%\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF icon file.}
|
|
|
|
%\twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.}
|
|
|
|
\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.}
|
|
|
|
\end{twocollist}
|
|
|
|
|
|
|
|
The validity of these flags depends on the platform and wxWindows configuration.}
|
|
|
|
|
1999-02-09 21:22:58 +00:00
|
|
|
\docparam{palette}{An optional palette used for saving the icon.}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
TRUE if the operation succeeded, FALSE otherwise.
|
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
Depending on how wxWindows has been configured, not all formats may be available.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxIcon::LoadFile}{wxiconloadfile}
|
|
|
|
\end{comment}
|
|
|
|
|
|
|
|
\membersection{wxIcon::SetDepth}\label{wxiconsetdepth}
|
|
|
|
|
|
|
|
\func{void}{SetDepth}{\param{int }{depth}}
|
|
|
|
|
|
|
|
Sets the depth member (does not affect the icon data).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{depth}{Icon depth.}
|
|
|
|
|
|
|
|
\membersection{wxIcon::SetHeight}\label{wxiconsetheight}
|
|
|
|
|
|
|
|
\func{void}{SetHeight}{\param{int }{height}}
|
|
|
|
|
|
|
|
Sets the height member (does not affect the icon data).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{height}{Icon height in pixels.}
|
|
|
|
|
|
|
|
\membersection{wxIcon::SetOk}
|
|
|
|
|
|
|
|
\func{void}{SetOk}{\param{int }{isOk}}
|
|
|
|
|
|
|
|
Sets the validity member (does not affect the icon data).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{isOk}{Validity flag.}
|
|
|
|
|
|
|
|
\membersection{wxIcon::SetWidth}
|
|
|
|
|
|
|
|
\func{void}{SetWidth}{\param{int }{width}}
|
|
|
|
|
|
|
|
Sets the width member (does not affect the icon data).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{width}{Icon width in pixels.}
|
|
|
|
|
|
|
|
\membersection{wxIcon::operator $=$}
|
|
|
|
|
|
|
|
\func{wxIcon\& }{operator $=$}{\param{const wxIcon\& }{icon}}
|
|
|
|
|
|
|
|
Assignment operator. This operator does not copy any data, but instead
|
|
|
|
passes a pointer to the data in {\it icon} and increments a reference
|
|
|
|
counter. It is a fast operation.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{icon}{Icon to assign.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns 'this' object.
|
|
|
|
|
|
|
|
\membersection{wxIcon::operator $==$}
|
|
|
|
|
|
|
|
\func{bool}{operator $==$}{\param{const wxIcon\& }{icon}}
|
|
|
|
|
|
|
|
Equality operator. This operator tests whether the internal data pointers are
|
|
|
|
equal (a fast test).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{icon}{Icon to compare with 'this'}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns TRUE if the icons were effectively equal, FALSE otherwise.
|
|
|
|
|
|
|
|
\membersection{wxIcon::operator $!=$}
|
|
|
|
|
|
|
|
\func{bool}{operator $!=$}{\param{const wxIcon\& }{icon}}
|
|
|
|
|
|
|
|
Inequality operator. This operator tests whether the internal data pointers are
|
|
|
|
unequal (a fast test).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{icon}{Icon to compare with 'this'}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns TRUE if the icons were unequal, FALSE otherwise.
|
|
|
|
|
|
|
|
|