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/region.h>
13
14 #include <wx/gdicmn.h>
15 #include <wx/gdicmn.h>
16 #include <wx/bitmap.h>
17 #include <wx/colour.h>
18 #include <wx/object.h>
19 #include <wx/object.h>
20 #include <wx/object.h>
21 // Convert a Python sequence of wxPoint objects, or items that can be converted
22 // to wxPoint into a C array of wxPoint instances.
23 static
wxPoint_array_helper(PyObject * source,size_t * count)24 wxPoint* wxPoint_array_helper(PyObject* source, size_t *count)
25 {
26 wxPoint* array;
27 Py_ssize_t idx, len;
28 wxPyThreadBlocker blocker;
29
30 // ensure that it is a sequence
31 if (! PySequence_Check(source))
32 goto error0;
33 // ensure it is not a string or unicode object (they are sequences too)
34 else if (PyBytes_Check(source) || PyUnicode_Check(source))
35 goto error0;
36 // ensure each item can be converted to wxPoint
37 else {
38 len = PySequence_Length(source);
39 for (idx=0; idx<len; idx++) {
40 PyObject* item = PySequence_ITEM(source, idx);
41 if (!sipCanConvertToType(item, sipType_wxPoint, SIP_NOT_NONE)) {
42 Py_DECREF(item);
43 goto error0;
44 }
45 Py_DECREF(item);
46 }
47 }
48
49 // The length of the sequence is returned in count.
50 *count = len;
51 array = new wxPoint[*count];
52 if (!array) {
53 PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array");
54 return NULL;
55 }
56 for (idx=0; idx<len; idx++) {
57 PyObject* obj = PySequence_ITEM(source, idx);
58 int state = 0;
59 int err = 0;
60 wxPoint* item = reinterpret_cast<wxPoint*>(
61 sipConvertToType(obj, sipType_wxPoint, NULL, 0, &state, &err));
62 array[idx] = *item;
63 sipReleaseType((void*)item, sipType_wxPoint, state); // delete temporary instances
64 Py_DECREF(obj);
65 }
66 return array;
67
68 error0:
69 PyErr_SetString(PyExc_TypeError, "Expected a sequence of length-2 sequences or wx.Point objects.");
70 return NULL;
71 }
72
73
74 PyDoc_STRVAR(doc_wxRegion_GetBox, "GetBox() -> Rect\n"
75 "\n"
76 "Returns the outer bounds of the region.");
77
78 extern "C" {static PyObject *meth_wxRegion_GetBox(PyObject *, PyObject *);}
meth_wxRegion_GetBox(PyObject * sipSelf,PyObject * sipArgs)79 static PyObject *meth_wxRegion_GetBox(PyObject *sipSelf, PyObject *sipArgs)
80 {
81 PyObject *sipParseErr = SIP_NULLPTR;
82
83 {
84 const ::wxRegion *sipCpp;
85
86 if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxRegion, &sipCpp))
87 {
88 ::wxRect*sipRes;
89
90 PyErr_Clear();
91
92 Py_BEGIN_ALLOW_THREADS
93 sipRes = new ::wxRect(sipCpp->GetBox());
94 Py_END_ALLOW_THREADS
95
96 if (PyErr_Occurred())
97 return 0;
98
99 return sipConvertFromNewType(sipRes,sipType_wxRect,SIP_NULLPTR);
100 }
101 }
102
103 /* Raise an exception if the arguments couldn't be parsed. */
104 sipNoMethod(sipParseErr, sipName_Region, sipName_GetBox, SIP_NULLPTR);
105
106 return SIP_NULLPTR;
107 }
108
109
110 PyDoc_STRVAR(doc_wxRegion_Offset, "Offset(x, y) -> bool\n"
111 "Offset(pt) -> bool\n"
112 "\n"
113 "Moves the region by the specified offsets in horizontal and vertical\n"
114 "directions.\n"
115 "");
116
117 extern "C" {static PyObject *meth_wxRegion_Offset(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Offset(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)118 static PyObject *meth_wxRegion_Offset(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
119 {
120 PyObject *sipParseErr = SIP_NULLPTR;
121
122 {
123 ::wxCoord x;
124 ::wxCoord y;
125 ::wxRegion *sipCpp;
126
127 static const char *sipKwdList[] = {
128 sipName_x,
129 sipName_y,
130 };
131
132 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y))
133 {
134 bool sipRes;
135
136 PyErr_Clear();
137
138 Py_BEGIN_ALLOW_THREADS
139 sipRes = sipCpp->Offset(x,y);
140 Py_END_ALLOW_THREADS
141
142 if (PyErr_Occurred())
143 return 0;
144
145 return PyBool_FromLong(sipRes);
146 }
147 }
148
149 {
150 const ::wxPoint* pt;
151 int ptState = 0;
152 ::wxRegion *sipCpp;
153
154 static const char *sipKwdList[] = {
155 sipName_pt,
156 };
157
158 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxPoint, &pt, &ptState))
159 {
160 bool sipRes;
161
162 PyErr_Clear();
163
164 Py_BEGIN_ALLOW_THREADS
165 sipRes = sipCpp->Offset(*pt);
166 Py_END_ALLOW_THREADS
167 sipReleaseType(const_cast< ::wxPoint *>(pt),sipType_wxPoint,ptState);
168
169 if (PyErr_Occurred())
170 return 0;
171
172 return PyBool_FromLong(sipRes);
173 }
174 }
175
176 /* Raise an exception if the arguments couldn't be parsed. */
177 sipNoMethod(sipParseErr, sipName_Region, sipName_Offset, SIP_NULLPTR);
178
179 return SIP_NULLPTR;
180 }
181
182
183 PyDoc_STRVAR(doc_wxRegion_Clear, "Clear()\n"
184 "\n"
185 "Clears the current region.");
186
187 extern "C" {static PyObject *meth_wxRegion_Clear(PyObject *, PyObject *);}
meth_wxRegion_Clear(PyObject * sipSelf,PyObject * sipArgs)188 static PyObject *meth_wxRegion_Clear(PyObject *sipSelf, PyObject *sipArgs)
189 {
190 PyObject *sipParseErr = SIP_NULLPTR;
191
192 {
193 ::wxRegion *sipCpp;
194
195 if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxRegion, &sipCpp))
196 {
197 PyErr_Clear();
198
199 Py_BEGIN_ALLOW_THREADS
200 sipCpp->Clear();
201 Py_END_ALLOW_THREADS
202
203 if (PyErr_Occurred())
204 return 0;
205
206 Py_INCREF(Py_None);
207 return Py_None;
208 }
209 }
210
211 /* Raise an exception if the arguments couldn't be parsed. */
212 sipNoMethod(sipParseErr, sipName_Region, sipName_Clear, SIP_NULLPTR);
213
214 return SIP_NULLPTR;
215 }
216
217
218 PyDoc_STRVAR(doc_wxRegion_Contains, "Contains(x, y) -> RegionContain\n"
219 "Contains(pt) -> RegionContain\n"
220 "Contains(x, y, width, height) -> RegionContain\n"
221 "Contains(rect) -> RegionContain\n"
222 "\n"
223 "Returns a value indicating whether the given point is contained within\n"
224 "the region.\n"
225 "\n"
226 "\n"
227 "");
228
229 extern "C" {static PyObject *meth_wxRegion_Contains(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Contains(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)230 static PyObject *meth_wxRegion_Contains(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
231 {
232 PyObject *sipParseErr = SIP_NULLPTR;
233
234 {
235 ::wxCoord x;
236 ::wxCoord y;
237 const ::wxRegion *sipCpp;
238
239 static const char *sipKwdList[] = {
240 sipName_x,
241 sipName_y,
242 };
243
244 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y))
245 {
246 ::wxRegionContain sipRes;
247
248 PyErr_Clear();
249
250 Py_BEGIN_ALLOW_THREADS
251 sipRes = sipCpp->Contains(x,y);
252 Py_END_ALLOW_THREADS
253
254 if (PyErr_Occurred())
255 return 0;
256
257 return sipConvertFromEnum(static_cast<int>(sipRes), sipType_wxRegionContain);
258 }
259 }
260
261 {
262 const ::wxPoint* pt;
263 int ptState = 0;
264 const ::wxRegion *sipCpp;
265
266 static const char *sipKwdList[] = {
267 sipName_pt,
268 };
269
270 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxPoint, &pt, &ptState))
271 {
272 ::wxRegionContain sipRes;
273
274 PyErr_Clear();
275
276 Py_BEGIN_ALLOW_THREADS
277 sipRes = sipCpp->Contains(*pt);
278 Py_END_ALLOW_THREADS
279 sipReleaseType(const_cast< ::wxPoint *>(pt),sipType_wxPoint,ptState);
280
281 if (PyErr_Occurred())
282 return 0;
283
284 return sipConvertFromEnum(static_cast<int>(sipRes), sipType_wxRegionContain);
285 }
286 }
287
288 {
289 ::wxCoord x;
290 ::wxCoord y;
291 ::wxCoord width;
292 ::wxCoord height;
293 const ::wxRegion *sipCpp;
294
295 static const char *sipKwdList[] = {
296 sipName_x,
297 sipName_y,
298 sipName_width,
299 sipName_height,
300 };
301
302 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biiii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y, &width, &height))
303 {
304 ::wxRegionContain sipRes;
305
306 PyErr_Clear();
307
308 Py_BEGIN_ALLOW_THREADS
309 sipRes = sipCpp->Contains(x,y,width,height);
310 Py_END_ALLOW_THREADS
311
312 if (PyErr_Occurred())
313 return 0;
314
315 return sipConvertFromEnum(static_cast<int>(sipRes), sipType_wxRegionContain);
316 }
317 }
318
319 {
320 const ::wxRect* rect;
321 int rectState = 0;
322 const ::wxRegion *sipCpp;
323
324 static const char *sipKwdList[] = {
325 sipName_rect,
326 };
327
328 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRect, &rect, &rectState))
329 {
330 ::wxRegionContain sipRes;
331
332 PyErr_Clear();
333
334 Py_BEGIN_ALLOW_THREADS
335 sipRes = sipCpp->Contains(*rect);
336 Py_END_ALLOW_THREADS
337 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
338
339 if (PyErr_Occurred())
340 return 0;
341
342 return sipConvertFromEnum(static_cast<int>(sipRes), sipType_wxRegionContain);
343 }
344 }
345
346 /* Raise an exception if the arguments couldn't be parsed. */
347 sipNoMethod(sipParseErr, sipName_Region, sipName_Contains, SIP_NULLPTR);
348
349 return SIP_NULLPTR;
350 }
351
352
353 PyDoc_STRVAR(doc_wxRegion_ConvertToBitmap, "ConvertToBitmap() -> Bitmap\n"
354 "\n"
355 "Convert the region to a black and white bitmap with the white pixels\n"
356 "being inside the region.");
357
358 extern "C" {static PyObject *meth_wxRegion_ConvertToBitmap(PyObject *, PyObject *);}
meth_wxRegion_ConvertToBitmap(PyObject * sipSelf,PyObject * sipArgs)359 static PyObject *meth_wxRegion_ConvertToBitmap(PyObject *sipSelf, PyObject *sipArgs)
360 {
361 PyObject *sipParseErr = SIP_NULLPTR;
362
363 {
364 const ::wxRegion *sipCpp;
365
366 if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxRegion, &sipCpp))
367 {
368 ::wxBitmap*sipRes;
369
370 PyErr_Clear();
371
372 Py_BEGIN_ALLOW_THREADS
373 sipRes = new ::wxBitmap(sipCpp->ConvertToBitmap());
374 Py_END_ALLOW_THREADS
375
376 if (PyErr_Occurred())
377 return 0;
378
379 return sipConvertFromNewType(sipRes,sipType_wxBitmap,SIP_NULLPTR);
380 }
381 }
382
383 /* Raise an exception if the arguments couldn't be parsed. */
384 sipNoMethod(sipParseErr, sipName_Region, sipName_ConvertToBitmap, SIP_NULLPTR);
385
386 return SIP_NULLPTR;
387 }
388
389
390 PyDoc_STRVAR(doc_wxRegion_Intersect, "Intersect(x, y, width, height) -> bool\n"
391 "Intersect(rect) -> bool\n"
392 "Intersect(region) -> bool\n"
393 "\n"
394 "Finds the intersection of this region and another, rectangular region,\n"
395 "specified using position and size.\n"
396 "\n"
397 "");
398
399 extern "C" {static PyObject *meth_wxRegion_Intersect(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Intersect(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)400 static PyObject *meth_wxRegion_Intersect(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
401 {
402 PyObject *sipParseErr = SIP_NULLPTR;
403
404 {
405 ::wxCoord x;
406 ::wxCoord y;
407 ::wxCoord width;
408 ::wxCoord height;
409 ::wxRegion *sipCpp;
410
411 static const char *sipKwdList[] = {
412 sipName_x,
413 sipName_y,
414 sipName_width,
415 sipName_height,
416 };
417
418 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biiii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y, &width, &height))
419 {
420 bool sipRes;
421
422 PyErr_Clear();
423
424 Py_BEGIN_ALLOW_THREADS
425 sipRes = sipCpp->Intersect(x,y,width,height);
426 Py_END_ALLOW_THREADS
427
428 if (PyErr_Occurred())
429 return 0;
430
431 return PyBool_FromLong(sipRes);
432 }
433 }
434
435 {
436 const ::wxRect* rect;
437 int rectState = 0;
438 ::wxRegion *sipCpp;
439
440 static const char *sipKwdList[] = {
441 sipName_rect,
442 };
443
444 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRect, &rect, &rectState))
445 {
446 bool sipRes;
447
448 PyErr_Clear();
449
450 Py_BEGIN_ALLOW_THREADS
451 sipRes = sipCpp->Intersect(*rect);
452 Py_END_ALLOW_THREADS
453 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
454
455 if (PyErr_Occurred())
456 return 0;
457
458 return PyBool_FromLong(sipRes);
459 }
460 }
461
462 {
463 const ::wxRegion* region;
464 ::wxRegion *sipCpp;
465
466 static const char *sipKwdList[] = {
467 sipName_region,
468 };
469
470 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRegion, ®ion))
471 {
472 bool sipRes;
473
474 PyErr_Clear();
475
476 Py_BEGIN_ALLOW_THREADS
477 sipRes = sipCpp->Intersect(*region);
478 Py_END_ALLOW_THREADS
479
480 if (PyErr_Occurred())
481 return 0;
482
483 return PyBool_FromLong(sipRes);
484 }
485 }
486
487 /* Raise an exception if the arguments couldn't be parsed. */
488 sipNoMethod(sipParseErr, sipName_Region, sipName_Intersect, SIP_NULLPTR);
489
490 return SIP_NULLPTR;
491 }
492
493
494 PyDoc_STRVAR(doc_wxRegion_IsEmpty, "IsEmpty() -> bool\n"
495 "\n"
496 "Returns true if the region is empty, false otherwise.");
497
498 extern "C" {static PyObject *meth_wxRegion_IsEmpty(PyObject *, PyObject *);}
meth_wxRegion_IsEmpty(PyObject * sipSelf,PyObject * sipArgs)499 static PyObject *meth_wxRegion_IsEmpty(PyObject *sipSelf, PyObject *sipArgs)
500 {
501 PyObject *sipParseErr = SIP_NULLPTR;
502
503 {
504 const ::wxRegion *sipCpp;
505
506 if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxRegion, &sipCpp))
507 {
508 bool sipRes;
509
510 PyErr_Clear();
511
512 Py_BEGIN_ALLOW_THREADS
513 sipRes = sipCpp->IsEmpty();
514 Py_END_ALLOW_THREADS
515
516 if (PyErr_Occurred())
517 return 0;
518
519 return PyBool_FromLong(sipRes);
520 }
521 }
522
523 /* Raise an exception if the arguments couldn't be parsed. */
524 sipNoMethod(sipParseErr, sipName_Region, sipName_IsEmpty, SIP_NULLPTR);
525
526 return SIP_NULLPTR;
527 }
528
529
530 PyDoc_STRVAR(doc_wxRegion_IsEqual, "IsEqual(region) -> bool\n"
531 "\n"
532 "Returns true if the region is equal to, i.e. covers the same area as,\n"
533 "another one.");
534
535 extern "C" {static PyObject *meth_wxRegion_IsEqual(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_IsEqual(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)536 static PyObject *meth_wxRegion_IsEqual(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
537 {
538 PyObject *sipParseErr = SIP_NULLPTR;
539
540 {
541 const ::wxRegion* region;
542 const ::wxRegion *sipCpp;
543
544 static const char *sipKwdList[] = {
545 sipName_region,
546 };
547
548 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRegion, ®ion))
549 {
550 bool sipRes;
551
552 PyErr_Clear();
553
554 Py_BEGIN_ALLOW_THREADS
555 sipRes = sipCpp->IsEqual(*region);
556 Py_END_ALLOW_THREADS
557
558 if (PyErr_Occurred())
559 return 0;
560
561 return PyBool_FromLong(sipRes);
562 }
563 }
564
565 /* Raise an exception if the arguments couldn't be parsed. */
566 sipNoMethod(sipParseErr, sipName_Region, sipName_IsEqual, SIP_NULLPTR);
567
568 return SIP_NULLPTR;
569 }
570
571
572 PyDoc_STRVAR(doc_wxRegion_Subtract, "Subtract(rect) -> bool\n"
573 "Subtract(region) -> bool\n"
574 "\n"
575 "Subtracts a rectangular region from this region.\n"
576 "");
577
578 extern "C" {static PyObject *meth_wxRegion_Subtract(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Subtract(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)579 static PyObject *meth_wxRegion_Subtract(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
580 {
581 PyObject *sipParseErr = SIP_NULLPTR;
582
583 {
584 const ::wxRect* rect;
585 int rectState = 0;
586 ::wxRegion *sipCpp;
587
588 static const char *sipKwdList[] = {
589 sipName_rect,
590 };
591
592 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRect, &rect, &rectState))
593 {
594 bool sipRes;
595
596 PyErr_Clear();
597
598 Py_BEGIN_ALLOW_THREADS
599 sipRes = sipCpp->Subtract(*rect);
600 Py_END_ALLOW_THREADS
601 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
602
603 if (PyErr_Occurred())
604 return 0;
605
606 return PyBool_FromLong(sipRes);
607 }
608 }
609
610 {
611 const ::wxRegion* region;
612 ::wxRegion *sipCpp;
613
614 static const char *sipKwdList[] = {
615 sipName_region,
616 };
617
618 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRegion, ®ion))
619 {
620 bool sipRes;
621
622 PyErr_Clear();
623
624 Py_BEGIN_ALLOW_THREADS
625 sipRes = sipCpp->Subtract(*region);
626 Py_END_ALLOW_THREADS
627
628 if (PyErr_Occurred())
629 return 0;
630
631 return PyBool_FromLong(sipRes);
632 }
633 }
634
635 /* Raise an exception if the arguments couldn't be parsed. */
636 sipNoMethod(sipParseErr, sipName_Region, sipName_Subtract, SIP_NULLPTR);
637
638 return SIP_NULLPTR;
639 }
640
641
642 PyDoc_STRVAR(doc_wxRegion_Union, "Union(x, y, width, height) -> bool\n"
643 "Union(rect) -> bool\n"
644 "Union(region) -> bool\n"
645 "Union(bmp) -> bool\n"
646 "Union(bmp, transColour, tolerance=0) -> bool\n"
647 "\n"
648 "Finds the union of this region and another, rectangular region,\n"
649 "specified using position and size.\n"
650 "\n"
651 "\n"
652 "\n"
653 "");
654
655 extern "C" {static PyObject *meth_wxRegion_Union(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Union(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)656 static PyObject *meth_wxRegion_Union(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
657 {
658 PyObject *sipParseErr = SIP_NULLPTR;
659
660 {
661 ::wxCoord x;
662 ::wxCoord y;
663 ::wxCoord width;
664 ::wxCoord height;
665 ::wxRegion *sipCpp;
666
667 static const char *sipKwdList[] = {
668 sipName_x,
669 sipName_y,
670 sipName_width,
671 sipName_height,
672 };
673
674 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biiii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y, &width, &height))
675 {
676 bool sipRes;
677
678 PyErr_Clear();
679
680 Py_BEGIN_ALLOW_THREADS
681 sipRes = sipCpp->Union(x,y,width,height);
682 Py_END_ALLOW_THREADS
683
684 if (PyErr_Occurred())
685 return 0;
686
687 return PyBool_FromLong(sipRes);
688 }
689 }
690
691 {
692 const ::wxRect* rect;
693 int rectState = 0;
694 ::wxRegion *sipCpp;
695
696 static const char *sipKwdList[] = {
697 sipName_rect,
698 };
699
700 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRect, &rect, &rectState))
701 {
702 bool sipRes;
703
704 PyErr_Clear();
705
706 Py_BEGIN_ALLOW_THREADS
707 sipRes = sipCpp->Union(*rect);
708 Py_END_ALLOW_THREADS
709 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
710
711 if (PyErr_Occurred())
712 return 0;
713
714 return PyBool_FromLong(sipRes);
715 }
716 }
717
718 {
719 const ::wxRegion* region;
720 ::wxRegion *sipCpp;
721
722 static const char *sipKwdList[] = {
723 sipName_region,
724 };
725
726 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRegion, ®ion))
727 {
728 bool sipRes;
729
730 PyErr_Clear();
731
732 Py_BEGIN_ALLOW_THREADS
733 sipRes = sipCpp->Union(*region);
734 Py_END_ALLOW_THREADS
735
736 if (PyErr_Occurred())
737 return 0;
738
739 return PyBool_FromLong(sipRes);
740 }
741 }
742
743 {
744 const ::wxBitmap* bmp;
745 ::wxRegion *sipCpp;
746
747 static const char *sipKwdList[] = {
748 sipName_bmp,
749 };
750
751 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxBitmap, &bmp))
752 {
753 bool sipRes;
754
755 PyErr_Clear();
756
757 Py_BEGIN_ALLOW_THREADS
758 sipRes = sipCpp->Union(*bmp);
759 Py_END_ALLOW_THREADS
760
761 if (PyErr_Occurred())
762 return 0;
763
764 return PyBool_FromLong(sipRes);
765 }
766 }
767
768 {
769 const ::wxBitmap* bmp;
770 const ::wxColour* transColour;
771 int transColourState = 0;
772 int tolerance = 0;
773 ::wxRegion *sipCpp;
774
775 static const char *sipKwdList[] = {
776 sipName_bmp,
777 sipName_transColour,
778 sipName_tolerance,
779 };
780
781 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9J1|i", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxBitmap, &bmp, sipType_wxColour, &transColour, &transColourState, &tolerance))
782 {
783 bool sipRes;
784
785 PyErr_Clear();
786
787 Py_BEGIN_ALLOW_THREADS
788 sipRes = sipCpp->Union(*bmp,*transColour,tolerance);
789 Py_END_ALLOW_THREADS
790 sipReleaseType(const_cast< ::wxColour *>(transColour),sipType_wxColour,transColourState);
791
792 if (PyErr_Occurred())
793 return 0;
794
795 return PyBool_FromLong(sipRes);
796 }
797 }
798
799 /* Raise an exception if the arguments couldn't be parsed. */
800 sipNoMethod(sipParseErr, sipName_Region, sipName_Union, SIP_NULLPTR);
801
802 return SIP_NULLPTR;
803 }
804
805
806 PyDoc_STRVAR(doc_wxRegion_Xor, "Xor(x, y, width, height) -> bool\n"
807 "Xor(rect) -> bool\n"
808 "Xor(region) -> bool\n"
809 "\n"
810 "Finds the Xor of this region and another, rectangular region,\n"
811 "specified using position and size.\n"
812 "\n"
813 "");
814
815 extern "C" {static PyObject *meth_wxRegion_Xor(PyObject *, PyObject *, PyObject *);}
meth_wxRegion_Xor(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)816 static PyObject *meth_wxRegion_Xor(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
817 {
818 PyObject *sipParseErr = SIP_NULLPTR;
819
820 {
821 ::wxCoord x;
822 ::wxCoord y;
823 ::wxCoord width;
824 ::wxCoord height;
825 ::wxRegion *sipCpp;
826
827 static const char *sipKwdList[] = {
828 sipName_x,
829 sipName_y,
830 sipName_width,
831 sipName_height,
832 };
833
834 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biiii", &sipSelf, sipType_wxRegion, &sipCpp, &x, &y, &width, &height))
835 {
836 bool sipRes;
837
838 PyErr_Clear();
839
840 Py_BEGIN_ALLOW_THREADS
841 sipRes = sipCpp->Xor(x,y,width,height);
842 Py_END_ALLOW_THREADS
843
844 if (PyErr_Occurred())
845 return 0;
846
847 return PyBool_FromLong(sipRes);
848 }
849 }
850
851 {
852 const ::wxRect* rect;
853 int rectState = 0;
854 ::wxRegion *sipCpp;
855
856 static const char *sipKwdList[] = {
857 sipName_rect,
858 };
859
860 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRect, &rect, &rectState))
861 {
862 bool sipRes;
863
864 PyErr_Clear();
865
866 Py_BEGIN_ALLOW_THREADS
867 sipRes = sipCpp->Xor(*rect);
868 Py_END_ALLOW_THREADS
869 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
870
871 if (PyErr_Occurred())
872 return 0;
873
874 return PyBool_FromLong(sipRes);
875 }
876 }
877
878 {
879 const ::wxRegion* region;
880 ::wxRegion *sipCpp;
881
882 static const char *sipKwdList[] = {
883 sipName_region,
884 };
885
886 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxRegion, &sipCpp, sipType_wxRegion, ®ion))
887 {
888 bool sipRes;
889
890 PyErr_Clear();
891
892 Py_BEGIN_ALLOW_THREADS
893 sipRes = sipCpp->Xor(*region);
894 Py_END_ALLOW_THREADS
895
896 if (PyErr_Occurred())
897 return 0;
898
899 return PyBool_FromLong(sipRes);
900 }
901 }
902
903 /* Raise an exception if the arguments couldn't be parsed. */
904 sipNoMethod(sipParseErr, sipName_Region, sipName_Xor, SIP_NULLPTR);
905
906 return SIP_NULLPTR;
907 }
908
909
910 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
911 extern "C" {static void *cast_wxRegion(void *, const sipTypeDef *);}
cast_wxRegion(void * sipCppV,const sipTypeDef * targetType)912 static void *cast_wxRegion(void *sipCppV, const sipTypeDef *targetType)
913 {
914 ::wxRegion *sipCpp = reinterpret_cast< ::wxRegion *>(sipCppV);
915
916 if (targetType == sipType_wxGDIObject)
917 return static_cast< ::wxGDIObject *>(sipCpp);
918
919 if (targetType == sipType_wxObject)
920 return static_cast< ::wxObject *>(sipCpp);
921
922 return sipCppV;
923 }
924
925
926 /* Call the instance's destructor. */
927 extern "C" {static void release_wxRegion(void *, int);}
release_wxRegion(void * sipCppV,int)928 static void release_wxRegion(void *sipCppV, int)
929 {
930 Py_BEGIN_ALLOW_THREADS
931
932 delete reinterpret_cast< ::wxRegion *>(sipCppV);
933
934 Py_END_ALLOW_THREADS
935 }
936
937
938 extern "C" {static void assign_wxRegion(void *, SIP_SSIZE_T, void *);}
assign_wxRegion(void * sipDst,SIP_SSIZE_T sipDstIdx,void * sipSrc)939 static void assign_wxRegion(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
940 {
941 reinterpret_cast< ::wxRegion *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxRegion *>(sipSrc);
942 }
943
944
945 extern "C" {static void *array_wxRegion(SIP_SSIZE_T);}
array_wxRegion(SIP_SSIZE_T sipNrElem)946 static void *array_wxRegion(SIP_SSIZE_T sipNrElem)
947 {
948 return new ::wxRegion[sipNrElem];
949 }
950
951
952 extern "C" {static void *copy_wxRegion(const void *, SIP_SSIZE_T);}
copy_wxRegion(const void * sipSrc,SIP_SSIZE_T sipSrcIdx)953 static void *copy_wxRegion(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
954 {
955 return new ::wxRegion(reinterpret_cast<const ::wxRegion *>(sipSrc)[sipSrcIdx]);
956 }
957
958
959 extern "C" {static void dealloc_wxRegion(sipSimpleWrapper *);}
dealloc_wxRegion(sipSimpleWrapper * sipSelf)960 static void dealloc_wxRegion(sipSimpleWrapper *sipSelf)
961 {
962 if (sipIsOwnedByPython(sipSelf))
963 {
964 release_wxRegion(sipGetAddress(sipSelf), 0);
965 }
966 }
967
968
969 extern "C" {static void *init_type_wxRegion(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxRegion(sipSimpleWrapper *,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)970 static void *init_type_wxRegion(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
971 {
972 ::wxRegion *sipCpp = SIP_NULLPTR;
973
974 {
975 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
976 {
977
978 if (!wxPyCheckForApp()) return NULL;
979
980 PyErr_Clear();
981
982 Py_BEGIN_ALLOW_THREADS
983 sipCpp = new ::wxRegion();
984 Py_END_ALLOW_THREADS
985
986 if (PyErr_Occurred())
987 {
988 delete sipCpp;
989 return SIP_NULLPTR;
990 }
991
992 return sipCpp;
993 }
994 }
995
996 {
997 ::wxCoord x;
998 ::wxCoord y;
999 ::wxCoord width;
1000 ::wxCoord height;
1001
1002 static const char *sipKwdList[] = {
1003 sipName_x,
1004 sipName_y,
1005 sipName_width,
1006 sipName_height,
1007 };
1008
1009 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "iiii", &x, &y, &width, &height))
1010 {
1011
1012 if (!wxPyCheckForApp()) return NULL;
1013
1014 PyErr_Clear();
1015
1016 Py_BEGIN_ALLOW_THREADS
1017 sipCpp = new ::wxRegion(x,y,width,height);
1018 Py_END_ALLOW_THREADS
1019
1020 if (PyErr_Occurred())
1021 {
1022 delete sipCpp;
1023 return SIP_NULLPTR;
1024 }
1025
1026 return sipCpp;
1027 }
1028 }
1029
1030 {
1031 const ::wxPoint* topLeft;
1032 int topLeftState = 0;
1033 const ::wxPoint* bottomRight;
1034 int bottomRightState = 0;
1035
1036 static const char *sipKwdList[] = {
1037 sipName_topLeft,
1038 sipName_bottomRight,
1039 };
1040
1041 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1J1", sipType_wxPoint, &topLeft, &topLeftState, sipType_wxPoint, &bottomRight, &bottomRightState))
1042 {
1043
1044 if (!wxPyCheckForApp()) return NULL;
1045
1046 PyErr_Clear();
1047
1048 Py_BEGIN_ALLOW_THREADS
1049 sipCpp = new ::wxRegion(*topLeft,*bottomRight);
1050 Py_END_ALLOW_THREADS
1051 sipReleaseType(const_cast< ::wxPoint *>(topLeft),sipType_wxPoint,topLeftState);
1052 sipReleaseType(const_cast< ::wxPoint *>(bottomRight),sipType_wxPoint,bottomRightState);
1053
1054 if (PyErr_Occurred())
1055 {
1056 delete sipCpp;
1057 return SIP_NULLPTR;
1058 }
1059
1060 return sipCpp;
1061 }
1062 }
1063
1064 {
1065 const ::wxRect* rect;
1066 int rectState = 0;
1067
1068 static const char *sipKwdList[] = {
1069 sipName_rect,
1070 };
1071
1072 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxRect, &rect, &rectState))
1073 {
1074
1075 if (!wxPyCheckForApp()) return NULL;
1076
1077 PyErr_Clear();
1078
1079 Py_BEGIN_ALLOW_THREADS
1080 sipCpp = new ::wxRegion(*rect);
1081 Py_END_ALLOW_THREADS
1082 sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
1083
1084 if (PyErr_Occurred())
1085 {
1086 delete sipCpp;
1087 return SIP_NULLPTR;
1088 }
1089
1090 return sipCpp;
1091 }
1092 }
1093
1094 {
1095 const ::wxRegion* region;
1096
1097 static const char *sipKwdList[] = {
1098 sipName_region,
1099 };
1100
1101 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9", sipType_wxRegion, ®ion))
1102 {
1103
1104 if (!wxPyCheckForApp()) return NULL;
1105
1106 PyErr_Clear();
1107
1108 Py_BEGIN_ALLOW_THREADS
1109 sipCpp = new ::wxRegion(*region);
1110 Py_END_ALLOW_THREADS
1111
1112 if (PyErr_Occurred())
1113 {
1114 delete sipCpp;
1115 return SIP_NULLPTR;
1116 }
1117
1118 return sipCpp;
1119 }
1120 }
1121
1122 {
1123 const ::wxBitmap* bmp;
1124
1125 static const char *sipKwdList[] = {
1126 sipName_bmp,
1127 };
1128
1129 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9", sipType_wxBitmap, &bmp))
1130 {
1131
1132 if (!wxPyCheckForApp()) return NULL;
1133
1134 PyErr_Clear();
1135
1136 Py_BEGIN_ALLOW_THREADS
1137 sipCpp = new ::wxRegion(*bmp);
1138 Py_END_ALLOW_THREADS
1139
1140 if (PyErr_Occurred())
1141 {
1142 delete sipCpp;
1143 return SIP_NULLPTR;
1144 }
1145
1146 return sipCpp;
1147 }
1148 }
1149
1150 {
1151 const ::wxBitmap* bmp;
1152 const ::wxColour* transColour;
1153 int transColourState = 0;
1154 int tolerance = 0;
1155
1156 static const char *sipKwdList[] = {
1157 sipName_bmp,
1158 sipName_transColour,
1159 sipName_tolerance,
1160 };
1161
1162 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9J1|i", sipType_wxBitmap, &bmp, sipType_wxColour, &transColour, &transColourState, &tolerance))
1163 {
1164
1165 if (!wxPyCheckForApp()) return NULL;
1166
1167 PyErr_Clear();
1168
1169 Py_BEGIN_ALLOW_THREADS
1170 sipCpp = new ::wxRegion(*bmp,*transColour,tolerance);
1171 Py_END_ALLOW_THREADS
1172 sipReleaseType(const_cast< ::wxColour *>(transColour),sipType_wxColour,transColourState);
1173
1174 if (PyErr_Occurred())
1175 {
1176 delete sipCpp;
1177 return SIP_NULLPTR;
1178 }
1179
1180 return sipCpp;
1181 }
1182 }
1183
1184 {
1185 PyObject * points;
1186 ::wxPolygonFillMode fillStyle = wxODDEVEN_RULE;
1187
1188 static const char *sipKwdList[] = {
1189 sipName_points,
1190 sipName_fillStyle,
1191 };
1192
1193 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "P0|E", &points, sipType_wxPolygonFillMode, &fillStyle))
1194 {
1195 int sipIsErr = 0;
1196
1197 size_t count;
1198 wxPoint* array = wxPoint_array_helper(points, &count);
1199 if ( array != NULL ) {
1200 sipCpp = new wxRegion(count, array, fillStyle);
1201 delete [] array;
1202 }
1203 if (PyErr_Occurred()) sipIsErr = 1;
1204
1205 if (sipIsErr)
1206 {
1207 if (sipUnused)
1208 {
1209 Py_XDECREF(*sipUnused);
1210 }
1211
1212 sipAddException(sipErrorFail, sipParseErr);
1213 return SIP_NULLPTR;
1214 }
1215
1216 return sipCpp;
1217 }
1218 }
1219
1220 return SIP_NULLPTR;
1221 }
1222
1223
1224 /* Define this type's super-types. */
1225 static sipEncodedTypeDef supers_wxRegion[] = {{204, 255, 1}};
1226
1227
1228 static PyMethodDef methods_wxRegion[] = {
1229 {SIP_MLNAME_CAST(sipName_Clear), meth_wxRegion_Clear, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRegion_Clear)},
1230 {SIP_MLNAME_CAST(sipName_Contains), SIP_MLMETH_CAST(meth_wxRegion_Contains), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Contains)},
1231 {SIP_MLNAME_CAST(sipName_ConvertToBitmap), meth_wxRegion_ConvertToBitmap, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRegion_ConvertToBitmap)},
1232 {SIP_MLNAME_CAST(sipName_GetBox), meth_wxRegion_GetBox, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRegion_GetBox)},
1233 {SIP_MLNAME_CAST(sipName_Intersect), SIP_MLMETH_CAST(meth_wxRegion_Intersect), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Intersect)},
1234 {SIP_MLNAME_CAST(sipName_IsEmpty), meth_wxRegion_IsEmpty, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRegion_IsEmpty)},
1235 {SIP_MLNAME_CAST(sipName_IsEqual), SIP_MLMETH_CAST(meth_wxRegion_IsEqual), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_IsEqual)},
1236 {SIP_MLNAME_CAST(sipName_Offset), SIP_MLMETH_CAST(meth_wxRegion_Offset), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Offset)},
1237 {SIP_MLNAME_CAST(sipName_Subtract), SIP_MLMETH_CAST(meth_wxRegion_Subtract), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Subtract)},
1238 {SIP_MLNAME_CAST(sipName_Union), SIP_MLMETH_CAST(meth_wxRegion_Union), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Union)},
1239 {SIP_MLNAME_CAST(sipName_Xor), SIP_MLMETH_CAST(meth_wxRegion_Xor), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRegion_Xor)}
1240 };
1241
1242 sipVariableDef variables_wxRegion[] = {
1243 {PropertyVariable, sipName_Box, &methods_wxRegion[3], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1244 };
1245
1246 PyDoc_STRVAR(doc_wxRegion, "Region()\n"
1247 "Region(x, y, width, height)\n"
1248 "Region(topLeft, bottomRight)\n"
1249 "Region(rect)\n"
1250 "Region(region)\n"
1251 "Region(bmp)\n"
1252 "Region(bmp, transColour, tolerance=0)\n"
1253 "Region(points, fillStyle=ODDEVEN_RULE)\n"
1254 "\n"
1255 "A wxRegion represents a simple or complex region on a device context\n"
1256 "or window.");
1257
1258
1259 sipClassTypeDef sipTypeDef__core_wxRegion = {
1260 {
1261 -1,
1262 SIP_NULLPTR,
1263 SIP_NULLPTR,
1264 SIP_TYPE_SCC|SIP_TYPE_CLASS,
1265 sipNameNr_wxRegion,
1266 {SIP_NULLPTR},
1267 SIP_NULLPTR
1268 },
1269 {
1270 sipNameNr_Region,
1271 {0, 0, 1},
1272 11, methods_wxRegion,
1273 0, SIP_NULLPTR,
1274 1, variables_wxRegion,
1275 {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1276 },
1277 doc_wxRegion,
1278 -1,
1279 -1,
1280 supers_wxRegion,
1281 SIP_NULLPTR,
1282 init_type_wxRegion,
1283 SIP_NULLPTR,
1284 SIP_NULLPTR,
1285 #if PY_MAJOR_VERSION >= 3
1286 SIP_NULLPTR,
1287 SIP_NULLPTR,
1288 #else
1289 SIP_NULLPTR,
1290 SIP_NULLPTR,
1291 SIP_NULLPTR,
1292 SIP_NULLPTR,
1293 #endif
1294 dealloc_wxRegion,
1295 assign_wxRegion,
1296 array_wxRegion,
1297 copy_wxRegion,
1298 release_wxRegion,
1299 cast_wxRegion,
1300 SIP_NULLPTR,
1301 SIP_NULLPTR,
1302 SIP_NULLPTR,
1303 SIP_NULLPTR,
1304 SIP_NULLPTR,
1305 SIP_NULLPTR
1306 };
1307