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/colour.h>
13 
14     #include <wx/setup.h>
15     #include <wxPython/wxpy_api.h>
16         #include <wx/object.h>
17         #include <wx/object.h>
18         #include <wx/object.h>
_wxColour_GetPixel(wxColour * self)19     wxIntPtr* _wxColour_GetPixel(wxColour* self)
20     {
21         #ifdef __WXGTK3__
22             return new wxIntPtr(0);
23         #else
24             return new wxIntPtr((wxIntPtr)self->GetPixel());
25         #endif
26     }
_wxColour__copyFrom(wxColour * self,const wxColour * other)27     void _wxColour__copyFrom(wxColour* self, const wxColour* other)
28     {
29         *self = *other;
30     }
_wxColour_Get(wxColour * self,bool includeAlpha)31     PyObject* _wxColour_Get(wxColour* self, bool includeAlpha)
32     {
33         int red = -1;
34         int green = -1;
35         int blue = -1;
36         int alpha = wxALPHA_OPAQUE;
37         if (self->IsOk()) {
38             red =   self->Red();
39             green = self->Green();
40             blue =  self->Blue();
41             alpha = self->Alpha();
42         }
43         wxPyThreadBlocker blocker;
44         if (includeAlpha)
45             return sipBuildResult(0, "(iiii)", red, green, blue, alpha);
46         else
47             return sipBuildResult(0, "(iii)", red, green, blue);
48     }
_wxColour___nonzero__(wxColour * self)49     int _wxColour___nonzero__(wxColour* self)
50     {
51         return self->IsOk();
52     }
_wxColour___bool__(wxColour * self)53     int _wxColour___bool__(wxColour* self)
54     {
55         return self->IsOk();
56     }
57 
58 
59 PyDoc_STRVAR(doc_wxColour_SetRGB, "SetRGB(colRGB)\n"
60 "\n"
61 "Sets the RGB or RGBA colour values from a single 32 bit value.");
62 
63 extern "C" {static PyObject *meth_wxColour_SetRGB(PyObject *, PyObject *, PyObject *);}
meth_wxColour_SetRGB(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)64 static PyObject *meth_wxColour_SetRGB(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
65 {
66     PyObject *sipParseErr = SIP_NULLPTR;
67 
68     {
69          ::wxUint32 colRGB;
70          ::wxColour *sipCpp;
71 
72         static const char *sipKwdList[] = {
73             sipName_colRGB,
74         };
75 
76         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bu", &sipSelf, sipType_wxColour, &sipCpp, &colRGB))
77         {
78             PyErr_Clear();
79 
80             Py_BEGIN_ALLOW_THREADS
81             sipCpp->SetRGB(colRGB);
82             Py_END_ALLOW_THREADS
83 
84             if (PyErr_Occurred())
85                 return 0;
86 
87             Py_INCREF(Py_None);
88             return Py_None;
89         }
90     }
91 
92     /* Raise an exception if the arguments couldn't be parsed. */
93     sipNoMethod(sipParseErr, sipName_Colour, sipName_SetRGB, SIP_NULLPTR);
94 
95     return SIP_NULLPTR;
96 }
97 
98 
99 PyDoc_STRVAR(doc_wxColour_SetRGBA, "SetRGBA(colRGBA)\n"
100 "\n"
101 "Sets the RGB or RGBA colour values from a single 32 bit value.");
102 
103 extern "C" {static PyObject *meth_wxColour_SetRGBA(PyObject *, PyObject *, PyObject *);}
meth_wxColour_SetRGBA(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)104 static PyObject *meth_wxColour_SetRGBA(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
105 {
106     PyObject *sipParseErr = SIP_NULLPTR;
107 
108     {
109          ::wxUint32 colRGBA;
110          ::wxColour *sipCpp;
111 
112         static const char *sipKwdList[] = {
113             sipName_colRGBA,
114         };
115 
116         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bu", &sipSelf, sipType_wxColour, &sipCpp, &colRGBA))
117         {
118             PyErr_Clear();
119 
120             Py_BEGIN_ALLOW_THREADS
121             sipCpp->SetRGBA(colRGBA);
122             Py_END_ALLOW_THREADS
123 
124             if (PyErr_Occurred())
125                 return 0;
126 
127             Py_INCREF(Py_None);
128             return Py_None;
129         }
130     }
131 
132     /* Raise an exception if the arguments couldn't be parsed. */
133     sipNoMethod(sipParseErr, sipName_Colour, sipName_SetRGBA, SIP_NULLPTR);
134 
135     return SIP_NULLPTR;
136 }
137 
138 
139 PyDoc_STRVAR(doc_wxColour_GetRGB, "GetRGB() -> Uint32\n"
140 "\n"
141 "Gets the RGB or RGBA colour values as a single 32 bit value.");
142 
143 extern "C" {static PyObject *meth_wxColour_GetRGB(PyObject *, PyObject *);}
meth_wxColour_GetRGB(PyObject * sipSelf,PyObject * sipArgs)144 static PyObject *meth_wxColour_GetRGB(PyObject *sipSelf, PyObject *sipArgs)
145 {
146     PyObject *sipParseErr = SIP_NULLPTR;
147 
148     {
149         const  ::wxColour *sipCpp;
150 
151         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
152         {
153              ::wxUint32 sipRes;
154 
155             PyErr_Clear();
156 
157             Py_BEGIN_ALLOW_THREADS
158             sipRes = sipCpp->GetRGB();
159             Py_END_ALLOW_THREADS
160 
161             if (PyErr_Occurred())
162                 return 0;
163 
164             return PyLong_FromUnsignedLong(sipRes);
165         }
166     }
167 
168     /* Raise an exception if the arguments couldn't be parsed. */
169     sipNoMethod(sipParseErr, sipName_Colour, sipName_GetRGB, SIP_NULLPTR);
170 
171     return SIP_NULLPTR;
172 }
173 
174 
175 PyDoc_STRVAR(doc_wxColour_GetRGBA, "GetRGBA() -> Uint32\n"
176 "\n"
177 "Gets the RGB or RGBA colour values as a single 32 bit value.");
178 
179 extern "C" {static PyObject *meth_wxColour_GetRGBA(PyObject *, PyObject *);}
meth_wxColour_GetRGBA(PyObject * sipSelf,PyObject * sipArgs)180 static PyObject *meth_wxColour_GetRGBA(PyObject *sipSelf, PyObject *sipArgs)
181 {
182     PyObject *sipParseErr = SIP_NULLPTR;
183 
184     {
185         const  ::wxColour *sipCpp;
186 
187         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
188         {
189              ::wxUint32 sipRes;
190 
191             PyErr_Clear();
192 
193             Py_BEGIN_ALLOW_THREADS
194             sipRes = sipCpp->GetRGBA();
195             Py_END_ALLOW_THREADS
196 
197             if (PyErr_Occurred())
198                 return 0;
199 
200             return PyLong_FromUnsignedLong(sipRes);
201         }
202     }
203 
204     /* Raise an exception if the arguments couldn't be parsed. */
205     sipNoMethod(sipParseErr, sipName_Colour, sipName_GetRGBA, SIP_NULLPTR);
206 
207     return SIP_NULLPTR;
208 }
209 
210 
211 PyDoc_STRVAR(doc_wxColour_Set, "Set(red, green, blue, alpha=ALPHA_OPAQUE)\n"
212 "Set(RGB)\n"
213 "Set(str) -> bool\n"
214 "\n"
215 "Sets the RGB intensity values using the given values (first overload),\n"
216 "extracting them from the packed long (second overload), using the\n"
217 "given string (third overload).\n"
218 "\n"
219 "");
220 
221 extern "C" {static PyObject *meth_wxColour_Set(PyObject *, PyObject *, PyObject *);}
meth_wxColour_Set(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)222 static PyObject *meth_wxColour_Set(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
223 {
224     PyObject *sipParseErr = SIP_NULLPTR;
225 
226     {
227         unsigned char red;
228         unsigned char green;
229         unsigned char blue;
230         unsigned char alpha = wxALPHA_OPAQUE;
231          ::wxColour *sipCpp;
232 
233         static const char *sipKwdList[] = {
234             sipName_red,
235             sipName_green,
236             sipName_blue,
237             sipName_alpha,
238         };
239 
240         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BMMM|M", &sipSelf, sipType_wxColour, &sipCpp, &red, &green, &blue, &alpha))
241         {
242             PyErr_Clear();
243 
244             Py_BEGIN_ALLOW_THREADS
245             sipCpp->Set(red,green,blue,alpha);
246             Py_END_ALLOW_THREADS
247 
248             if (PyErr_Occurred())
249                 return 0;
250 
251             Py_INCREF(Py_None);
252             return Py_None;
253         }
254     }
255 
256     {
257         unsigned long RGB;
258          ::wxColour *sipCpp;
259 
260         static const char *sipKwdList[] = {
261             sipName_RGB,
262         };
263 
264         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bm", &sipSelf, sipType_wxColour, &sipCpp, &RGB))
265         {
266             PyErr_Clear();
267 
268             Py_BEGIN_ALLOW_THREADS
269             sipCpp->Set(RGB);
270             Py_END_ALLOW_THREADS
271 
272             if (PyErr_Occurred())
273                 return 0;
274 
275             Py_INCREF(Py_None);
276             return Py_None;
277         }
278     }
279 
280     {
281         const  ::wxString* str;
282         int strState = 0;
283          ::wxColour *sipCpp;
284 
285         static const char *sipKwdList[] = {
286             sipName_str,
287         };
288 
289         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxColour, &sipCpp, sipType_wxString,&str, &strState))
290         {
291             bool sipRes;
292 
293             PyErr_Clear();
294 
295             Py_BEGIN_ALLOW_THREADS
296             sipRes = sipCpp->Set(*str);
297             Py_END_ALLOW_THREADS
298             sipReleaseType(const_cast< ::wxString *>(str),sipType_wxString,strState);
299 
300             if (PyErr_Occurred())
301                 return 0;
302 
303             return PyBool_FromLong(sipRes);
304         }
305     }
306 
307     /* Raise an exception if the arguments couldn't be parsed. */
308     sipNoMethod(sipParseErr, sipName_Colour, sipName_Set, SIP_NULLPTR);
309 
310     return SIP_NULLPTR;
311 }
312 
313 
314 PyDoc_STRVAR(doc_wxColour_Alpha, "Alpha() -> unsignedchar\n"
315 "\n"
316 "Returns the alpha value, on platforms where alpha is not yet\n"
317 "supported, this always returns wxALPHA_OPAQUE.");
318 
319 extern "C" {static PyObject *meth_wxColour_Alpha(PyObject *, PyObject *);}
meth_wxColour_Alpha(PyObject * sipSelf,PyObject * sipArgs)320 static PyObject *meth_wxColour_Alpha(PyObject *sipSelf, PyObject *sipArgs)
321 {
322     PyObject *sipParseErr = SIP_NULLPTR;
323 
324     {
325         const  ::wxColour *sipCpp;
326 
327         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
328         {
329             unsigned char sipRes;
330 
331             PyErr_Clear();
332 
333             Py_BEGIN_ALLOW_THREADS
334             sipRes = sipCpp->Alpha();
335             Py_END_ALLOW_THREADS
336 
337             if (PyErr_Occurred())
338                 return 0;
339 
340 #if PY_MAJOR_VERSION >= 3
341             return PyLong_FromUnsignedLong(sipRes);
342 #else
343             return PyInt_FromLong(sipRes);
344 #endif
345         }
346     }
347 
348     /* Raise an exception if the arguments couldn't be parsed. */
349     sipNoMethod(sipParseErr, sipName_Colour, sipName_Alpha, SIP_NULLPTR);
350 
351     return SIP_NULLPTR;
352 }
353 
354 
355 PyDoc_STRVAR(doc_wxColour_Blue, "Blue() -> unsignedchar\n"
356 "\n"
357 "Returns the blue intensity.");
358 
359 extern "C" {static PyObject *meth_wxColour_Blue(PyObject *, PyObject *);}
meth_wxColour_Blue(PyObject * sipSelf,PyObject * sipArgs)360 static PyObject *meth_wxColour_Blue(PyObject *sipSelf, PyObject *sipArgs)
361 {
362     PyObject *sipParseErr = SIP_NULLPTR;
363 
364     {
365         const  ::wxColour *sipCpp;
366 
367         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
368         {
369             unsigned char sipRes;
370 
371             PyErr_Clear();
372 
373             Py_BEGIN_ALLOW_THREADS
374             sipRes = sipCpp->Blue();
375             Py_END_ALLOW_THREADS
376 
377             if (PyErr_Occurred())
378                 return 0;
379 
380 #if PY_MAJOR_VERSION >= 3
381             return PyLong_FromUnsignedLong(sipRes);
382 #else
383             return PyInt_FromLong(sipRes);
384 #endif
385         }
386     }
387 
388     /* Raise an exception if the arguments couldn't be parsed. */
389     sipNoMethod(sipParseErr, sipName_Colour, sipName_Blue, SIP_NULLPTR);
390 
391     return SIP_NULLPTR;
392 }
393 
394 
395 PyDoc_STRVAR(doc_wxColour_GetAsString, "GetAsString(flags=C2S_NAME|C2S_CSS_SYNTAX) -> String\n"
396 "\n"
397 "Converts this colour to a wxString using the given flags.");
398 
399 extern "C" {static PyObject *meth_wxColour_GetAsString(PyObject *, PyObject *, PyObject *);}
meth_wxColour_GetAsString(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)400 static PyObject *meth_wxColour_GetAsString(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
401 {
402     PyObject *sipParseErr = SIP_NULLPTR;
403 
404     {
405         long flags = wxC2S_NAME|wxC2S_CSS_SYNTAX;
406         const  ::wxColour *sipCpp;
407 
408         static const char *sipKwdList[] = {
409             sipName_flags,
410         };
411 
412         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "B|l", &sipSelf, sipType_wxColour, &sipCpp, &flags))
413         {
414              ::wxString*sipRes;
415 
416             PyErr_Clear();
417 
418             Py_BEGIN_ALLOW_THREADS
419             sipRes = new  ::wxString(sipCpp->GetAsString(flags));
420             Py_END_ALLOW_THREADS
421 
422             if (PyErr_Occurred())
423                 return 0;
424 
425             return sipConvertFromNewType(sipRes,sipType_wxString,SIP_NULLPTR);
426         }
427     }
428 
429     /* Raise an exception if the arguments couldn't be parsed. */
430     sipNoMethod(sipParseErr, sipName_Colour, sipName_GetAsString, SIP_NULLPTR);
431 
432     return SIP_NULLPTR;
433 }
434 
435 
436 PyDoc_STRVAR(doc_wxColour_GetPixel, "GetPixel() -> IntPtr");
437 
438 extern "C" {static PyObject *meth_wxColour_GetPixel(PyObject *, PyObject *);}
meth_wxColour_GetPixel(PyObject * sipSelf,PyObject * sipArgs)439 static PyObject *meth_wxColour_GetPixel(PyObject *sipSelf, PyObject *sipArgs)
440 {
441     PyObject *sipParseErr = SIP_NULLPTR;
442 
443     {
444          ::wxColour *sipCpp;
445 
446         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
447         {
448              ::wxIntPtr*sipRes = 0;
449             int sipIsErr = 0;
450 
451         PyErr_Clear();
452         Py_BEGIN_ALLOW_THREADS
453         sipRes = _wxColour_GetPixel(sipCpp);
454         Py_END_ALLOW_THREADS
455         if (PyErr_Occurred()) sipIsErr = 1;
456 
457             if (sipIsErr)
458                 return 0;
459 
460             return sipConvertFromType(sipRes,sipType_wxIntPtr,SIP_NULLPTR);
461         }
462     }
463 
464     /* Raise an exception if the arguments couldn't be parsed. */
465     sipNoMethod(sipParseErr, sipName_Colour, sipName_GetPixel, SIP_NULLPTR);
466 
467     return SIP_NULLPTR;
468 }
469 
470 
471 PyDoc_STRVAR(doc_wxColour_Green, "Green() -> unsignedchar\n"
472 "\n"
473 "Returns the green intensity.");
474 
475 extern "C" {static PyObject *meth_wxColour_Green(PyObject *, PyObject *);}
meth_wxColour_Green(PyObject * sipSelf,PyObject * sipArgs)476 static PyObject *meth_wxColour_Green(PyObject *sipSelf, PyObject *sipArgs)
477 {
478     PyObject *sipParseErr = SIP_NULLPTR;
479 
480     {
481         const  ::wxColour *sipCpp;
482 
483         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
484         {
485             unsigned char sipRes;
486 
487             PyErr_Clear();
488 
489             Py_BEGIN_ALLOW_THREADS
490             sipRes = sipCpp->Green();
491             Py_END_ALLOW_THREADS
492 
493             if (PyErr_Occurred())
494                 return 0;
495 
496 #if PY_MAJOR_VERSION >= 3
497             return PyLong_FromUnsignedLong(sipRes);
498 #else
499             return PyInt_FromLong(sipRes);
500 #endif
501         }
502     }
503 
504     /* Raise an exception if the arguments couldn't be parsed. */
505     sipNoMethod(sipParseErr, sipName_Colour, sipName_Green, SIP_NULLPTR);
506 
507     return SIP_NULLPTR;
508 }
509 
510 
511 PyDoc_STRVAR(doc_wxColour_IsOk, "IsOk() -> bool\n"
512 "\n"
513 "Returns true if the colour object is valid (the colour has been\n"
514 "initialised with RGB values).");
515 
516 extern "C" {static PyObject *meth_wxColour_IsOk(PyObject *, PyObject *);}
meth_wxColour_IsOk(PyObject * sipSelf,PyObject * sipArgs)517 static PyObject *meth_wxColour_IsOk(PyObject *sipSelf, PyObject *sipArgs)
518 {
519     PyObject *sipParseErr = SIP_NULLPTR;
520 
521     {
522         const  ::wxColour *sipCpp;
523 
524         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
525         {
526             bool sipRes;
527 
528             PyErr_Clear();
529 
530             Py_BEGIN_ALLOW_THREADS
531             sipRes = sipCpp->IsOk();
532             Py_END_ALLOW_THREADS
533 
534             if (PyErr_Occurred())
535                 return 0;
536 
537             return PyBool_FromLong(sipRes);
538         }
539     }
540 
541     /* Raise an exception if the arguments couldn't be parsed. */
542     sipNoMethod(sipParseErr, sipName_Colour, sipName_IsOk, SIP_NULLPTR);
543 
544     return SIP_NULLPTR;
545 }
546 
547 
548 PyDoc_STRVAR(doc_wxColour_Red, "Red() -> unsignedchar\n"
549 "\n"
550 "Returns the red intensity.");
551 
552 extern "C" {static PyObject *meth_wxColour_Red(PyObject *, PyObject *);}
meth_wxColour_Red(PyObject * sipSelf,PyObject * sipArgs)553 static PyObject *meth_wxColour_Red(PyObject *sipSelf, PyObject *sipArgs)
554 {
555     PyObject *sipParseErr = SIP_NULLPTR;
556 
557     {
558         const  ::wxColour *sipCpp;
559 
560         if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxColour, &sipCpp))
561         {
562             unsigned char sipRes;
563 
564             PyErr_Clear();
565 
566             Py_BEGIN_ALLOW_THREADS
567             sipRes = sipCpp->Red();
568             Py_END_ALLOW_THREADS
569 
570             if (PyErr_Occurred())
571                 return 0;
572 
573 #if PY_MAJOR_VERSION >= 3
574             return PyLong_FromUnsignedLong(sipRes);
575 #else
576             return PyInt_FromLong(sipRes);
577 #endif
578         }
579     }
580 
581     /* Raise an exception if the arguments couldn't be parsed. */
582     sipNoMethod(sipParseErr, sipName_Colour, sipName_Red, SIP_NULLPTR);
583 
584     return SIP_NULLPTR;
585 }
586 
587 
588 PyDoc_STRVAR(doc_wxColour_MakeDisabled, "MakeDisabled(brightness=255) -> Colour\n"
589 "MakeDisabled(r, g, b, brightness=255) -> (r, g, b)\n"
590 "\n"
591 "Make a disabled version of this colour.\n"
592 "");
593 
594 extern "C" {static PyObject *meth_wxColour_MakeDisabled(PyObject *, PyObject *, PyObject *);}
meth_wxColour_MakeDisabled(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)595 static PyObject *meth_wxColour_MakeDisabled(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
596 {
597     PyObject *sipParseErr = SIP_NULLPTR;
598 
599     {
600         unsigned char brightness = 255;
601          ::wxColour *sipCpp;
602 
603         static const char *sipKwdList[] = {
604             sipName_brightness,
605         };
606 
607         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "B|M", &sipSelf, sipType_wxColour, &sipCpp, &brightness))
608         {
609              ::wxColour*sipRes;
610 
611             PyErr_Clear();
612 
613             Py_BEGIN_ALLOW_THREADS
614             sipRes = &sipCpp->MakeDisabled(brightness);
615             Py_END_ALLOW_THREADS
616 
617             if (PyErr_Occurred())
618                 return 0;
619 
620             return sipConvertFromType(sipRes,sipType_wxColour,SIP_NULLPTR);
621         }
622     }
623 
624     {
625         unsigned char r;
626         unsigned char g;
627         unsigned char b;
628         unsigned char brightness = 255;
629 
630         static const char *sipKwdList[] = {
631             sipName_r,
632             sipName_g,
633             sipName_b,
634             sipName_brightness,
635         };
636 
637         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "ccc|M", &r, &g, &b, &brightness))
638         {
639             PyErr_Clear();
640 
641             Py_BEGIN_ALLOW_THREADS
642              ::wxColour::MakeDisabled(&r,&g,&b,brightness);
643             Py_END_ALLOW_THREADS
644 
645             if (PyErr_Occurred())
646                 return 0;
647 
648             return sipBuildResult(0,"(ccc)",r,g,b);
649         }
650     }
651 
652     /* Raise an exception if the arguments couldn't be parsed. */
653     sipNoMethod(sipParseErr, sipName_Colour, sipName_MakeDisabled, SIP_NULLPTR);
654 
655     return SIP_NULLPTR;
656 }
657 
658 
659 PyDoc_STRVAR(doc_wxColour_ChangeLightness, "ChangeLightness(ialpha) -> Colour\n"
660 "ChangeLightness(r, g, b, ialpha) -> (r, g, b)\n"
661 "\n"
662 "wxColour wrapper for ChangeLightness(r,g,b,ialpha).\n"
663 "");
664 
665 extern "C" {static PyObject *meth_wxColour_ChangeLightness(PyObject *, PyObject *, PyObject *);}
meth_wxColour_ChangeLightness(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)666 static PyObject *meth_wxColour_ChangeLightness(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
667 {
668     PyObject *sipParseErr = SIP_NULLPTR;
669 
670     {
671         int ialpha;
672         const  ::wxColour *sipCpp;
673 
674         static const char *sipKwdList[] = {
675             sipName_ialpha,
676         };
677 
678         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bi", &sipSelf, sipType_wxColour, &sipCpp, &ialpha))
679         {
680              ::wxColour*sipRes;
681 
682             PyErr_Clear();
683 
684             Py_BEGIN_ALLOW_THREADS
685             sipRes = new  ::wxColour(sipCpp->ChangeLightness(ialpha));
686             Py_END_ALLOW_THREADS
687 
688             if (PyErr_Occurred())
689                 return 0;
690 
691             return sipConvertFromNewType(sipRes,sipType_wxColour,SIP_NULLPTR);
692         }
693     }
694 
695     {
696         unsigned char r;
697         unsigned char g;
698         unsigned char b;
699         int ialpha;
700 
701         static const char *sipKwdList[] = {
702             sipName_r,
703             sipName_g,
704             sipName_b,
705             sipName_ialpha,
706         };
707 
708         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "ccci", &r, &g, &b, &ialpha))
709         {
710             PyErr_Clear();
711 
712             Py_BEGIN_ALLOW_THREADS
713              ::wxColour::ChangeLightness(&r,&g,&b,ialpha);
714             Py_END_ALLOW_THREADS
715 
716             if (PyErr_Occurred())
717                 return 0;
718 
719             return sipBuildResult(0,"(ccc)",r,g,b);
720         }
721     }
722 
723     /* Raise an exception if the arguments couldn't be parsed. */
724     sipNoMethod(sipParseErr, sipName_Colour, sipName_ChangeLightness, SIP_NULLPTR);
725 
726     return SIP_NULLPTR;
727 }
728 
729 
730 PyDoc_STRVAR(doc_wxColour_MakeMono, "MakeMono(on) -> (r, g, b)\n"
731 "\n"
732 "Assign 0 or 255 to rgb out parameters.");
733 
734 extern "C" {static PyObject *meth_wxColour_MakeMono(PyObject *, PyObject *, PyObject *);}
meth_wxColour_MakeMono(PyObject *,PyObject * sipArgs,PyObject * sipKwds)735 static PyObject *meth_wxColour_MakeMono(PyObject *, PyObject *sipArgs, PyObject *sipKwds)
736 {
737     PyObject *sipParseErr = SIP_NULLPTR;
738 
739     {
740         unsigned char r;
741         unsigned char g;
742         unsigned char b;
743         bool on;
744 
745         static const char *sipKwdList[] = {
746             sipName_on,
747         };
748 
749         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "b", &on))
750         {
751             PyErr_Clear();
752 
753             Py_BEGIN_ALLOW_THREADS
754              ::wxColour::MakeMono(&r,&g,&b,on);
755             Py_END_ALLOW_THREADS
756 
757             if (PyErr_Occurred())
758                 return 0;
759 
760             return sipBuildResult(0,"(ccc)",r,g,b);
761         }
762     }
763 
764     /* Raise an exception if the arguments couldn't be parsed. */
765     sipNoMethod(sipParseErr, sipName_Colour, sipName_MakeMono, SIP_NULLPTR);
766 
767     return SIP_NULLPTR;
768 }
769 
770 
771 PyDoc_STRVAR(doc_wxColour_MakeGrey, "MakeGrey(r, g, b) -> (r, g, b)\n"
772 "MakeGrey(r, g, b, weight_r, weight_g, weight_b) -> (r, g, b)\n"
773 "\n"
774 "Create a grey colour from (in/out) rgb parameters using integer\n"
775 "arithmetic.\n"
776 "");
777 
778 extern "C" {static PyObject *meth_wxColour_MakeGrey(PyObject *, PyObject *, PyObject *);}
meth_wxColour_MakeGrey(PyObject *,PyObject * sipArgs,PyObject * sipKwds)779 static PyObject *meth_wxColour_MakeGrey(PyObject *, PyObject *sipArgs, PyObject *sipKwds)
780 {
781     PyObject *sipParseErr = SIP_NULLPTR;
782 
783     {
784         unsigned char r;
785         unsigned char g;
786         unsigned char b;
787 
788         static const char *sipKwdList[] = {
789             sipName_r,
790             sipName_g,
791             sipName_b,
792         };
793 
794         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "ccc", &r, &g, &b))
795         {
796             PyErr_Clear();
797 
798             Py_BEGIN_ALLOW_THREADS
799              ::wxColour::MakeGrey(&r,&g,&b);
800             Py_END_ALLOW_THREADS
801 
802             if (PyErr_Occurred())
803                 return 0;
804 
805             return sipBuildResult(0,"(ccc)",r,g,b);
806         }
807     }
808 
809     {
810         unsigned char r;
811         unsigned char g;
812         unsigned char b;
813         double weight_r;
814         double weight_g;
815         double weight_b;
816 
817         static const char *sipKwdList[] = {
818             sipName_r,
819             sipName_g,
820             sipName_b,
821             sipName_weight_r,
822             sipName_weight_g,
823             sipName_weight_b,
824         };
825 
826         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "cccddd", &r, &g, &b, &weight_r, &weight_g, &weight_b))
827         {
828             PyErr_Clear();
829 
830             Py_BEGIN_ALLOW_THREADS
831              ::wxColour::MakeGrey(&r,&g,&b,weight_r,weight_g,weight_b);
832             Py_END_ALLOW_THREADS
833 
834             if (PyErr_Occurred())
835                 return 0;
836 
837             return sipBuildResult(0,"(ccc)",r,g,b);
838         }
839     }
840 
841     /* Raise an exception if the arguments couldn't be parsed. */
842     sipNoMethod(sipParseErr, sipName_Colour, sipName_MakeGrey, SIP_NULLPTR);
843 
844     return SIP_NULLPTR;
845 }
846 
847 
848 PyDoc_STRVAR(doc_wxColour_AlphaBlend, "AlphaBlend(fg, bg, alpha) -> unsignedchar\n"
849 "\n"
850 "Blend colour, taking alpha into account.");
851 
852 extern "C" {static PyObject *meth_wxColour_AlphaBlend(PyObject *, PyObject *, PyObject *);}
meth_wxColour_AlphaBlend(PyObject *,PyObject * sipArgs,PyObject * sipKwds)853 static PyObject *meth_wxColour_AlphaBlend(PyObject *, PyObject *sipArgs, PyObject *sipKwds)
854 {
855     PyObject *sipParseErr = SIP_NULLPTR;
856 
857     {
858         unsigned char fg;
859         unsigned char bg;
860         double alpha;
861 
862         static const char *sipKwdList[] = {
863             sipName_fg,
864             sipName_bg,
865             sipName_alpha,
866         };
867 
868         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "MMd", &fg, &bg, &alpha))
869         {
870             unsigned char sipRes;
871 
872             PyErr_Clear();
873 
874             Py_BEGIN_ALLOW_THREADS
875             sipRes =  ::wxColour::AlphaBlend(fg,bg,alpha);
876             Py_END_ALLOW_THREADS
877 
878             if (PyErr_Occurred())
879                 return 0;
880 
881 #if PY_MAJOR_VERSION >= 3
882             return PyLong_FromUnsignedLong(sipRes);
883 #else
884             return PyInt_FromLong(sipRes);
885 #endif
886         }
887     }
888 
889     /* Raise an exception if the arguments couldn't be parsed. */
890     sipNoMethod(sipParseErr, sipName_Colour, sipName_AlphaBlend, SIP_NULLPTR);
891 
892     return SIP_NULLPTR;
893 }
894 
895 
896 PyDoc_STRVAR(doc_wxColour__copyFrom, "_copyFrom(other)\n"
897 "\n"
898 "For internal use only.");
899 
900 extern "C" {static PyObject *meth_wxColour__copyFrom(PyObject *, PyObject *, PyObject *);}
meth_wxColour__copyFrom(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)901 static PyObject *meth_wxColour__copyFrom(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
902 {
903     PyObject *sipParseErr = SIP_NULLPTR;
904 
905     {
906         const  ::wxColour* other;
907         int otherState = 0;
908          ::wxColour *sipCpp;
909 
910         static const char *sipKwdList[] = {
911             sipName_other,
912         };
913 
914         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ0", &sipSelf, sipType_wxColour, &sipCpp, sipType_wxColour, &other, &otherState))
915         {
916             int sipIsErr = 0;
917 
918         PyErr_Clear();
919         Py_BEGIN_ALLOW_THREADS
920         _wxColour__copyFrom(sipCpp, other);
921         Py_END_ALLOW_THREADS
922         if (PyErr_Occurred()) sipIsErr = 1;
923             sipReleaseType(const_cast< ::wxColour *>(other),sipType_wxColour,otherState);
924 
925             if (sipIsErr)
926                 return 0;
927 
928             Py_INCREF(Py_None);
929             return Py_None;
930         }
931     }
932 
933     /* Raise an exception if the arguments couldn't be parsed. */
934     sipNoMethod(sipParseErr, sipName_Colour, sipName__copyFrom, SIP_NULLPTR);
935 
936     return SIP_NULLPTR;
937 }
938 
939 
940 PyDoc_STRVAR(doc_wxColour_Get, "Get(includeAlpha=True) -> (r,g,b) or (r,g,b,a)\n"
941 "\n"
942 "Returns the RGB intensity values as a tuple, optionally the alpha\n"
943 "value as well.");
944 
945 extern "C" {static PyObject *meth_wxColour_Get(PyObject *, PyObject *, PyObject *);}
meth_wxColour_Get(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)946 static PyObject *meth_wxColour_Get(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
947 {
948     PyObject *sipParseErr = SIP_NULLPTR;
949 
950     {
951         bool includeAlpha = 1;
952          ::wxColour *sipCpp;
953 
954         static const char *sipKwdList[] = {
955             sipName_includeAlpha,
956         };
957 
958         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "B|b", &sipSelf, sipType_wxColour, &sipCpp, &includeAlpha))
959         {
960             PyObject * sipRes = SIP_NULLPTR;
961             int sipIsErr = 0;
962 
963         PyErr_Clear();
964         Py_BEGIN_ALLOW_THREADS
965         sipRes = _wxColour_Get(sipCpp, includeAlpha);
966         Py_END_ALLOW_THREADS
967         if (PyErr_Occurred()) sipIsErr = 1;
968 
969             if (sipIsErr)
970                 return 0;
971 
972             return sipRes;
973         }
974     }
975 
976     /* Raise an exception if the arguments couldn't be parsed. */
977     sipNoMethod(sipParseErr, sipName_Colour, sipName_Get, SIP_NULLPTR);
978 
979     return SIP_NULLPTR;
980 }
981 
982 
983 extern "C" {static int slot_wxColour___bool__(PyObject *);}
slot_wxColour___bool__(PyObject * sipSelf)984 static int slot_wxColour___bool__(PyObject *sipSelf)
985 {
986      ::wxColour *sipCpp = reinterpret_cast< ::wxColour *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxColour));
987 
988     if (!sipCpp)
989         return -1;
990 
991 
992     {
993         {
994             int sipRes = 0;
995             int sipIsErr = 0;
996 
997         PyErr_Clear();
998         Py_BEGIN_ALLOW_THREADS
999         sipRes = _wxColour___bool__(sipCpp);
1000         Py_END_ALLOW_THREADS
1001         if (PyErr_Occurred()) sipIsErr = 1;
1002 
1003             if (sipIsErr)
1004                 return -1;
1005 
1006             return sipRes;
1007         }
1008     }
1009 
1010     return 0;
1011 }
1012 
1013 
1014 extern "C" {static int slot_wxColour___nonzero__(PyObject *);}
slot_wxColour___nonzero__(PyObject * sipSelf)1015 static int slot_wxColour___nonzero__(PyObject *sipSelf)
1016 {
1017      ::wxColour *sipCpp = reinterpret_cast< ::wxColour *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxColour));
1018 
1019     if (!sipCpp)
1020         return -1;
1021 
1022 
1023     {
1024         {
1025             int sipRes = 0;
1026             int sipIsErr = 0;
1027 
1028         PyErr_Clear();
1029         Py_BEGIN_ALLOW_THREADS
1030         sipRes = _wxColour___nonzero__(sipCpp);
1031         Py_END_ALLOW_THREADS
1032         if (PyErr_Occurred()) sipIsErr = 1;
1033 
1034             if (sipIsErr)
1035                 return -1;
1036 
1037             return sipRes;
1038         }
1039     }
1040 
1041     return 0;
1042 }
1043 
1044 
1045 extern "C" {static PyObject *slot_wxColour___eq__(PyObject *,PyObject *);}
slot_wxColour___eq__(PyObject * sipSelf,PyObject * sipArg)1046 static PyObject *slot_wxColour___eq__(PyObject *sipSelf,PyObject *sipArg)
1047 {
1048      ::wxColour *sipCpp = reinterpret_cast< ::wxColour *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxColour));
1049 
1050     if (!sipCpp)
1051         return SIP_NULLPTR;
1052 
1053     PyObject *sipParseErr = SIP_NULLPTR;
1054 
1055     {
1056         const  ::wxColour* colour;
1057         int colourState = 0;
1058 
1059         if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxColour, &colour, &colourState))
1060         {
1061             bool sipRes;
1062 
1063             PyErr_Clear();
1064 
1065             Py_BEGIN_ALLOW_THREADS
1066             sipRes = sipCpp-> ::wxColour::operator==(*colour);
1067             Py_END_ALLOW_THREADS
1068             sipReleaseType(const_cast< ::wxColour *>(colour),sipType_wxColour,colourState);
1069 
1070             if (PyErr_Occurred())
1071                 return 0;
1072 
1073             return PyBool_FromLong(sipRes);
1074         }
1075     }
1076 
1077     Py_XDECREF(sipParseErr);
1078 
1079     if (sipParseErr == Py_None)
1080         return SIP_NULLPTR;
1081 
1082     return sipPySlotExtend(&sipModuleAPI__core, eq_slot, sipType_wxColour, sipSelf, sipArg);
1083 }
1084 
1085 
1086 extern "C" {static PyObject *slot_wxColour___ne__(PyObject *,PyObject *);}
slot_wxColour___ne__(PyObject * sipSelf,PyObject * sipArg)1087 static PyObject *slot_wxColour___ne__(PyObject *sipSelf,PyObject *sipArg)
1088 {
1089      ::wxColour *sipCpp = reinterpret_cast< ::wxColour *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxColour));
1090 
1091     if (!sipCpp)
1092         return SIP_NULLPTR;
1093 
1094     PyObject *sipParseErr = SIP_NULLPTR;
1095 
1096     {
1097         const  ::wxColour* colour;
1098         int colourState = 0;
1099 
1100         if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxColour, &colour, &colourState))
1101         {
1102             bool sipRes;
1103 
1104             PyErr_Clear();
1105 
1106             Py_BEGIN_ALLOW_THREADS
1107             sipRes = sipCpp-> ::wxColour::operator!=(*colour);
1108             Py_END_ALLOW_THREADS
1109             sipReleaseType(const_cast< ::wxColour *>(colour),sipType_wxColour,colourState);
1110 
1111             if (PyErr_Occurred())
1112                 return 0;
1113 
1114             return PyBool_FromLong(sipRes);
1115         }
1116     }
1117 
1118     Py_XDECREF(sipParseErr);
1119 
1120     if (sipParseErr == Py_None)
1121         return SIP_NULLPTR;
1122 
1123     return sipPySlotExtend(&sipModuleAPI__core, ne_slot, sipType_wxColour, sipSelf, sipArg);
1124 }
1125 
1126 
1127 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
1128 extern "C" {static void *cast_wxColour(void *, const sipTypeDef *);}
cast_wxColour(void * sipCppV,const sipTypeDef * targetType)1129 static void *cast_wxColour(void *sipCppV, const sipTypeDef *targetType)
1130 {
1131      ::wxColour *sipCpp = reinterpret_cast< ::wxColour *>(sipCppV);
1132 
1133     if (targetType == sipType_wxObject)
1134         return static_cast< ::wxObject *>(sipCpp);
1135 
1136     return sipCppV;
1137 }
1138 
1139 
1140 /* Call the instance's destructor. */
1141 extern "C" {static void release_wxColour(void *, int);}
release_wxColour(void * sipCppV,int)1142 static void release_wxColour(void *sipCppV, int)
1143 {
1144     Py_BEGIN_ALLOW_THREADS
1145 
1146     delete reinterpret_cast< ::wxColour *>(sipCppV);
1147 
1148     Py_END_ALLOW_THREADS
1149 }
1150 
1151 
1152 extern "C" {static void assign_wxColour(void *, SIP_SSIZE_T, void *);}
assign_wxColour(void * sipDst,SIP_SSIZE_T sipDstIdx,void * sipSrc)1153 static void assign_wxColour(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
1154 {
1155     reinterpret_cast< ::wxColour *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxColour *>(sipSrc);
1156 }
1157 
1158 
1159 extern "C" {static void *array_wxColour(SIP_SSIZE_T);}
array_wxColour(SIP_SSIZE_T sipNrElem)1160 static void *array_wxColour(SIP_SSIZE_T sipNrElem)
1161 {
1162     return new  ::wxColour[sipNrElem];
1163 }
1164 
1165 
1166 extern "C" {static void *copy_wxColour(const void *, SIP_SSIZE_T);}
copy_wxColour(const void * sipSrc,SIP_SSIZE_T sipSrcIdx)1167 static void *copy_wxColour(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
1168 {
1169     return new  ::wxColour(reinterpret_cast<const  ::wxColour *>(sipSrc)[sipSrcIdx]);
1170 }
1171 
1172 
1173 extern "C" {static void dealloc_wxColour(sipSimpleWrapper *);}
dealloc_wxColour(sipSimpleWrapper * sipSelf)1174 static void dealloc_wxColour(sipSimpleWrapper *sipSelf)
1175 {
1176     if (sipIsOwnedByPython(sipSelf))
1177     {
1178         release_wxColour(sipGetAddress(sipSelf), 0);
1179     }
1180 }
1181 
1182 
1183 extern "C" {static void *init_type_wxColour(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxColour(sipSimpleWrapper *,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)1184 static void *init_type_wxColour(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
1185 {
1186      ::wxColour *sipCpp = SIP_NULLPTR;
1187 
1188     {
1189         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
1190         {
1191             PyErr_Clear();
1192 
1193             Py_BEGIN_ALLOW_THREADS
1194             sipCpp = new  ::wxColour();
1195             Py_END_ALLOW_THREADS
1196 
1197             if (PyErr_Occurred())
1198             {
1199                 delete sipCpp;
1200                 return SIP_NULLPTR;
1201             }
1202 
1203             return sipCpp;
1204         }
1205     }
1206 
1207     {
1208         unsigned char red;
1209         unsigned char green;
1210         unsigned char blue;
1211         unsigned char alpha = wxALPHA_OPAQUE;
1212 
1213         static const char *sipKwdList[] = {
1214             sipName_red,
1215             sipName_green,
1216             sipName_blue,
1217             sipName_alpha,
1218         };
1219 
1220         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "MMM|M", &red, &green, &blue, &alpha))
1221         {
1222             PyErr_Clear();
1223 
1224             Py_BEGIN_ALLOW_THREADS
1225             sipCpp = new  ::wxColour(red,green,blue,alpha);
1226             Py_END_ALLOW_THREADS
1227 
1228             if (PyErr_Occurred())
1229             {
1230                 delete sipCpp;
1231                 return SIP_NULLPTR;
1232             }
1233 
1234             return sipCpp;
1235         }
1236     }
1237 
1238     {
1239         unsigned long colRGB;
1240 
1241         static const char *sipKwdList[] = {
1242             sipName_colRGB,
1243         };
1244 
1245         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "m", &colRGB))
1246         {
1247             PyErr_Clear();
1248 
1249             Py_BEGIN_ALLOW_THREADS
1250             sipCpp = new  ::wxColour(colRGB);
1251             Py_END_ALLOW_THREADS
1252 
1253             if (PyErr_Occurred())
1254             {
1255                 delete sipCpp;
1256                 return SIP_NULLPTR;
1257             }
1258 
1259             return sipCpp;
1260         }
1261     }
1262 
1263     {
1264         const  ::wxColour* colour;
1265         int colourState = 0;
1266 
1267         static const char *sipKwdList[] = {
1268             sipName_colour,
1269         };
1270 
1271         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxColour, &colour, &colourState))
1272         {
1273 
1274         if (!wxPyCheckForApp()) return NULL;
1275 
1276             PyErr_Clear();
1277 
1278             Py_BEGIN_ALLOW_THREADS
1279             sipCpp = new  ::wxColour(*colour);
1280             Py_END_ALLOW_THREADS
1281             sipReleaseType(const_cast< ::wxColour *>(colour),sipType_wxColour,colourState);
1282 
1283             if (PyErr_Occurred())
1284             {
1285                 delete sipCpp;
1286                 return SIP_NULLPTR;
1287             }
1288 
1289             return sipCpp;
1290         }
1291     }
1292 
1293     return SIP_NULLPTR;
1294 }
1295 
1296 
1297 extern "C" {static int convertTo_wxColour(PyObject *, void **, int *, PyObject *);}
convertTo_wxColour(PyObject * sipPy,void ** sipCppPtrV,int * sipIsErr,PyObject * sipTransferObj)1298 static int convertTo_wxColour(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
1299 {
1300      ::wxColour **sipCppPtr = reinterpret_cast< ::wxColour **>(sipCppPtrV);
1301 
1302         // is it just a typecheck?
1303         if (!sipIsErr) {
1304             if (sipPy == Py_None)
1305                 return 1;
1306             if (sipCanConvertToType(sipPy, sipType_wxColour, SIP_NO_CONVERTORS))
1307                 return 1;
1308             if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy))
1309                 return 1;
1310             if (wxPyNumberSequenceCheck(sipPy, 4) || wxPyNumberSequenceCheck(sipPy, 3)) {
1311                 return 1;
1312             }
1313             return 0;
1314         }
1315 
1316         // otherwise do the conversion
1317         // is it None?
1318         if (sipPy == Py_None) {
1319             *sipCppPtr = new wxColour(wxNullColour);
1320             return sipGetState(sipTransferObj);
1321         }
1322         // Is it a string?
1323         else if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) {
1324             wxString spec = Py2wxString(sipPy);
1325             if (!spec.empty()
1326                 && spec.GetChar(0) == '#'
1327                 && (spec.length() == 7 || spec.length() == 9)) {  // It's  #RRGGBB[AA]
1328                 long red, green, blue;
1329                 red = green = blue = 0;
1330                 spec.Mid(1,2).ToLong(&red,   16);
1331                 spec.Mid(3,2).ToLong(&green, 16);
1332                 spec.Mid(5,2).ToLong(&blue,  16);
1333 
1334                 if (spec.length() == 7)         // no alpha
1335                     *sipCppPtr = new wxColour(red, green, blue);
1336                 else {                          // yes alpha
1337                     long alpha;
1338                     spec.Mid(7,2).ToLong(&alpha, 16);
1339                     *sipCppPtr = new wxColour(red, green, blue, alpha);
1340                 }
1341                 return sipGetState(sipTransferObj);
1342             }
1343             else {                                       // assume it's a colour name
1344                 // check if alpha is there too
1345                 int pos;
1346                 if (((pos = spec.Find(':', true)) != wxNOT_FOUND) && (pos == spec.length()-3)) {
1347                     long alpha;
1348                     spec.Right(2).ToLong(&alpha, 16);
1349                     wxColour c = wxColour(spec.Left(spec.length()-3));
1350                     *sipCppPtr = new wxColour(c.Red(), c.Green(), c.Blue(), alpha);
1351                 }
1352                 else
1353                     *sipCppPtr = new wxColour(spec);
1354                 return sipGetState(sipTransferObj);
1355             }
1356         }
1357         // Is it a sequence? (if so then length was checked above)
1358         else if (wxPyNumberSequenceCheck(sipPy)) {
1359             size_t len = PySequence_Size(sipPy);
1360 
1361             PyObject* o1 = PySequence_ITEM(sipPy, 0);
1362             PyObject* o2 = PySequence_ITEM(sipPy, 1);
1363             PyObject* o3 = PySequence_ITEM(sipPy, 2);
1364             if (len == 3)
1365                 *sipCppPtr = new wxColour(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3));
1366             else {
1367                 PyObject* o4 = PySequence_ITEM(sipPy, 3);
1368                 *sipCppPtr = new wxColour(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3),
1369                                           wxPyInt_AsLong(o4));
1370                 Py_DECREF(o4);
1371             }
1372             Py_DECREF(o1);
1373             Py_DECREF(o2);
1374             Py_DECREF(o3);
1375             return sipGetState(sipTransferObj);
1376         }
1377 
1378         // if we get this far then it must already be a wxColour instance
1379         *sipCppPtr = reinterpret_cast<wxColour*>(sipConvertToType(
1380             sipPy, sipType_wxColour, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
1381         return 0; // not a new instance
1382 }
1383 
1384 
1385 /* Define this type's super-types. */
1386 static sipEncodedTypeDef supers_wxColour[] = {{358, 255, 1}};
1387 
1388 
1389 /* Define this type's Python slots. */
1390 static sipPySlotDef slots_wxColour[] = {
1391     {(void *)slot_wxColour___bool__, bool_slot},
1392     {(void *)slot_wxColour___nonzero__, bool_slot},
1393     {(void *)slot_wxColour___eq__, eq_slot},
1394     {(void *)slot_wxColour___ne__, ne_slot},
1395     {0, (sipPySlotType)0}
1396 };
1397 
1398 
1399 static PyMethodDef methods_wxColour[] = {
1400     {SIP_MLNAME_CAST(sipName_Alpha), meth_wxColour_Alpha, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_Alpha)},
1401     {SIP_MLNAME_CAST(sipName_AlphaBlend), SIP_MLMETH_CAST(meth_wxColour_AlphaBlend), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_AlphaBlend)},
1402     {SIP_MLNAME_CAST(sipName_Blue), meth_wxColour_Blue, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_Blue)},
1403     {SIP_MLNAME_CAST(sipName_ChangeLightness), SIP_MLMETH_CAST(meth_wxColour_ChangeLightness), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_ChangeLightness)},
1404     {SIP_MLNAME_CAST(sipName_Get), SIP_MLMETH_CAST(meth_wxColour_Get), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_Get)},
1405     {SIP_MLNAME_CAST(sipName_GetAsString), SIP_MLMETH_CAST(meth_wxColour_GetAsString), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_GetAsString)},
1406     {SIP_MLNAME_CAST(sipName_GetPixel), meth_wxColour_GetPixel, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_GetPixel)},
1407     {SIP_MLNAME_CAST(sipName_GetRGB), meth_wxColour_GetRGB, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_GetRGB)},
1408     {SIP_MLNAME_CAST(sipName_GetRGBA), meth_wxColour_GetRGBA, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_GetRGBA)},
1409     {SIP_MLNAME_CAST(sipName_Green), meth_wxColour_Green, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_Green)},
1410     {SIP_MLNAME_CAST(sipName_IsOk), meth_wxColour_IsOk, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_IsOk)},
1411     {SIP_MLNAME_CAST(sipName_MakeDisabled), SIP_MLMETH_CAST(meth_wxColour_MakeDisabled), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_MakeDisabled)},
1412     {SIP_MLNAME_CAST(sipName_MakeGrey), SIP_MLMETH_CAST(meth_wxColour_MakeGrey), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_MakeGrey)},
1413     {SIP_MLNAME_CAST(sipName_MakeMono), SIP_MLMETH_CAST(meth_wxColour_MakeMono), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_MakeMono)},
1414     {SIP_MLNAME_CAST(sipName_Red), meth_wxColour_Red, METH_VARARGS, SIP_MLDOC_CAST(doc_wxColour_Red)},
1415     {SIP_MLNAME_CAST(sipName_Set), SIP_MLMETH_CAST(meth_wxColour_Set), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_Set)},
1416     {SIP_MLNAME_CAST(sipName_SetRGB), SIP_MLMETH_CAST(meth_wxColour_SetRGB), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_SetRGB)},
1417     {SIP_MLNAME_CAST(sipName_SetRGBA), SIP_MLMETH_CAST(meth_wxColour_SetRGBA), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour_SetRGBA)},
1418     {SIP_MLNAME_CAST(sipName__copyFrom), SIP_MLMETH_CAST(meth_wxColour__copyFrom), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxColour__copyFrom)}
1419 };
1420 
1421 sipVariableDef variables_wxColour[] = {
1422     {PropertyVariable, sipName_alpha, &methods_wxColour[0], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1423     {PropertyVariable, sipName_blue, &methods_wxColour[2], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1424     {PropertyVariable, sipName_green, &methods_wxColour[9], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1425     {PropertyVariable, sipName_red, &methods_wxColour[14], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1426     {PropertyVariable, sipName_RGBA, &methods_wxColour[8], &methods_wxColour[17], SIP_NULLPTR, SIP_NULLPTR},
1427     {PropertyVariable, sipName_RGB, &methods_wxColour[7], &methods_wxColour[16], SIP_NULLPTR, SIP_NULLPTR},
1428     {PropertyVariable, sipName_Pixel, &methods_wxColour[6], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1429 };
1430 
1431 PyDoc_STRVAR(doc_wxColour, "Colour()\n"
1432 "Colour(red, green, blue, alpha=ALPHA_OPAQUE)\n"
1433 "Colour(colRGB)\n"
1434 "Colour(colour)\n"
1435 "\n"
1436 "A colour is an object representing a combination of Red, Green, and\n"
1437 "Blue (RGB) intensity values, and is used to determine drawing colours.");
1438 
1439 
1440 sipClassTypeDef sipTypeDef__core_wxColour = {
1441     {
1442         -1,
1443         SIP_NULLPTR,
1444         SIP_NULLPTR,
1445         SIP_TYPE_SCC|SIP_TYPE_ALLOW_NONE|SIP_TYPE_CLASS,
1446         sipNameNr_wxColour,
1447         {SIP_NULLPTR},
1448         SIP_NULLPTR
1449     },
1450     {
1451         sipNameNr_Colour,
1452         {0, 0, 1},
1453         19, methods_wxColour,
1454         0, SIP_NULLPTR,
1455         7, variables_wxColour,
1456         {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
1457     },
1458     doc_wxColour,
1459     -1,
1460     -1,
1461     supers_wxColour,
1462     slots_wxColour,
1463     init_type_wxColour,
1464     SIP_NULLPTR,
1465     SIP_NULLPTR,
1466 #if PY_MAJOR_VERSION >= 3
1467     SIP_NULLPTR,
1468     SIP_NULLPTR,
1469 #else
1470     SIP_NULLPTR,
1471     SIP_NULLPTR,
1472     SIP_NULLPTR,
1473     SIP_NULLPTR,
1474 #endif
1475     dealloc_wxColour,
1476     assign_wxColour,
1477     array_wxColour,
1478     copy_wxColour,
1479     release_wxColour,
1480     cast_wxColour,
1481     convertTo_wxColour,
1482     SIP_NULLPTR,
1483     SIP_NULLPTR,
1484     SIP_NULLPTR,
1485     SIP_NULLPTR,
1486     SIP_NULLPTR
1487 };
1488