wxWidgets/docs/latex/wx/cursor.tex
Mattia Barbon 01e4ec1980 Mention wxCURSOR_BLANK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-04-03 19:17:30 +00:00

211 lines
7.8 KiB
TeX

\section{\class{wxCursor}}\label{wxcursor}
A cursor is a small bitmap usually used for denoting where the mouse
pointer is, with a picture that might indicate the interpretation of a
mouse click. As with icons, cursors in X and MS Windows are created
in a different manner. Therefore, separate cursors will be created for the
different environments. Platform-specific methods for creating a {\bf
wxCursor} object are catered for, and this is an occasion where
conditional compilation will probably be required (see \helpref{wxIcon}{wxicon} for
an example).
A single cursor object may be used in many windows (any subwindow type).
The wxWindows convention is to set the cursor for a window, as in X,
rather than to set it globally as in MS Windows, although a
global \helpref{::wxSetCursor}{wxsetcursor} is also available for MS Windows use.
\wxheading{Derived from}
\helpref{wxBitmap}{wxbitmap}\\
\helpref{wxGDIObject}{wxgdiobject}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/cursor.h>
\wxheading{Predefined objects}
Objects:
{\bf wxNullCursor}
Pointers:
{\bf wxSTANDARD\_CURSOR\\
wxHOURGLASS\_CURSOR\\
wxCROSS\_CURSOR}
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor},\rtfsp
\helpref{::wxSetCursor}{wxsetcursor}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxCursor::wxCursor}\label{wxcursorconstr}
\func{}{wxCursor}{\void}
Default constructor.
\func{}{wxCursor}{\param{const char}{ bits[]}, \param{int }{width},
\param{int }{ height}, \param{int }{hotSpotX=-1}, \param{int }{hotSpotY=-1}, \param{const char }{maskBits[]=NULL}}
Constructs a cursor by passing an array of bits (Motif and Xt only). {\it maskBits} is used only under Motif.
If either {\it hotSpotX} or {\it hotSpotY} is -1, the hotspot will be the centre of the cursor image (Motif only).
\func{}{wxCursor}{\param{const wxString\& }{cursorName}, \param{long }{type}, \param{int }{hotSpotX=0}, \param{int }{hotSpotY=0}}
Constructs a cursor by passing a string resource name or filename.
{\it hotSpotX} and {\it hotSpotY} are currently only used under Windows when loading from an
icon file, to specify the cursor hotspot relative to the top left of the image.
\func{}{wxCursor}{\param{int}{ cursorId}}
Constructs a cursor using a cursor identifier.
\func{}{wxCursor}{\param{const wxImage\&}{ image}}
Constructs a cursor from a wxImage. The cursor is monochome, colors with the RGB elements all greater
than 127 will be foreground, colors less than this background. The mask (if any) will be used as transparent.
In MSW the foreground will be white and the background black. The cursor is resized to 32x32
In GTK, the two most frequent colors will be used for foreground and background. The cursor will be displayed
at the size of the image.
\func{}{wxCursor}{\param{const wxCursor\&}{ cursor}}
Copy constructor. This uses reference counting so is a cheap operation.
\wxheading{Parameters}
\docparam{bits}{An array of bits.}
\docparam{maskBits}{Bits for a mask bitmap.}
\docparam{width}{Cursor width.}
\docparam{height}{Cursor height.}
\docparam{hotSpotX}{Hotspot x coordinate.}
\docparam{hotSpotY}{Hotspot y coordinate.}
\docparam{type}{Icon type to load. Under Motif, {\it type} defaults to {\bf wxBITMAP\_TYPE\_XBM}. Under Windows,
it defaults to {\bf wxBITMAP\_TYPE\_CUR\_RESOURCE}.
Under X, the permitted cursor types are:
\twocolwidtha{6cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.}
\end{twocollist}
Under Windows, the permitted types are:
\twocolwidtha{6cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxBITMAP\_TYPE\_CUR}}{Load a cursor from a .cur cursor file (only if USE\_RESOURCE\_LOADING\_IN\_MSW
is enabled in setup.h).}
\twocolitem{\windowstyle{wxBITMAP\_TYPE\_CUR\_RESOURCE}}{Load a Windows resource (as specified in the .rc file).}
\twocolitem{\windowstyle{wxBITMAP\_TYPE\_ICO}}{Load a cursor from a .ico icon file (only if USE\_RESOURCE\_LOADING\_IN\_MSW
is enabled in setup.h). Specify {\it hotSpotX} and {\it hotSpotY}.}
\end{twocollist}}
\docparam{cursorId}{A stock cursor identifier. May be one of:
\twocolwidtha{6cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxCURSOR\_ARROW}}{A standard arrow cursor.}
\twocolitem{{\bf wxCURSOR\_RIGHT\_ARROW}}{A standard arrow cursor
pointing to the right.}
\twocolitem{{\bf wxCURSOR\_BLANK}}{Transparent cursor.}
\twocolitem{{\bf wxCURSOR\_BULLSEYE}}{Bullseye cursor.}
\twocolitem{{\bf wxCURSOR\_CHAR}}{Rectangular character cursor.}
\twocolitem{{\bf wxCURSOR\_CROSS}}{A cross cursor.}
\twocolitem{{\bf wxCURSOR\_HAND}}{A hand cursor.}
\twocolitem{{\bf wxCURSOR\_IBEAM}}{An I-beam cursor (vertical line).}
\twocolitem{{\bf wxCURSOR\_LEFT\_BUTTON}}{Represents a mouse with the left button depressed.}
\twocolitem{{\bf wxCURSOR\_MAGNIFIER}}{A magnifier icon.}
\twocolitem{{\bf wxCURSOR\_MIDDLE\_BUTTON}}{Represents a mouse with the middle button depressed.}
\twocolitem{{\bf wxCURSOR\_NO\_ENTRY}}{A no-entry sign cursor.}
\twocolitem{{\bf wxCURSOR\_PAINT\_BRUSH}}{A paintbrush cursor.}
\twocolitem{{\bf wxCURSOR\_PENCIL}}{A pencil cursor.}
\twocolitem{{\bf wxCURSOR\_POINT\_LEFT}}{A cursor that points left.}
\twocolitem{{\bf wxCURSOR\_POINT\_RIGHT}}{A cursor that points right.}
\twocolitem{{\bf wxCURSOR\_QUESTION\_ARROW}}{An arrow and question mark.}
\twocolitem{{\bf wxCURSOR\_RIGHT\_BUTTON}}{Represents a mouse with the right button depressed.}
\twocolitem{{\bf wxCURSOR\_SIZENESW}}{A sizing cursor pointing NE-SW.}
\twocolitem{{\bf wxCURSOR\_SIZENS}}{A sizing cursor pointing N-S.}
\twocolitem{{\bf wxCURSOR\_SIZENWSE}}{A sizing cursor pointing NW-SE.}
\twocolitem{{\bf wxCURSOR\_SIZEWE}}{A sizing cursor pointing W-E.}
\twocolitem{{\bf wxCURSOR\_SIZING}}{A general sizing cursor.}
\twocolitem{{\bf wxCURSOR\_SPRAYCAN}}{A spraycan cursor.}
\twocolitem{{\bf wxCURSOR\_WAIT}}{A wait cursor.}
\twocolitem{{\bf wxCURSOR\_WATCH}}{A watch cursor.}
\twocolitem{{\bf wxCURSOR\_ARROWWAIT}}{A cursor with both an arrow and
an hourglass, (windows.)}
\end{twocollist}\twocolwidtha{5cm}
Note that not all cursors are available on all platforms.}
\docparam{cursor}{Pointer or reference to a cursor to copy.}
\pythonnote{Constructors supported by wxPython are:\par
\indented{2cm}{\begin{twocollist}
\twocolitem{{\bf wxCursor(name, flags, hotSpotX=0,
hotSpotY=0)}}{Constructs a cursor from a filename}
\twocolitem{{\bf wxStockCursor(id)}}{Constructs a stock cursor }
\end{twocollist}}
}
\perlnote{Contructors supported by wxPerl are:\par
\begin{itemize}
\item{Wx::Cursor->new( name, type, hotSpotX = 0, hotSpotY = 0 )}
\item{Wx::Cursor->new( id )}
\end{itemize}
}
\membersection{wxCursor::\destruct{wxCursor}}
\func{}{\destruct{wxCursor}}{\void}
Destroys the cursor. A cursor can be reused for more
than one window, and does not get destroyed when the window is
destroyed. wxWindows destroys all cursors on application exit, although
it is best to clean them up explicitly.
\membersection{wxCursor::Ok}\label{wxcursorok}
\constfunc{bool}{Ok}{\void}
Returns TRUE if cursor data is present.
\membersection{wxCursor::operator $=$}\label{wxcursorassignment}
\func{wxCursor\&}{operator $=$}{\param{const wxCursor\& }{cursor}}
Assignment operator, using reference counting. Returns a reference
to `this'.
\membersection{wxCursor::operator $==$}\label{wxcursorequals}
\func{bool}{operator $==$}{\param{const wxCursor\& }{cursor}}
Equality operator. Two cursors are equal if they contain pointers
to the same underlying cursor data. It does not compare each attribute,
so two independently-created cursors using the same parameters will
fail the test.
\membersection{wxCursor::operator $!=$}\label{wxcursornotequals}
\func{bool}{operator $!=$}{\param{const wxCursor\& }{cursor}}
Inequality operator. Two cursors are not equal if they contain pointers
to different underlying cursor data. It does not compare each attribute.