1 /*
2  * Interface wrapper code.
3  *
4  * Generated by SIP 4.19.16
5  *
6  *     Copyright: (c) 2018 by Total Control Software
7  *     License:   wxWindows License
8  */
9 
10 #include "sipAPI_core.h"
11 
12         #include <wx/wrapsizer.h>
13 
14         #include <wx/sizer.h>
15         #include <wx/gdicmn.h>
16         #include <wx/window.h>
17         #include <wx/sizer.h>
18         #include <wx/gdicmn.h>
19         #include <wx/sizer.h>
20 
21         #include <wx/object.h>
22         #include <wx/object.h>
23         #include <wx/object.h>
24 
25 
26 class sipwxWrapSizer : public  ::wxWrapSizer
27 {
28 public:
29     sipwxWrapSizer(int,int);
30     virtual ~sipwxWrapSizer();
31 
32     /*
33      * There is a public method for every protected method visible from
34      * this class.
35      */
36     bool sipProtectVirt_IsSpaceItem(bool, ::wxSizerItem*) const;
37 
38     /*
39      * There is a protected method for every virtual method visible from
40      * this class.
41      */
42 protected:
43     bool IsSpaceItem( ::wxSizerItem*) const SIP_OVERRIDE;
44     void RecalcSizes() SIP_OVERRIDE;
45      ::wxSize CalcMin() SIP_OVERRIDE;
46 
47 public:
48     sipSimpleWrapper *sipPySelf;
49 
50 private:
51     sipwxWrapSizer(const sipwxWrapSizer &);
52     sipwxWrapSizer &operator = (const sipwxWrapSizer &);
53 
54     char sipPyMethods[3];
55 };
56 
sipwxWrapSizer(int orient,int flags)57 sipwxWrapSizer::sipwxWrapSizer(int orient,int flags):  ::wxWrapSizer(orient,flags), sipPySelf(SIP_NULLPTR)
58 {
59     memset(sipPyMethods, 0, sizeof (sipPyMethods));
60 }
61 
~sipwxWrapSizer()62 sipwxWrapSizer::~sipwxWrapSizer()
63 {
64     sipInstanceDestroyedEx(&sipPySelf);
65 }
66 
IsSpaceItem(::wxSizerItem * item) const67 bool sipwxWrapSizer::IsSpaceItem( ::wxSizerItem*item) const
68 {
69     sip_gilstate_t sipGILState;
70     PyObject *sipMeth;
71 
72     sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[0]),sipPySelf,SIP_NULLPTR,sipName_IsSpaceItem);
73 
74     if (!sipMeth)
75         return  ::wxWrapSizer::IsSpaceItem(item);
76 
77     extern bool sipVH__core_94(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *,  ::wxSizerItem*);
78 
79     return sipVH__core_94(sipGILState, 0, sipPySelf, sipMeth, item);
80 }
81 
RecalcSizes()82 void sipwxWrapSizer::RecalcSizes()
83 {
84     sip_gilstate_t sipGILState;
85     PyObject *sipMeth;
86 
87     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[1],sipPySelf,SIP_NULLPTR,sipName_RecalcSizes);
88 
89     if (!sipMeth)
90     {
91          ::wxWrapSizer::RecalcSizes();
92         return;
93     }
94 
95     extern void sipVH__core_45(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);
96 
97     sipVH__core_45(sipGILState, 0, sipPySelf, sipMeth);
98 }
99 
CalcMin()100  ::wxSize sipwxWrapSizer::CalcMin()
101 {
102     sip_gilstate_t sipGILState;
103     PyObject *sipMeth;
104 
105     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[2],sipPySelf,SIP_NULLPTR,sipName_CalcMin);
106 
107     if (!sipMeth)
108         return  ::wxWrapSizer::CalcMin();
109 
110     extern  ::wxSize sipVH__core_93(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);
111 
112     return sipVH__core_93(sipGILState, 0, sipPySelf, sipMeth);
113 }
114 
sipProtectVirt_IsSpaceItem(bool sipSelfWasArg,::wxSizerItem * item) const115 bool sipwxWrapSizer::sipProtectVirt_IsSpaceItem(bool sipSelfWasArg, ::wxSizerItem*item) const
116 {
117     return (sipSelfWasArg ?  ::wxWrapSizer::IsSpaceItem(item) : IsSpaceItem(item));
118 }
119 
120 
121 PyDoc_STRVAR(doc_wxWrapSizer_InformFirstDirection, "InformFirstDirection(direction, size, availableOtherDir) -> bool\n"
122 "\n"
123 "Not used by an application.");
124 
125 extern "C" {static PyObject *meth_wxWrapSizer_InformFirstDirection(PyObject *, PyObject *, PyObject *);}
meth_wxWrapSizer_InformFirstDirection(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)126 static PyObject *meth_wxWrapSizer_InformFirstDirection(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
127 {
128     PyObject *sipParseErr = SIP_NULLPTR;
129 
130     {
131         int direction;
132         int size;
133         int availableOtherDir;
134          ::wxWrapSizer *sipCpp;
135 
136         static const char *sipKwdList[] = {
137             sipName_direction,
138             sipName_size,
139             sipName_availableOtherDir,
140         };
141 
142         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biii", &sipSelf, sipType_wxWrapSizer, &sipCpp, &direction, &size, &availableOtherDir))
143         {
144             bool sipRes;
145 
146             PyErr_Clear();
147 
148             Py_BEGIN_ALLOW_THREADS
149             sipRes = sipCpp->InformFirstDirection(direction,size,availableOtherDir);
150             Py_END_ALLOW_THREADS
151 
152             if (PyErr_Occurred())
153                 return 0;
154 
155             return PyBool_FromLong(sipRes);
156         }
157     }
158 
159     /* Raise an exception if the arguments couldn't be parsed. */
160     sipNoMethod(sipParseErr, sipName_WrapSizer, sipName_InformFirstDirection, SIP_NULLPTR);
161 
162     return SIP_NULLPTR;
163 }
164 
165 
166 PyDoc_STRVAR(doc_wxWrapSizer_RecalcSizes, "RecalcSizes()\n"
167 "\n"
168 "Implements the calculation of a box sizer's dimensions and then sets\n"
169 "the size of its children (calling wxWindow::SetSize if the child is a\n"
170 "window).");
171 
172 extern "C" {static PyObject *meth_wxWrapSizer_RecalcSizes(PyObject *, PyObject *);}
meth_wxWrapSizer_RecalcSizes(PyObject * sipSelf,PyObject * sipArgs)173 static PyObject *meth_wxWrapSizer_RecalcSizes(PyObject *sipSelf, PyObject *sipArgs)
174 {
175     PyObject *sipParseErr = SIP_NULLPTR;
176     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
177 
178     {
179          ::wxWrapSizer *sipCpp;
180 
181         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxWrapSizer, &sipCpp))
182         {
183             PyErr_Clear();
184 
185             Py_BEGIN_ALLOW_THREADS
186             (sipSelfWasArg ? sipCpp-> ::wxWrapSizer::RecalcSizes() : sipCpp->RecalcSizes());
187             Py_END_ALLOW_THREADS
188 
189             if (PyErr_Occurred())
190                 return 0;
191 
192             Py_INCREF(Py_None);
193             return Py_None;
194         }
195     }
196 
197     /* Raise an exception if the arguments couldn't be parsed. */
198     sipNoMethod(sipParseErr, sipName_WrapSizer, sipName_RecalcSizes, SIP_NULLPTR);
199 
200     return SIP_NULLPTR;
201 }
202 
203 
204 PyDoc_STRVAR(doc_wxWrapSizer_CalcMin, "CalcMin() -> Size\n"
205 "\n"
206 "Implements the calculation of a box sizer's minimal.");
207 
208 extern "C" {static PyObject *meth_wxWrapSizer_CalcMin(PyObject *, PyObject *);}
meth_wxWrapSizer_CalcMin(PyObject * sipSelf,PyObject * sipArgs)209 static PyObject *meth_wxWrapSizer_CalcMin(PyObject *sipSelf, PyObject *sipArgs)
210 {
211     PyObject *sipParseErr = SIP_NULLPTR;
212     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
213 
214     {
215          ::wxWrapSizer *sipCpp;
216 
217         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxWrapSizer, &sipCpp))
218         {
219              ::wxSize*sipRes;
220 
221             PyErr_Clear();
222 
223             Py_BEGIN_ALLOW_THREADS
224             sipRes = new  ::wxSize((sipSelfWasArg ? sipCpp-> ::wxWrapSizer::CalcMin() : sipCpp->CalcMin()));
225             Py_END_ALLOW_THREADS
226 
227             if (PyErr_Occurred())
228                 return 0;
229 
230             return sipConvertFromNewType(sipRes,sipType_wxSize,SIP_NULLPTR);
231         }
232     }
233 
234     /* Raise an exception if the arguments couldn't be parsed. */
235     sipNoMethod(sipParseErr, sipName_WrapSizer, sipName_CalcMin, SIP_NULLPTR);
236 
237     return SIP_NULLPTR;
238 }
239 
240 
241 PyDoc_STRVAR(doc_wxWrapSizer_IsSpaceItem, "IsSpaceItem(item) -> bool\n"
242 "\n"
243 "Can be overridden in the derived classes to treat some normal items as\n"
244 "spacers.");
245 
246 extern "C" {static PyObject *meth_wxWrapSizer_IsSpaceItem(PyObject *, PyObject *, PyObject *);}
meth_wxWrapSizer_IsSpaceItem(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)247 static PyObject *meth_wxWrapSizer_IsSpaceItem(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
248 {
249     PyObject *sipParseErr = SIP_NULLPTR;
250     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
251 
252     {
253          ::wxSizerItem* item;
254         const sipwxWrapSizer *sipCpp;
255 
256         static const char *sipKwdList[] = {
257             sipName_item,
258         };
259 
260         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxWrapSizer, &sipCpp, sipType_wxSizerItem, &item))
261         {
262             bool sipRes;
263 
264             PyErr_Clear();
265 
266             Py_BEGIN_ALLOW_THREADS
267             sipRes = sipCpp->sipProtectVirt_IsSpaceItem(sipSelfWasArg,item);
268             Py_END_ALLOW_THREADS
269 
270             if (PyErr_Occurred())
271                 return 0;
272 
273             return PyBool_FromLong(sipRes);
274         }
275     }
276 
277     /* Raise an exception if the arguments couldn't be parsed. */
278     sipNoMethod(sipParseErr, sipName_WrapSizer, sipName_IsSpaceItem, SIP_NULLPTR);
279 
280     return SIP_NULLPTR;
281 }
282 
283 
284 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
285 extern "C" {static void *cast_wxWrapSizer(void *, const sipTypeDef *);}
cast_wxWrapSizer(void * sipCppV,const sipTypeDef * targetType)286 static void *cast_wxWrapSizer(void *sipCppV, const sipTypeDef *targetType)
287 {
288      ::wxWrapSizer *sipCpp = reinterpret_cast< ::wxWrapSizer *>(sipCppV);
289 
290     if (targetType == sipType_wxBoxSizer)
291         return static_cast< ::wxBoxSizer *>(sipCpp);
292 
293     if (targetType == sipType_wxSizer)
294         return static_cast< ::wxSizer *>(sipCpp);
295 
296     if (targetType == sipType_wxObject)
297         return static_cast< ::wxObject *>(sipCpp);
298 
299     return sipCppV;
300 }
301 
302 
303 /* Call the instance's destructor. */
304 extern "C" {static void release_wxWrapSizer(void *, int);}
release_wxWrapSizer(void * sipCppV,int sipState)305 static void release_wxWrapSizer(void *sipCppV, int sipState)
306 {
307     Py_BEGIN_ALLOW_THREADS
308 
309     if (sipState & SIP_DERIVED_CLASS)
310         delete reinterpret_cast<sipwxWrapSizer *>(sipCppV);
311     else
312         delete reinterpret_cast< ::wxWrapSizer *>(sipCppV);
313 
314     Py_END_ALLOW_THREADS
315 }
316 
317 
318 extern "C" {static void dealloc_wxWrapSizer(sipSimpleWrapper *);}
dealloc_wxWrapSizer(sipSimpleWrapper * sipSelf)319 static void dealloc_wxWrapSizer(sipSimpleWrapper *sipSelf)
320 {
321     if (sipIsDerivedClass(sipSelf))
322         reinterpret_cast<sipwxWrapSizer *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
323 
324     if (sipIsOwnedByPython(sipSelf))
325     {
326         release_wxWrapSizer(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
327     }
328 }
329 
330 
331 extern "C" {static void *init_type_wxWrapSizer(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxWrapSizer(sipSimpleWrapper * sipSelf,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)332 static void *init_type_wxWrapSizer(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
333 {
334     sipwxWrapSizer *sipCpp = SIP_NULLPTR;
335 
336     {
337         int orient = wxHORIZONTAL;
338         int flags = wxWRAPSIZER_DEFAULT_FLAGS;
339 
340         static const char *sipKwdList[] = {
341             sipName_orient,
342             sipName_flags,
343         };
344 
345         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "|ii", &orient, &flags))
346         {
347             PyErr_Clear();
348 
349             Py_BEGIN_ALLOW_THREADS
350             sipCpp = new sipwxWrapSizer(orient,flags);
351             Py_END_ALLOW_THREADS
352 
353             if (PyErr_Occurred())
354             {
355                 delete sipCpp;
356                 return SIP_NULLPTR;
357             }
358 
359             sipCpp->sipPySelf = sipSelf;
360 
361             return sipCpp;
362         }
363     }
364 
365     return SIP_NULLPTR;
366 }
367 
368 
369 /* Define this type's super-types. */
370 static sipEncodedTypeDef supers_wxWrapSizer[] = {{40, 255, 1}};
371 
372 
373 static PyMethodDef methods_wxWrapSizer[] = {
374     {SIP_MLNAME_CAST(sipName_CalcMin), meth_wxWrapSizer_CalcMin, METH_VARARGS, SIP_MLDOC_CAST(doc_wxWrapSizer_CalcMin)},
375     {SIP_MLNAME_CAST(sipName_InformFirstDirection), SIP_MLMETH_CAST(meth_wxWrapSizer_InformFirstDirection), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxWrapSizer_InformFirstDirection)},
376     {SIP_MLNAME_CAST(sipName_IsSpaceItem), SIP_MLMETH_CAST(meth_wxWrapSizer_IsSpaceItem), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxWrapSizer_IsSpaceItem)},
377     {SIP_MLNAME_CAST(sipName_RecalcSizes), meth_wxWrapSizer_RecalcSizes, METH_VARARGS, SIP_MLDOC_CAST(doc_wxWrapSizer_RecalcSizes)}
378 };
379 
380 PyDoc_STRVAR(doc_wxWrapSizer, "WrapSizer(orient=HORIZONTAL, flags=WRAPSIZER_DEFAULT_FLAGS)\n"
381 "\n"
382 "A wrap sizer lays out its items in a single line, like a box sizer  as\n"
383 "long as there is space available in that direction.");
384 
385 
386 sipClassTypeDef sipTypeDef__core_wxWrapSizer = {
387     {
388         -1,
389         SIP_NULLPTR,
390         SIP_NULLPTR,
391         SIP_TYPE_SCC|SIP_TYPE_CLASS,
392         sipNameNr_wxWrapSizer,
393         {SIP_NULLPTR},
394         SIP_NULLPTR
395     },
396     {
397         sipNameNr_WrapSizer,
398         {0, 0, 1},
399         4, methods_wxWrapSizer,
400         0, SIP_NULLPTR,
401         0, SIP_NULLPTR,
402         {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
403     },
404     doc_wxWrapSizer,
405     -1,
406     -1,
407     supers_wxWrapSizer,
408     SIP_NULLPTR,
409     init_type_wxWrapSizer,
410     SIP_NULLPTR,
411     SIP_NULLPTR,
412 #if PY_MAJOR_VERSION >= 3
413     SIP_NULLPTR,
414     SIP_NULLPTR,
415 #else
416     SIP_NULLPTR,
417     SIP_NULLPTR,
418     SIP_NULLPTR,
419     SIP_NULLPTR,
420 #endif
421     dealloc_wxWrapSizer,
422     SIP_NULLPTR,
423     SIP_NULLPTR,
424     SIP_NULLPTR,
425     release_wxWrapSizer,
426     cast_wxWrapSizer,
427     SIP_NULLPTR,
428     SIP_NULLPTR,
429     SIP_NULLPTR,
430     SIP_NULLPTR,
431     SIP_NULLPTR,
432     SIP_NULLPTR
433 };
434