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_grid.h"
11 
12         #include <wx/grid.h>
13 
14         #include <wx/grid.h>
15         #include <wx/dc.h>
16         #include <wx/gdicmn.h>
17 
18 
19 class sipwxGridHeaderLabelsRenderer : public  ::wxGridHeaderLabelsRenderer
20 {
21 public:
22     sipwxGridHeaderLabelsRenderer();
23     sipwxGridHeaderLabelsRenderer(const  ::wxGridHeaderLabelsRenderer&);
24     virtual ~sipwxGridHeaderLabelsRenderer();
25 
26     /*
27      * There is a protected method for every virtual method visible from
28      * this class.
29      */
30 protected:
31     void DrawLabel(const  ::wxGrid&, ::wxDC&,const  ::wxString&,const  ::wxRect&,int,int,int) const SIP_OVERRIDE;
32     void DrawBorder(const  ::wxGrid&, ::wxDC&, ::wxRect&) const SIP_OVERRIDE;
33 
34 public:
35     sipSimpleWrapper *sipPySelf;
36 
37 private:
38     sipwxGridHeaderLabelsRenderer(const sipwxGridHeaderLabelsRenderer &);
39     sipwxGridHeaderLabelsRenderer &operator = (const sipwxGridHeaderLabelsRenderer &);
40 
41     char sipPyMethods[2];
42 };
43 
sipwxGridHeaderLabelsRenderer()44 sipwxGridHeaderLabelsRenderer::sipwxGridHeaderLabelsRenderer():  ::wxGridHeaderLabelsRenderer(), sipPySelf(SIP_NULLPTR)
45 {
46     memset(sipPyMethods, 0, sizeof (sipPyMethods));
47 }
48 
sipwxGridHeaderLabelsRenderer(const::wxGridHeaderLabelsRenderer & a0)49 sipwxGridHeaderLabelsRenderer::sipwxGridHeaderLabelsRenderer(const  ::wxGridHeaderLabelsRenderer& a0):  ::wxGridHeaderLabelsRenderer(a0), sipPySelf(SIP_NULLPTR)
50 {
51     memset(sipPyMethods, 0, sizeof (sipPyMethods));
52 }
53 
~sipwxGridHeaderLabelsRenderer()54 sipwxGridHeaderLabelsRenderer::~sipwxGridHeaderLabelsRenderer()
55 {
56     sipInstanceDestroyedEx(&sipPySelf);
57 }
58 
DrawLabel(const::wxGrid & grid,::wxDC & dc,const::wxString & value,const::wxRect & rect,int horizAlign,int vertAlign,int textOrientation) const59 void sipwxGridHeaderLabelsRenderer::DrawLabel(const  ::wxGrid& grid, ::wxDC& dc,const  ::wxString& value,const  ::wxRect& rect,int horizAlign,int vertAlign,int textOrientation) const
60 {
61     sip_gilstate_t sipGILState;
62     PyObject *sipMeth;
63 
64     sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[0]),sipPySelf,SIP_NULLPTR,sipName_DrawLabel);
65 
66     if (!sipMeth)
67     {
68          ::wxGridHeaderLabelsRenderer::DrawLabel(grid,dc,value,rect,horizAlign,vertAlign,textOrientation);
69         return;
70     }
71 
72     extern void sipVH__grid_16(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const  ::wxGrid&, ::wxDC&,const  ::wxString&,const  ::wxRect&,int,int,int);
73 
74     sipVH__grid_16(sipGILState, 0, sipPySelf, sipMeth, grid, dc, value, rect, horizAlign, vertAlign, textOrientation);
75 }
76 
DrawBorder(const::wxGrid & grid,::wxDC & dc,::wxRect & rect) const77 void sipwxGridHeaderLabelsRenderer::DrawBorder(const  ::wxGrid& grid, ::wxDC& dc, ::wxRect& rect) const
78 {
79     sip_gilstate_t sipGILState;
80     PyObject *sipMeth;
81 
82     sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[1]),sipPySelf,sipName_GridHeaderLabelsRenderer,sipName_DrawBorder);
83 
84     if (!sipMeth)
85         return;
86 
87     extern void sipVH__grid_15(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const  ::wxGrid&, ::wxDC&, ::wxRect&);
88 
89     sipVH__grid_15(sipGILState, 0, sipPySelf, sipMeth, grid, dc, rect);
90 }
91 
92 
93 PyDoc_STRVAR(doc_wxGridHeaderLabelsRenderer_DrawLabel, "DrawLabel(grid, dc, value, rect, horizAlign, vertAlign, textOrientation)\n"
94 "\n"
95 "Called by the grid to draw the specified label.");
96 
97 extern "C" {static PyObject *meth_wxGridHeaderLabelsRenderer_DrawLabel(PyObject *, PyObject *, PyObject *);}
meth_wxGridHeaderLabelsRenderer_DrawLabel(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)98 static PyObject *meth_wxGridHeaderLabelsRenderer_DrawLabel(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
99 {
100     PyObject *sipParseErr = SIP_NULLPTR;
101     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
102 
103     {
104         const  ::wxGrid* grid;
105          ::wxDC* dc;
106         const  ::wxString* value;
107         int valueState = 0;
108         const  ::wxRect* rect;
109         int rectState = 0;
110         int horizAlign;
111         int vertAlign;
112         int textOrientation;
113         const  ::wxGridHeaderLabelsRenderer *sipCpp;
114 
115         static const char *sipKwdList[] = {
116             sipName_grid,
117             sipName_dc,
118             sipName_value,
119             sipName_rect,
120             sipName_horizAlign,
121             sipName_vertAlign,
122             sipName_textOrientation,
123         };
124 
125         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9J9J1J1iii", &sipSelf, sipType_wxGridHeaderLabelsRenderer, &sipCpp, sipType_wxGrid, &grid, sipType_wxDC, &dc, sipType_wxString,&value, &valueState, sipType_wxRect, &rect, &rectState, &horizAlign, &vertAlign, &textOrientation))
126         {
127             PyErr_Clear();
128 
129             Py_BEGIN_ALLOW_THREADS
130             (sipSelfWasArg ? sipCpp-> ::wxGridHeaderLabelsRenderer::DrawLabel(*grid,*dc,*value,*rect,horizAlign,vertAlign,textOrientation) : sipCpp->DrawLabel(*grid,*dc,*value,*rect,horizAlign,vertAlign,textOrientation));
131             Py_END_ALLOW_THREADS
132             sipReleaseType(const_cast< ::wxString *>(value),sipType_wxString,valueState);
133             sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);
134 
135             if (PyErr_Occurred())
136                 return 0;
137 
138             Py_INCREF(Py_None);
139             return Py_None;
140         }
141     }
142 
143     /* Raise an exception if the arguments couldn't be parsed. */
144     sipNoMethod(sipParseErr, sipName_GridHeaderLabelsRenderer, sipName_DrawLabel, SIP_NULLPTR);
145 
146     return SIP_NULLPTR;
147 }
148 
149 
150 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
151 extern "C" {static void *cast_wxGridHeaderLabelsRenderer(void *, const sipTypeDef *);}
cast_wxGridHeaderLabelsRenderer(void * sipCppV,const sipTypeDef * targetType)152 static void *cast_wxGridHeaderLabelsRenderer(void *sipCppV, const sipTypeDef *targetType)
153 {
154      ::wxGridHeaderLabelsRenderer *sipCpp = reinterpret_cast< ::wxGridHeaderLabelsRenderer *>(sipCppV);
155 
156     if (targetType == sipType_wxGridCornerHeaderRenderer)
157         return static_cast< ::wxGridCornerHeaderRenderer *>(sipCpp);
158 
159     return sipCppV;
160 }
161 
162 
163 /* Call the instance's destructor. */
164 extern "C" {static void release_wxGridHeaderLabelsRenderer(void *, int);}
release_wxGridHeaderLabelsRenderer(void * sipCppV,int sipState)165 static void release_wxGridHeaderLabelsRenderer(void *sipCppV, int sipState)
166 {
167     Py_BEGIN_ALLOW_THREADS
168 
169     if (sipState & SIP_DERIVED_CLASS)
170         delete reinterpret_cast<sipwxGridHeaderLabelsRenderer *>(sipCppV);
171     else
172         delete reinterpret_cast< ::wxGridHeaderLabelsRenderer *>(sipCppV);
173 
174     Py_END_ALLOW_THREADS
175 }
176 
177 
178 extern "C" {static void dealloc_wxGridHeaderLabelsRenderer(sipSimpleWrapper *);}
dealloc_wxGridHeaderLabelsRenderer(sipSimpleWrapper * sipSelf)179 static void dealloc_wxGridHeaderLabelsRenderer(sipSimpleWrapper *sipSelf)
180 {
181     if (sipIsDerivedClass(sipSelf))
182         reinterpret_cast<sipwxGridHeaderLabelsRenderer *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
183 
184     if (sipIsOwnedByPython(sipSelf))
185     {
186         release_wxGridHeaderLabelsRenderer(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
187     }
188 }
189 
190 
191 extern "C" {static void *init_type_wxGridHeaderLabelsRenderer(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxGridHeaderLabelsRenderer(sipSimpleWrapper * sipSelf,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)192 static void *init_type_wxGridHeaderLabelsRenderer(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
193 {
194     sipwxGridHeaderLabelsRenderer *sipCpp = SIP_NULLPTR;
195 
196     {
197         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
198         {
199             Py_BEGIN_ALLOW_THREADS
200             sipCpp = new sipwxGridHeaderLabelsRenderer();
201             Py_END_ALLOW_THREADS
202 
203             sipCpp->sipPySelf = sipSelf;
204 
205             return sipCpp;
206         }
207     }
208 
209     {
210         const  ::wxGridHeaderLabelsRenderer* a0;
211 
212         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxGridHeaderLabelsRenderer, &a0))
213         {
214             Py_BEGIN_ALLOW_THREADS
215             sipCpp = new sipwxGridHeaderLabelsRenderer(*a0);
216             Py_END_ALLOW_THREADS
217 
218             sipCpp->sipPySelf = sipSelf;
219 
220             return sipCpp;
221         }
222     }
223 
224     return SIP_NULLPTR;
225 }
226 
227 
228 /* Define this type's super-types. */
229 static sipEncodedTypeDef supers_wxGridHeaderLabelsRenderer[] = {{28, 255, 1}};
230 
231 
232 static PyMethodDef methods_wxGridHeaderLabelsRenderer[] = {
233     {SIP_MLNAME_CAST(sipName_DrawLabel), SIP_MLMETH_CAST(meth_wxGridHeaderLabelsRenderer_DrawLabel), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridHeaderLabelsRenderer_DrawLabel)}
234 };
235 
236 PyDoc_STRVAR(doc_wxGridHeaderLabelsRenderer, "Common base class for row and column headers renderers.");
237 
238 
239 sipClassTypeDef sipTypeDef__grid_wxGridHeaderLabelsRenderer = {
240     {
241         -1,
242         SIP_NULLPTR,
243         SIP_NULLPTR,
244         SIP_TYPE_ABSTRACT|SIP_TYPE_CLASS,
245         sipNameNr_wxGridHeaderLabelsRenderer,
246         {SIP_NULLPTR},
247         SIP_NULLPTR
248     },
249     {
250         sipNameNr_GridHeaderLabelsRenderer,
251         {0, 0, 1},
252         1, methods_wxGridHeaderLabelsRenderer,
253         0, SIP_NULLPTR,
254         0, SIP_NULLPTR,
255         {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
256     },
257     doc_wxGridHeaderLabelsRenderer,
258     -1,
259     -1,
260     supers_wxGridHeaderLabelsRenderer,
261     SIP_NULLPTR,
262     init_type_wxGridHeaderLabelsRenderer,
263     SIP_NULLPTR,
264     SIP_NULLPTR,
265 #if PY_MAJOR_VERSION >= 3
266     SIP_NULLPTR,
267     SIP_NULLPTR,
268 #else
269     SIP_NULLPTR,
270     SIP_NULLPTR,
271     SIP_NULLPTR,
272     SIP_NULLPTR,
273 #endif
274     dealloc_wxGridHeaderLabelsRenderer,
275     SIP_NULLPTR,
276     SIP_NULLPTR,
277     SIP_NULLPTR,
278     release_wxGridHeaderLabelsRenderer,
279     cast_wxGridHeaderLabelsRenderer,
280     SIP_NULLPTR,
281     SIP_NULLPTR,
282     SIP_NULLPTR,
283     SIP_NULLPTR,
284     SIP_NULLPTR,
285     SIP_NULLPTR
286 };
287