]>
Commit | Line | Data |
---|---|---|
3972fb49 JS |
1 | \section{\class{wxAcceleratorEntry}}\label{wxacceleratorentry} |
2 | ||
3 | An object used by an application wishing to create an \helpref{accelerator table}{wxacceleratortable}. | |
4 | ||
5 | \wxheading{Derived from} | |
6 | ||
7 | None | |
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 | ||
23 | Default constructor. | |
24 | ||
25 | \func{}{wxAcceleratorEntry}{\param{int}{ flags}, \param{int}{ keyCode}, \param{int}{ cmd}} | |
26 | ||
27 | Constructor. | |
28 | ||
29 | \wxheading{Parameters} | |
30 | ||
446f8f2a | 31 | \docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates |
3972fb49 JS |
32 | which 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 | ||
42 | Returns the command identifier for the accelerator table entry. | |
43 | ||
44 | \membersection{wxAcceleratorEntry::GetFlags}\label{wxacceleratorentrygetflags} | |
45 | ||
46 | \constfunc{int}{GetFlags}{\void} | |
47 | ||
48 | Returns the flags for the accelerator table entry. | |
49 | ||
50 | \membersection{wxAcceleratorEntry::GetKeyCode}\label{wxacceleratorentrygetkeycode} | |
51 | ||
52 | \constfunc{int}{GetKeyCode}{\void} | |
53 | ||
54 | Returns 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 | ||
60 | Sets 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 |
65 | which 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 | ||
73 | An accelerator table allows the application to specify a table of keyboard shortcuts for | |
74 | menus or other commands. On Windows, menu or button commands are supported; on GTK, | |
75 | only menu commands are supported. | |
76 | ||
77 | The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the | |
78 | initial 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 | ||
3972fb49 JS |
88 | \wxheading{Example} |
89 | ||
90 | {\small% | |
91 | \begin{verbatim} | |
92 | wxAcceleratorEntry entries[4]; | |
93 | entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW); | |
94 | entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT); | |
95 | entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT); | |
fbc89908 | 96 | entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT); |
3972fb49 JS |
97 | wxAcceleratorTable accel(4, entries); |
98 | frame->SetAcceleratorTable(accel); | |
99 | \end{verbatim} | |
0497e172 | 100 | }% |
3972fb49 JS |
101 | |
102 | \wxheading{Remarks} | |
103 | ||
104 | An accelerator takes precedence over normal processing and can be a convenient way to program some event handling. | |
105 | For example, you can use an accelerator table to enable a dialog with a multi-line text control to | |
0497e172 | 106 | accept CTRL-Enter as meaning `OK' (but not in GTK+ at present). |
3972fb49 JS |
107 | |
108 | \wxheading{See also} | |
109 | ||
110 | \helpref{wxAcceleratorEntry}{wxacceleratorentry}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable} | |
111 | ||
112 | \latexignore{\rtfignore{\wxheading{Members}}} | |
113 | ||
f510b7b2 | 114 | \membersection{wxAcceleratorTable::wxAcceleratorTable}\label{wxacceleratortablector} |
3972fb49 JS |
115 | |
116 | \func{}{wxAcceleratorTable}{\void} | |
117 | ||
118 | Default constructor. | |
119 | ||
120 | \func{}{wxAcceleratorTable}{\param{const wxAcceleratorTable\& }{bitmap}} | |
121 | ||
a91225b2 | 122 | Copy constructor, uses \helpref{reference counting}{trefcount}. |
3972fb49 JS |
123 | |
124 | \func{}{wxAcceleratorTable}{\param{int}{ n}, \param{wxAcceleratorEntry}{ entries[]}} | |
125 | ||
126 | Creates from an array of \helpref{wxAcceleratorEntry}{wxacceleratorentry} objects. | |
127 | ||
128 | \func{}{wxAcceleratorTable}{\param{const wxString\&}{ resource}} | |
129 | ||
130 | Loads the accelerator table from a Windows resource (Windows only). | |
131 | ||
132 | \wxheading{Parameters} | |
133 | ||
134 | \docparam{n}{Number of accelerator entries.} | |
135 | ||
136 | \docparam{entries}{The array of entries.} | |
137 | ||
138 | \docparam{resource}{Name of a Windows accelerator.} | |
139 | ||
76e1c2de RD |
140 | \pythonnote{The wxPython constructor accepts a list of |
141 | wxAcceleratorEntry objects, or 3-tuples consisting of flags, keyCode, | |
142 | and cmd values like you would construct wxAcceleratorEntry objects with.} | |
143 | ||
f3539882 VZ |
144 | \perlnote{The wxPerl constructor accepts a list of either |
145 | Wx::AcceleratorEntry objects or references to 3-element arrays | |
146 | ( flags, keyCode, cmd ), like the parameters of Wx::AcceleratorEntry::new.} | |
147 | ||
f510b7b2 | 148 | \membersection{wxAcceleratorTable::\destruct{wxAcceleratorTable}}\label{wxacceleratortabledtor} |
3972fb49 JS |
149 | |
150 | \func{}{\destruct{wxAcceleratorTable}}{\void} | |
151 | ||
152 | Destroys the wxAcceleratorTable object. | |
153 | ||
b7cacb43 | 154 | \membersection{wxAcceleratorTable::IsOk}\label{wxacceleratortableisok} |
3972fb49 | 155 | |
b7cacb43 | 156 | \constfunc{bool}{IsOk}{\void} |
3972fb49 | 157 | |
cc81d32f | 158 | Returns true if the accelerator table is valid. |
3972fb49 | 159 | |
f510b7b2 | 160 | \membersection{wxAcceleratorTable::operator $=$}\label{wxacceleratortableassign} |
3972fb49 JS |
161 | |
162 | \func{wxAcceleratorTable\& }{operator $=$}{\param{const wxAcceleratorTable\& }{accel}} | |
163 | ||
a91225b2 | 164 | Assignment operator, using \helpref{reference counting}{trefcount}. |
3972fb49 JS |
165 | |
166 | \wxheading{Parameters} | |
167 | ||
168 | \docparam{accel}{Accelerator table to assign.} | |
169 | ||
170 | \wxheading{Return value} | |
171 | ||
8771a323 | 172 | Returns reference to this object. |
3972fb49 | 173 | |
f510b7b2 | 174 | \membersection{wxAcceleratorTable::operator $==$}\label{wxacceleratortableequal} |
3972fb49 JS |
175 | |
176 | \func{bool}{operator $==$}{\param{const wxAcceleratorTable\& }{accel}} | |
177 | ||
178 | Equality operator. This operator tests whether the internal data pointers are | |
179 | equal (a fast test). | |
180 | ||
181 | \wxheading{Parameters} | |
182 | ||
8771a323 | 183 | \docparam{accel}{Accelerator table to compare with} |
3972fb49 JS |
184 | |
185 | \wxheading{Return value} | |
186 | ||
cc81d32f | 187 | Returns true if the accelerator tables were effectively equal, false otherwise. |
3972fb49 | 188 | |
f510b7b2 | 189 | \membersection{wxAcceleratorTable::operator $!=$}\label{wxacceleratortablenotequal} |
3972fb49 JS |
190 | |
191 | \func{bool}{operator $!=$}{\param{const wxAcceleratorTable\& }{accel}} | |
192 | ||
193 | Inequality operator. This operator tests whether the internal data pointers are | |
194 | unequal (a fast test). | |
195 | ||
196 | \wxheading{Parameters} | |
197 | ||
8771a323 | 198 | \docparam{accel}{Accelerator table to compare with} |
3972fb49 JS |
199 | |
200 | \wxheading{Return value} | |
201 | ||
cc81d32f | 202 | Returns true if the accelerator tables were unequal, false otherwise. |
3972fb49 JS |
203 | |
204 |