]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/accel.tex
added copy constr
[wxWidgets.git] / docs / latex / wx / accel.tex
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
9 \wxheading{Include files}
10
11 <wx/accel.h>
12
13 \wxheading{Library}
14
15 \helpref{wxCore}{librarieslist}
16
17 \wxheading{See also}
18
19 \helpref{wxAcceleratorTable}{wxacceleratortable}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
20
21 \latexignore{\rtfignore{\wxheading{Members}}}
22
23 \membersection{wxAcceleratorEntry::wxAcceleratorEntry}\label{wxacceleratorentryctor}
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
35 \docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
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
68 \docparam{flags}{One of wxACCEL\_ALT, wxACCEL\_SHIFT, wxACCEL\_CTRL and wxACCEL\_NORMAL. Indicates
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
78 menus or other commands. On Windows and Mac OS X, menu or button commands are supported; on GTK,
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
88 \wxheading{Include files}
89
90 <wx/accel.h>
91
92 \wxheading{Library}
93
94 \helpref{wxCore}{librarieslist}
95
96 \wxheading{Predefined objects}
97
98 Objects:
99
100 {\bf wxNullAcceleratorTable}
101
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);
110 entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
111 wxAcceleratorTable accel(4, entries);
112 frame->SetAcceleratorTable(accel);
113 \end{verbatim}
114 }%
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
120 accept CTRL-Enter as meaning `OK' (but not in GTK+ at present).
121
122 \wxheading{See also}
123
124 \helpref{wxAcceleratorEntry}{wxacceleratorentry}, \helpref{wxWindow::SetAcceleratorTable}{wxwindowsetacceleratortable}
125
126 \latexignore{\rtfignore{\wxheading{Members}}}
127
128 \membersection{wxAcceleratorTable::wxAcceleratorTable}\label{wxacceleratortablector}
129
130 \func{}{wxAcceleratorTable}{\void}
131
132 Default constructor.
133
134 \func{}{wxAcceleratorTable}{\param{const wxAcceleratorTable\& }{bitmap}}
135
136 Copy constructor, uses \helpref{reference counting}{trefcount}.
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
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
158 \perlnote{The wxPerl constructor accepts a list of either
159 Wx::AcceleratorEntry objects or references to 3-element arrays
160 ( flags, keyCode, cmd ), like the parameters of Wx::AcceleratorEntry::new.}
161
162 \membersection{wxAcceleratorTable::\destruct{wxAcceleratorTable}}\label{wxacceleratortabledtor}
163
164 \func{}{\destruct{wxAcceleratorTable}}{\void}
165
166 Destroys the wxAcceleratorTable object.
167 See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
168
169 \membersection{wxAcceleratorTable::IsOk}\label{wxacceleratortableisok}
170
171 \constfunc{bool}{IsOk}{\void}
172
173 Returns true if the accelerator table is valid.
174
175 \membersection{wxAcceleratorTable::operator $=$}\label{wxacceleratortableassign}
176
177 \func{wxAcceleratorTable\& }{operator $=$}{\param{const wxAcceleratorTable\& }{accel}}
178
179 Assignment operator, using \helpref{reference counting}{trefcount}.
180
181 \wxheading{Parameters}
182
183 \docparam{accel}{Accelerator table to assign.}
184
185 \wxheading{Return value}
186
187 Returns a reference to this object.
188