]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_accel.i
Added wrappers and demo for RichTextCtrl
[wxWidgets.git] / wxPython / src / _accel.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _accel.i
3// Purpose: SWIG interface for wxAcceleratorTable
4//
5// Author: Robin Dunn
6//
7// Created: 03-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
18%typemap(in) (int n, const wxAcceleratorEntry* entries) {
19 $2 = wxAcceleratorEntry_LIST_helper($input);
20 if ($2) $1 = PyList_Size($input);
21 else $1 = 0;
22}
23
24%typemap(freearg) wxAcceleratorEntry* entries {
25 delete [] $1;
26}
27
28
29
30//---------------------------------------------------------------------------
31%newgroup;
32
dce2bd22
RD
33DocStr(wxAcceleratorEntry,
34"A class used to define items in an `wx.AcceleratorTable`. wxPython
35programs can choose to use wx.AcceleratorEntry objects, but using a
36list of 3-tuple of integers (flags, keyCode, cmdID) usually works just
37as well. See `__init__` for details of the tuple values.
38
d07d2bc9 39:see: `wx.AcceleratorTable`", "");
d14a1e28
RD
40
41class wxAcceleratorEntry {
42public:
dce2bd22
RD
43 DocCtorStr(
44 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmdID = 0/*, wxMenuItem *menuitem = NULL*/),
d07d2bc9
RD
45 "Construct a wx.AcceleratorEntry.",
46 "
47 :param flags: A bitmask of wx.ACCEL_ALT, wx.ACCEL_SHIFT,
dce2bd22
RD
48 wx.ACCEL_CTRL or wx.ACCEL_NORMAL used to specify
49 which modifier keys are held down.
d07d2bc9
RD
50 :param keyCode: The keycode to be detected
51 :param cmdID: The menu or control command ID to use for the
dce2bd22
RD
52 accellerator event.
53");
d14a1e28
RD
54 ~wxAcceleratorEntry();
55
dce2bd22
RD
56 DocDeclStr(
57 void , Set(int flags, int keyCode, int cmd/*, wxMenuItem *menuItem = NULL*/),
58 "(Re)set the attributes of a wx.AcceleratorEntry.
d07d2bc9 59:see `__init__`", "");
dce2bd22
RD
60
61
62// void SetMenuItem(wxMenuItem *item);
63// wxMenuItem *GetMenuItem() const;
64
65 DocDeclStr(
66 int , GetFlags(),
d07d2bc9 67 "Get the AcceleratorEntry's flags.", "");
dce2bd22
RD
68
69 DocDeclStr(
70 int , GetKeyCode(),
d07d2bc9 71 "Get the AcceleratorEntry's keycode.", "");
dce2bd22
RD
72
73 DocDeclStr(
74 int , GetCommand(),
d07d2bc9 75 "Get the AcceleratorEntry's command ID.", "");
dce2bd22
RD
76};
77
d14a1e28 78
d14a1e28 79
d14a1e28
RD
80
81
dce2bd22
RD
82DocStr(wxAcceleratorTable,
83"An accelerator table allows the application to specify a table of
84keyboard shortcuts for menus or other commands. On Windows, menu or
85button commands are supported; on GTK, only menu commands are
d07d2bc9 86supported.", "
dce2bd22
RD
87
88The object ``wx.NullAcceleratorTable`` is defined to be a table with
89no data, and is the initial accelerator table for a window.
90
91An accelerator takes precedence over normal processing and can be a
92convenient way to program some event handling. For example, you can
93use an accelerator table to make a hotkey generate an event no matter
94which window within a frame has the focus.
95
96Foe example::
97
98 aTable = wx.AcceleratorTable([(wx.ACCEL_ALT, ord('X'), exitID),
99 (wx.ACCEL_CTRL, ord('H'), helpID),
100 (wx.ACCEL_CTRL, ord('F'), findID),
101 (wx.ACCEL_NORMAL, wx.WXK_F3, findnextID)
102 ])
103 self.SetAcceleratorTable(aTable)
104
105
106:see: `wx.AcceleratorEntry`, `wx.Window.SetAcceleratorTable`
107");
108
d14a1e28
RD
109class wxAcceleratorTable : public wxObject {
110public:
1e0c8722
RD
111 DocAStr(wxAcceleratorTable,
112 "__init__(entries) -> AcceleratorTable",
dce2bd22
RD
113 "Construct an AcceleratorTable from a list of `wx.AcceleratorEntry`
114items or or of 3-tuples (flags, keyCode, cmdID)
115
d07d2bc9 116:see: `wx.AcceleratorEntry`", "");
d14a1e28
RD
117 wxAcceleratorTable(int n, const wxAcceleratorEntry* entries);
118 ~wxAcceleratorTable();
119
120 bool Ok() const;
121};
122
dce2bd22 123
d14a1e28
RD
124
125%immutable;
d14a1e28
RD
126const wxAcceleratorTable wxNullAcceleratorTable;
127%mutable;
128
129
130wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
131
132//---------------------------------------------------------------------------