1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxAccelerator* classes
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 /** wxAcceleratorEntry flags */
11 enum wxAcceleratorEntryFlags
16 /** hold Alt key down */
19 /** hold Ctrl key down */
22 /** hold Shift key down */
25 /** Command key on OS X; identic to wxACCEL_CTRL on other platforms. */
31 @class wxAcceleratorEntry
34 An object used by an application wishing to create an accelerator table
35 (see wxAcceleratorTable).
40 @see wxAcceleratorTable, wxWindow::SetAcceleratorTable
42 class wxAcceleratorEntry
54 A combination of the wxAcceleratorEntryFlags values, which
55 indicates which modifier keys are held down.
57 The keycode to be detected. See @ref page_keycodes for a full list of keycodes.
59 The menu or control command identifier.
61 wxAcceleratorEntry(int flags
, int keyCode
, int cmd
);
64 Returns the command identifier for the accelerator table entry.
66 int GetCommand() const;
69 Returns the flags for the accelerator table entry.
74 Returns the keycode for the accelerator table entry.
76 int GetKeyCode() const;
79 Sets the accelerator entry parameters.
82 A combination of the wxAcceleratorEntryFlags values, which
83 indicates which modifier keys are held down.
85 The keycode to be detected. See @ref page_keycodes for a full list of keycodes.
87 The menu or control command identifier.
90 void Set(int flags
, int keyCode
, int cmd
);
95 @class wxAcceleratorTable
98 An accelerator table allows the application to specify a table of keyboard
99 shortcuts for menus or other commands. On Windows and Mac OS X, menu or button
100 commands are supported; on GTK, only menu commands are supported.
102 The object ::wxNullAcceleratorTable is defined to be a table with no data, and
103 is the initial accelerator table for a window.
108 wxAcceleratorEntry entries[4];
109 entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW);
110 entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
111 entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT);
112 entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
114 wxAcceleratorTable accel(4, entries);
115 frame->SetAcceleratorTable(accel);
119 An accelerator takes precedence over normal processing and can be a convenient
120 way to program some event handling. For example, you can use an accelerator table
121 to enable a dialog with a multi-line text control to accept CTRL-Enter as meaning
122 'OK' (but not in GTK+ at present).
128 ::wxNullAcceleratorTable
130 @see wxAcceleratorEntry, wxWindow::SetAcceleratorTable
132 class wxAcceleratorTable
: public wxObject
138 wxAcceleratorTable();
143 wxAcceleratorTable(const wxAcceleratorTable
& bitmap
);
146 Initializes the accelerator table from an array of wxAcceleratorEntry.
149 Number of accelerator entries.
151 The array of entries.
153 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[]);
156 Loads the accelerator table from a Windows resource (Windows only).
159 Name of a Windows accelerator.
161 wxAcceleratorTable(const wxString
& resource
);
164 Destroys the wxAcceleratorTable object.
165 See @ref overview_refcount_destruct for more info.
167 ~wxAcceleratorTable();
170 Returns @true if the accelerator table is valid.
175 Assignment operator, using @ref overview_refcount "reference counting".
178 Accelerator table to assign.
180 wxAcceleratorTable
operator =(const wxAcceleratorTable
& accel
);
184 // ============================================================================
185 // Global functions/macros
186 // ============================================================================
189 An empty accelerator table.
191 wxAcceleratorTable wxNullAcceleratorTable
;