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
13typedef int wxWindowID;
14
15class wxIdManager
16{
17    %Docstring
18        wxIdManager is responsible for allocating and releasing window IDs.
19    %End
20    %TypeHeaderCode
21        #include <wx/windowid.h>
22    %End
23
24public:
25    static
26    wxWindowID ReserveId(
27        int count = 1
28    );
29    %Docstring
30        ReserveId(count=1) -> WindowID
31
32        Called directly by wxWindow::NewControlId(), this function will create
33        a new ID or range of IDs.
34    %End
35
36    static
37    void UnreserveId(
38        wxWindowID id,
39        int count = 1
40    );
41    %Docstring
42        UnreserveId(id, count=1)
43
44        Called directly by wxWindow::UnreserveControlId(), this function will
45        unreserve an ID or range of IDs that is currently reserved.
46    %End
47
48};  // end of class wxIdManager
49
50
51class wxWindowIDRef
52{
53    %Docstring
54        WindowIDRef()
55        WindowIDRef(id)
56        WindowIDRef(idref)
57
58        A wxWindowIDRef object wraps an ID value and marks it as being in-use
59        until all references to that ID are gone.
60    %End
61public:
62    wxWindowIDRef();
63
64    wxWindowIDRef(
65        int id
66    );
67
68    wxWindowIDRef(
69        const wxWindowIDRef& idref
70    );
71
72    ~wxWindowIDRef();
73
74    int GetValue();
75    %Docstring
76        GetValue() -> int
77
78        Get the ID value
79    %End
80
81    int GetId();
82    %Docstring
83        GetId() -> int
84
85        Alias for GetValue allowing the IDRef to be passed as the source
86        parameter to :meth:`wx.EvtHandler.Bind`.
87    %End
88    %MethodCode
89        PyErr_Clear();
90        Py_BEGIN_ALLOW_THREADS
91        sipRes = _wxWindowIDRef_GetId(sipCpp);
92        Py_END_ALLOW_THREADS
93        if (PyErr_Occurred()) sipIsErr = 1;
94    %End
95    %TypeCode
96    int _wxWindowIDRef_GetId(wxWindowIDRef* self)
97    {
98        return self->GetValue();
99    }
100    %End
101
102    int __int__();
103    %Docstring
104        __int__() -> int
105
106        Alias for GetValue allowing the IDRef to be passed as the WindowID
107        parameter when creating widgets or etc.
108    %End
109    %MethodCode
110        PyErr_Clear();
111        Py_BEGIN_ALLOW_THREADS
112        sipRes = _wxWindowIDRef___int__(sipCpp);
113        Py_END_ALLOW_THREADS
114        if (PyErr_Occurred()) sipIsErr = 1;
115    %End
116    %TypeCode
117    int _wxWindowIDRef___int__(wxWindowIDRef* self)
118    {
119        return self->GetValue();
120    }
121    %End
122
123    bool __eq__(wxWindowID id);
124    %Docstring
125        __eq__(id) -> bool
126    %End
127    %MethodCode
128        PyErr_Clear();
129        Py_BEGIN_ALLOW_THREADS
130        sipRes = _wxWindowIDRef___eq__(sipCpp, id);
131        Py_END_ALLOW_THREADS
132        if (PyErr_Occurred()) sipIsErr = 1;
133    %End
134    %TypeCode
135    bool _wxWindowIDRef___eq__(wxWindowIDRef* self, wxWindowID id)
136    {
137        return self->GetValue() == id;
138    }
139    %End
140
141    bool __ne__(wxWindowID id);
142    %Docstring
143        __ne__(id) -> bool
144    %End
145    %MethodCode
146        PyErr_Clear();
147        Py_BEGIN_ALLOW_THREADS
148        sipRes = _wxWindowIDRef___ne__(sipCpp, id);
149        Py_END_ALLOW_THREADS
150        if (PyErr_Occurred()) sipIsErr = 1;
151    %End
152    %TypeCode
153    bool _wxWindowIDRef___ne__(wxWindowIDRef* self, wxWindowID id)
154    {
155        return self->GetValue() != id;
156    }
157    %End
158
159    bool __lt__(wxWindowID id);
160    %Docstring
161        __lt__(id) -> bool
162    %End
163    %MethodCode
164        PyErr_Clear();
165        Py_BEGIN_ALLOW_THREADS
166        sipRes = _wxWindowIDRef___lt__(sipCpp, id);
167        Py_END_ALLOW_THREADS
168        if (PyErr_Occurred()) sipIsErr = 1;
169    %End
170    %TypeCode
171    bool _wxWindowIDRef___lt__(wxWindowIDRef* self, wxWindowID id)
172    {
173        return self->GetValue() < id;
174    }
175    %End
176
177    bool __gt__(wxWindowID id);
178    %Docstring
179        __gt__(id) -> bool
180    %End
181    %MethodCode
182        PyErr_Clear();
183        Py_BEGIN_ALLOW_THREADS
184        sipRes = _wxWindowIDRef___gt__(sipCpp, id);
185        Py_END_ALLOW_THREADS
186        if (PyErr_Occurred()) sipIsErr = 1;
187    %End
188    %TypeCode
189    bool _wxWindowIDRef___gt__(wxWindowIDRef* self, wxWindowID id)
190    {
191        return self->GetValue() > id;
192    }
193    %End
194
195    bool __le__(wxWindowID id);
196    %Docstring
197        __le__(id) -> bool
198    %End
199    %MethodCode
200        PyErr_Clear();
201        Py_BEGIN_ALLOW_THREADS
202        sipRes = _wxWindowIDRef___le__(sipCpp, id);
203        Py_END_ALLOW_THREADS
204        if (PyErr_Occurred()) sipIsErr = 1;
205    %End
206    %TypeCode
207    bool _wxWindowIDRef___le__(wxWindowIDRef* self, wxWindowID id)
208    {
209        return self->GetValue() <= id;
210    }
211    %End
212
213    bool __ge__(wxWindowID id);
214    %Docstring
215        __ge__(id) -> bool
216    %End
217    %MethodCode
218        PyErr_Clear();
219        Py_BEGIN_ALLOW_THREADS
220        sipRes = _wxWindowIDRef___ge__(sipCpp, id);
221        Py_END_ALLOW_THREADS
222        if (PyErr_Occurred()) sipIsErr = 1;
223    %End
224    %TypeCode
225    bool _wxWindowIDRef___ge__(wxWindowIDRef* self, wxWindowID id)
226    {
227        return self->GetValue() >= id;
228    }
229    %End
230
231    public:
232
233
234    %Property(name=Id, get=GetId)
235    %Property(name=Value, get=GetValue)
236};  // end of class wxWindowIDRef
237
238
239%Extract(id=pycode_core)
240def _WindowIDRef___repr__(self):
241    return "WindowIDRef: {}".format(self.GetId())
242WindowIDRef.__repr__ = _WindowIDRef___repr__
243del _WindowIDRef___repr__
244%End
245
246%Extract(id=pycode_core)
247def _WindowIDRef___hash__(self):
248    return hash(self.GetValue())
249WindowIDRef.__hash__ = _WindowIDRef___hash__
250del _WindowIDRef___hash__
251%End
252
253%Extract(id=pycode_core)
254def NewIdRef(count=1):
255    """
256    Reserves a new Window ID (or range of WindowIDs) and returns a
257    :class:`wx.WindowIDRef` object (or list of them) that will help
258    manage the reservation of that ID.
259
260    This function is intended to be a drop-in replacement of the old
261    and deprecated :func:`wx.NewId` function, with the added benefit
262    that the ID should never conflict with an in-use ID or other IDs
263    generated by this function.
264    """
265    if count == 1:
266        return WindowIDRef(IdManager.ReserveId())
267    else:
268        start = IdManager.ReserveId(count)
269        IDRefs = []
270        for id in range(start, start+count):
271            IDRefs.append(WindowIDRef(id))
272        return IDRefs
273
274%End
275
276
277//---------------------------------------------------------------------------
278
279