1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13enum wxAcceleratorEntryFlags
14{
15    wxACCEL_NORMAL,
16    wxACCEL_ALT,
17    wxACCEL_CTRL,
18    wxACCEL_SHIFT,
19    wxACCEL_RAW_CTRL,
20    wxACCEL_CMD
21};
22
23class wxAcceleratorEntry
24{
25    %Docstring
26        AcceleratorEntry(flags=0, keyCode=0, cmd=0, item=None)
27        AcceleratorEntry(entry)
28
29        An object used by an application wishing to create an accelerator
30        table (see wxAcceleratorTable).
31    %End
32    %TypeHeaderCode
33        #include <wx/accel.h>
34    %End
35
36public:
37    wxAcceleratorEntry(
38        int flags = 0,
39        int keyCode = 0,
40        int cmd = 0,
41        wxMenuItem * item = NULL
42    );
43
44    wxAcceleratorEntry(
45        const wxAcceleratorEntry & entry
46    );
47
48    int GetCommand() const;
49    %Docstring
50        GetCommand() -> int
51
52        Returns the command identifier for the accelerator table entry.
53    %End
54
55    int GetFlags() const;
56    %Docstring
57        GetFlags() -> int
58
59        Returns the flags for the accelerator table entry.
60    %End
61
62    int GetKeyCode() const;
63    %Docstring
64        GetKeyCode() -> int
65
66        Returns the keycode for the accelerator table entry.
67    %End
68
69    wxMenuItem * GetMenuItem() const;
70    %Docstring
71        GetMenuItem() -> MenuItem
72
73        Returns the menu item associated with this accelerator entry.
74    %End
75
76    void Set(
77        int flags,
78        int keyCode,
79        int cmd,
80        wxMenuItem * item = NULL
81    );
82    %Docstring
83        Set(flags, keyCode, cmd, item=None)
84
85        Sets the accelerator entry parameters.
86    %End
87
88    bool IsOk() const;
89    %Docstring
90        IsOk() -> bool
91
92        Returns true if this object is correctly initialized.
93    %End
94
95    wxString ToString() const;
96    %Docstring
97        ToString() -> String
98
99        Returns a textual representation of this accelerator.
100    %End
101
102    wxString ToRawString() const;
103    %Docstring
104        ToRawString() -> String
105
106        Returns a textual representation of this accelerator which is
107        appropriate for saving in configuration files.
108    %End
109
110    bool FromString(
111        const wxString & str
112    );
113    %Docstring
114        FromString(str) -> bool
115
116        Parses the given string and sets the accelerator accordingly.
117    %End
118
119    bool operator==(
120        const wxAcceleratorEntry & entry
121    ) const;
122
123    bool operator!=(
124        const wxAcceleratorEntry & entry
125    ) const;
126
127    public:
128
129
130    %Property(name=Command, get=GetCommand)
131    %Property(name=Flags, get=GetFlags)
132    %Property(name=KeyCode, get=GetKeyCode)
133    %Property(name=MenuItem, get=GetMenuItem)
134};  // end of class wxAcceleratorEntry
135
136
137class wxAcceleratorTable : wxObject
138{
139    %Docstring
140        AcceleratorTable()
141        AcceleratorTable(entries)
142
143        An accelerator table allows the application to specify a table of
144        keyboard shortcuts for menu or button commands.
145    %End
146    %TypeHeaderCode
147        #include <wx/accel.h>
148    %End
149
150public:
151    wxAcceleratorTable();
152
153    wxAcceleratorTable(PyObject* entries)   /NoDerived/;
154    %MethodCode
155        PyErr_Clear();
156        sipCpp = _wxAcceleratorTable_ctor(entries);
157    %End
158    %TypeCode
159    wxAcceleratorTable* _wxAcceleratorTable_ctor(PyObject* entries)
160    {
161        const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects.";
162        if (!PySequence_Check(entries)) {
163            PyErr_SetString(PyExc_TypeError, errmsg);
164            return NULL;
165        }
166        int count = PySequence_Size(entries);
167        wxAcceleratorEntry* tmpEntries = new wxAcceleratorEntry[count];
168        if (! tmpEntries) {
169            PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array");
170            return NULL;
171        }
172        int idx;
173        for (idx=0; idx<count; idx++) {
174            PyObject* obj = PySequence_ITEM(entries, idx);
175            if (sipCanConvertToType(obj, sipType_wxAcceleratorEntry, SIP_NO_CONVERTORS)) {
176                int err = 0;
177                wxAcceleratorEntry* entryPtr = reinterpret_cast<wxAcceleratorEntry*>(
178                    sipConvertToType(obj, sipType_wxAcceleratorEntry, NULL, 0, 0, &err));
179                tmpEntries[idx] = *entryPtr;
180            }
181            else if (PySequence_Check(obj) && PySequence_Size(obj) == 3) {
182                PyObject* o1 = PySequence_ITEM(obj, 0);
183                PyObject* o2 = PySequence_ITEM(obj, 1);
184                PyObject* o3 = PySequence_ITEM(obj, 2);
185                tmpEntries[idx].Set(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
186                Py_DECREF(o1);
187                Py_DECREF(o2);
188                Py_DECREF(o3);
189            }
190            else {
191                PyErr_SetString(PyExc_TypeError, errmsg);
192                return NULL;
193            }
194            Py_DECREF(obj);
195        }
196
197        wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries);
198        delete [] tmpEntries;
199        return table;
200    }
201    %End
202
203    ~wxAcceleratorTable();
204
205    bool IsOk() const;
206    %Docstring
207        IsOk() -> bool
208
209        Returns true if the accelerator table is valid.
210    %End
211
212};  // end of class wxAcceleratorTable
213
214
215wxAcceleratorTable wxNullAcceleratorTable;
216
217%Extract(id=pycode_core)
218@wx.deprecated
219def GetAccelFromString(label):
220    accel = wx.AcceleratorEntry()
221    accel.FromString(label)
222    return accel
223
224%End
225
226
227//---------------------------------------------------------------------------
228
229