]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_accel.i
better root dir for rc uploads
[wxWidgets.git] / wxPython / src / _accel.i
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
33 DocStr(wxAcceleratorEntry,
34 "A class used to define items in an `wx.AcceleratorTable`. wxPython
35 programs can choose to use wx.AcceleratorEntry objects, but using a
36 list of 3-tuple of integers (flags, keyCode, cmdID) usually works just
37 as well. See `__init__` for details of the tuple values.
38
39 :see: `wx.AcceleratorTable`", "");
40
41 class wxAcceleratorEntry {
42 public:
43 DocCtorStr(
44 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmdID = 0/*, wxMenuItem *menuitem = NULL*/),
45 "Construct a wx.AcceleratorEntry.",
46 "
47 :param flags: A bitmask of wx.ACCEL_ALT, wx.ACCEL_SHIFT,
48 wx.ACCEL_CTRL or wx.ACCEL_NORMAL used to specify
49 which modifier keys are held down.
50 :param keyCode: The keycode to be detected
51 :param cmdID: The menu or control command ID to use for the
52 accellerator event.
53 ");
54 ~wxAcceleratorEntry();
55
56 DocDeclStr(
57 void , Set(int flags, int keyCode, int cmd/*, wxMenuItem *menuItem = NULL*/),
58 "(Re)set the attributes of a wx.AcceleratorEntry.
59 :see `__init__`", "");
60
61
62 // void SetMenuItem(wxMenuItem *item);
63 // wxMenuItem *GetMenuItem() const;
64
65 DocDeclStr(
66 int , GetFlags(),
67 "Get the AcceleratorEntry's flags.", "");
68
69 DocDeclStr(
70 int , GetKeyCode(),
71 "Get the AcceleratorEntry's keycode.", "");
72
73 DocDeclStr(
74 int , GetCommand(),
75 "Get the AcceleratorEntry's command ID.", "");
76 };
77
78
79
80
81
82 DocStr(wxAcceleratorTable,
83 "An accelerator table allows the application to specify a table of
84 keyboard shortcuts for menus or other commands. On Windows, menu or
85 button commands are supported; on GTK, only menu commands are
86 supported.", "
87
88 The object ``wx.NullAcceleratorTable`` is defined to be a table with
89 no data, and is the initial accelerator table for a window.
90
91 An accelerator takes precedence over normal processing and can be a
92 convenient way to program some event handling. For example, you can
93 use an accelerator table to make a hotkey generate an event no matter
94 which window within a frame has the focus.
95
96 Foe 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
109 class wxAcceleratorTable : public wxObject {
110 public:
111 DocAStr(wxAcceleratorTable,
112 "__init__(entries) -> AcceleratorTable",
113 "Construct an AcceleratorTable from a list of `wx.AcceleratorEntry`
114 items or or of 3-tuples (flags, keyCode, cmdID)
115
116 :see: `wx.AcceleratorEntry`", "");
117 wxAcceleratorTable(int n, const wxAcceleratorEntry* entries);
118 ~wxAcceleratorTable();
119
120 bool Ok() const;
121 };
122
123
124
125 %immutable;
126 // See also wxPy_ReinitStockObjects in helpers.cpp
127 const wxAcceleratorTable wxNullAcceleratorTable;
128 %mutable;
129
130
131 wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
132
133 //---------------------------------------------------------------------------