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