]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/accel.tex
corrected typo in the creation date
[wxWidgets.git] / docs / latex / wx / accel.tex
CommitLineData
3972fb49
JS
1\section{\class{wxAcceleratorEntry}}\label{wxacceleratorentry}
2
3An object used by an application wishing to create an \helpref{accelerator table}{wxacceleratortable}.
4
5\wxheading{Derived from}
6
7None
8
954b8ae6
JS
9\wxheading{Include files}
10
11<wx/accel.h>
12
3972fb49
JS
13\wxheading{See also}
14
15\helpref{wxAcceleratorTable}{wxacceleratortable}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
16
17\latexignore{\rtfignore{\wxheading{Members}}}
18
f510b7b2 19\membersection{wxAcceleratorEntry::wxAcceleratorEntry}\label{wxacceleratorentryctor}
3972fb49
JS
20
21\func{}{wxAcceleratorEntry}{\void}
22
23Default constructor.
24
25\func{}{wxAcceleratorEntry}{\param{int}{ flags}, \param{int}{ keyCode}, \param{int}{ cmd}}
26
27Constructor.
28
29\wxheading{Parameters}
30
446f8f2a 31\docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
3972fb49
JS
32which modifier key is held down.}
33
34\docparam{keyCode}{The keycode to be detected. See \helpref{Keycodes}{keycodes} for a full list of keycodes.}
35
36\docparam{cmd}{The menu or control command identifier.}
37
38\membersection{wxAcceleratorEntry::GetCommand}\label{wxacceleratorentrygetcommand}
39
40\constfunc{int}{GetCommand}{\void}
41
42Returns the command identifier for the accelerator table entry.
43
44\membersection{wxAcceleratorEntry::GetFlags}\label{wxacceleratorentrygetflags}
45
46\constfunc{int}{GetFlags}{\void}
47
48Returns the flags for the accelerator table entry.
49
50\membersection{wxAcceleratorEntry::GetKeyCode}\label{wxacceleratorentrygetkeycode}
51
52\constfunc{int}{GetKeyCode}{\void}
53
54Returns the keycode for the accelerator table entry.
55
56\membersection{wxAcceleratorEntry::Set}\label{wxacceleratorentryset}
57
58\func{void}{Set}{\param{int}{ flags}, \param{int}{ keyCode}, \param{int}{ cmd}}
59
60Sets the accelerator entry parameters.
61
62\wxheading{Parameters}
63
446f8f2a 64\docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
3972fb49
JS
65which modifier key is held down.}
66
67\docparam{keyCode}{The keycode to be detected. See \helpref{Keycodes}{keycodes} for a full list of keycodes.}
68
69\docparam{cmd}{The menu or control command identifier.}
70
71\section{\class{wxAcceleratorTable}}\label{wxacceleratortable}
72
73An accelerator table allows the application to specify a table of keyboard shortcuts for
7816e624 74menus or other commands. On Windows and Mac OS X, menu or button commands are supported; on GTK,
3972fb49
JS
75only menu commands are supported.
76
77The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the
78initial accelerator table for a window.
79
80\wxheading{Derived from}
81
82\helpref{wxObject}{wxobject}
83
954b8ae6
JS
84\wxheading{Include files}
85
86<wx/accel.h>
87
55ccdb93
VZ
88\wxheading{Predefined objects}
89
90Objects:
91
92{\bf wxNullAcceleratorTable}
93
3972fb49
JS
94\wxheading{Example}
95
96{\small%
97\begin{verbatim}
98 wxAcceleratorEntry entries[4];
99 entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW);
100 entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
101 entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT);
fbc89908 102 entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
3972fb49
JS
103 wxAcceleratorTable accel(4, entries);
104 frame->SetAcceleratorTable(accel);
105\end{verbatim}
0497e172 106}%
3972fb49
JS
107
108\wxheading{Remarks}
109
110An accelerator takes precedence over normal processing and can be a convenient way to program some event handling.
111For example, you can use an accelerator table to enable a dialog with a multi-line text control to
0497e172 112accept CTRL-Enter as meaning `OK' (but not in GTK+ at present).
3972fb49
JS
113
114\wxheading{See also}
115
116\helpref{wxAcceleratorEntry}{wxacceleratorentry}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
117
118\latexignore{\rtfignore{\wxheading{Members}}}
119
f510b7b2 120\membersection{wxAcceleratorTable::wxAcceleratorTable}\label{wxacceleratortablector}
3972fb49
JS
121
122\func{}{wxAcceleratorTable}{\void}
123
124Default constructor.
125
126\func{}{wxAcceleratorTable}{\param{const wxAcceleratorTable\& }{bitmap}}
127
a91225b2 128Copy constructor, uses \helpref{reference counting}{trefcount}.
3972fb49
JS
129
130\func{}{wxAcceleratorTable}{\param{int}{ n}, \param{wxAcceleratorEntry}{ entries[]}}
131
132Creates from an array of \helpref{wxAcceleratorEntry}{wxacceleratorentry} objects.
133
134\func{}{wxAcceleratorTable}{\param{const wxString\&}{ resource}}
135
136Loads the accelerator table from a Windows resource (Windows only).
137
138\wxheading{Parameters}
139
140\docparam{n}{Number of accelerator entries.}
141
142\docparam{entries}{The array of entries.}
143
144\docparam{resource}{Name of a Windows accelerator.}
145
76e1c2de
RD
146\pythonnote{The wxPython constructor accepts a list of
147wxAcceleratorEntry objects, or 3-tuples consisting of flags, keyCode,
148and cmd values like you would construct wxAcceleratorEntry objects with.}
149
f3539882 150\perlnote{The wxPerl constructor accepts a list of either
9b50920f
JS
151Wx::AcceleratorEntry objects or references to 3-element arrays
152( flags, keyCode, cmd ), like the parameters of Wx::AcceleratorEntry::new.}
f3539882 153
f510b7b2 154\membersection{wxAcceleratorTable::\destruct{wxAcceleratorTable}}\label{wxacceleratortabledtor}
3972fb49
JS
155
156\func{}{\destruct{wxAcceleratorTable}}{\void}
157
158Destroys the wxAcceleratorTable object.
55ccdb93 159See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
3972fb49 160
b7cacb43 161\membersection{wxAcceleratorTable::IsOk}\label{wxacceleratortableisok}
3972fb49 162
b7cacb43 163\constfunc{bool}{IsOk}{\void}
3972fb49 164
cc81d32f 165Returns true if the accelerator table is valid.
3972fb49 166
f510b7b2 167\membersection{wxAcceleratorTable::operator $=$}\label{wxacceleratortableassign}
3972fb49
JS
168
169\func{wxAcceleratorTable\& }{operator $=$}{\param{const wxAcceleratorTable\& }{accel}}
170
a91225b2 171Assignment operator, using \helpref{reference counting}{trefcount}.
3972fb49
JS
172
173\wxheading{Parameters}
174
175\docparam{accel}{Accelerator table to assign.}
176
177\wxheading{Return value}
178
9b50920f
JS
179Returns a reference to this object.
180