wxWidgets/docs/latex/wx/accel.tex

203 lines
5.8 KiB
TeX
Raw Normal View History

\section{\class{wxAcceleratorEntry}}\label{wxacceleratorentry}
An object used by an application wishing to create an \helpref{accelerator table}{wxacceleratortable}.
\wxheading{Derived from}
None
\wxheading{Include files}
<wx/accel.h>
\wxheading{See also}
\helpref{wxAcceleratorTable}{wxacceleratortable}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxAcceleratorEntry::wxAcceleratorEntry}\label{wxacceleratorentryconstr}
\func{}{wxAcceleratorEntry}{\void}
Default constructor.
\func{}{wxAcceleratorEntry}{\param{int}{ flags}, \param{int}{ keyCode}, \param{int}{ cmd}}
Constructor.
\wxheading{Parameters}
\docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
which modifier key is held down.}
\docparam{keyCode}{The keycode to be detected. See \helpref{Keycodes}{keycodes} for a full list of keycodes.}
\docparam{cmd}{The menu or control command identifier.}
\membersection{wxAcceleratorEntry::GetCommand}\label{wxacceleratorentrygetcommand}
\constfunc{int}{GetCommand}{\void}
Returns the command identifier for the accelerator table entry.
\membersection{wxAcceleratorEntry::GetFlags}\label{wxacceleratorentrygetflags}
\constfunc{int}{GetFlags}{\void}
Returns the flags for the accelerator table entry.
\membersection{wxAcceleratorEntry::GetKeyCode}\label{wxacceleratorentrygetkeycode}
\constfunc{int}{GetKeyCode}{\void}
Returns the keycode for the accelerator table entry.
\membersection{wxAcceleratorEntry::Set}\label{wxacceleratorentryset}
\func{void}{Set}{\param{int}{ flags}, \param{int}{ keyCode}, \param{int}{ cmd}}
Sets the accelerator entry parameters.
\wxheading{Parameters}
\docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
which modifier key is held down.}
\docparam{keyCode}{The keycode to be detected. See \helpref{Keycodes}{keycodes} for a full list of keycodes.}
\docparam{cmd}{The menu or control command identifier.}
\section{\class{wxAcceleratorTable}}\label{wxacceleratortable}
An accelerator table allows the application to specify a table of keyboard shortcuts for
menus or other commands. On Windows, menu or button commands are supported; on GTK,
only menu commands are supported.
The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the
initial accelerator table for a window.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/accel.h>
\wxheading{Example}
{\small%
\begin{verbatim}
wxAcceleratorEntry entries[4];
entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW);
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT);
entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
wxAcceleratorTable accel(4, entries);
frame->SetAcceleratorTable(accel);
\end{verbatim}
}
\wxheading{Remarks}
An accelerator takes precedence over normal processing and can be a convenient way to program some event handling.
For example, you can use an accelerator table to enable a dialog with a multi-line text control to
accept CTRL-Enter as meaning 'OK' (but not in GTK at present).
\wxheading{See also}
\helpref{wxAcceleratorEntry}{wxacceleratorentry}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxAcceleratorTable::wxAcceleratorTable}\label{wxacceleratortableconstr}
\func{}{wxAcceleratorTable}{\void}
Default constructor.
\func{}{wxAcceleratorTable}{\param{const wxAcceleratorTable\& }{bitmap}}
Copy constructor.
\func{}{wxAcceleratorTable}{\param{int}{ n}, \param{wxAcceleratorEntry}{ entries[]}}
Creates from an array of \helpref{wxAcceleratorEntry}{wxacceleratorentry} objects.
\func{}{wxAcceleratorTable}{\param{const wxString\&}{ resource}}
Loads the accelerator table from a Windows resource (Windows only).
\wxheading{Parameters}
\docparam{n}{Number of accelerator entries.}
\docparam{entries}{The array of entries.}
\docparam{resource}{Name of a Windows accelerator.}
\pythonnote{The wxPython constructor accepts a list of
wxAcceleratorEntry objects, or 3-tuples consisting of flags, keyCode,
and cmd values like you would construct wxAcceleratorEntry objects with.}
\membersection{wxAcceleratorTable::\destruct{wxAcceleratorTable}}
\func{}{\destruct{wxAcceleratorTable}}{\void}
Destroys the wxAcceleratorTable object.
\membersection{wxAcceleratorTable::Ok}\label{wxacceleratortableok}
\constfunc{bool}{Ok}{\void}
Returns TRUE if the accelerator table is valid.
\membersection{wxAcceleratorTable::operator $=$}
\func{wxAcceleratorTable\& }{operator $=$}{\param{const wxAcceleratorTable\& }{accel}}
Assignment operator. This operator does not copy any data, but instead
passes a pointer to the data in {\it accel} and increments a reference
counter. It is a fast operation.
\wxheading{Parameters}
\docparam{accel}{Accelerator table to assign.}
\wxheading{Return value}
Returns 'this' object.
\membersection{wxAcceleratorTable::operator $==$}
\func{bool}{operator $==$}{\param{const wxAcceleratorTable\& }{accel}}
Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).
\wxheading{Parameters}
\docparam{accel}{Accelerator table to compare with 'this'}
\wxheading{Return value}
Returns TRUE if the accelerator tables were effectively equal, FALSE otherwise.
\membersection{wxAcceleratorTable::operator $!=$}
\func{bool}{operator $!=$}{\param{const wxAcceleratorTable\& }{accel}}
Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).
\wxheading{Parameters}
\docparam{accel}{Accelerator table to compare with 'this'}
\wxheading{Return value}
Returns TRUE if the accelerator tables were unequal, FALSE otherwise.