1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13enum wxPenStyle
14{
15    wxPENSTYLE_INVALID,
16    wxPENSTYLE_SOLID,
17    wxPENSTYLE_DOT,
18    wxPENSTYLE_LONG_DASH,
19    wxPENSTYLE_SHORT_DASH,
20    wxPENSTYLE_DOT_DASH,
21    wxPENSTYLE_USER_DASH,
22    wxPENSTYLE_TRANSPARENT,
23    wxPENSTYLE_STIPPLE_MASK_OPAQUE,
24    wxPENSTYLE_STIPPLE_MASK,
25    wxPENSTYLE_STIPPLE,
26    wxPENSTYLE_BDIAGONAL_HATCH,
27    wxPENSTYLE_CROSSDIAG_HATCH,
28    wxPENSTYLE_FDIAGONAL_HATCH,
29    wxPENSTYLE_CROSS_HATCH,
30    wxPENSTYLE_HORIZONTAL_HATCH,
31    wxPENSTYLE_VERTICAL_HATCH,
32    wxPENSTYLE_FIRST_HATCH,
33    wxPENSTYLE_LAST_HATCH
34};
35
36enum wxPenJoin
37{
38    wxJOIN_INVALID,
39    wxJOIN_BEVEL,
40    wxJOIN_MITER,
41    wxJOIN_ROUND
42};
43
44enum wxPenCap
45{
46    wxCAP_INVALID,
47    wxCAP_ROUND,
48    wxCAP_PROJECTING,
49    wxCAP_BUTT
50};
51
52class wxPen : wxGDIObject
53{
54    %Docstring
55        Pen()
56        Pen(colour, width=1, style=PENSTYLE_SOLID)
57        Pen(pen)
58
59        A pen is a drawing tool for drawing outlines.
60    %End
61    %TypeHeaderCode
62        #include <wx/pen.h>
63    %End
64
65    %TypeHeaderCode
66        #include "arrayholder.h"
67    %End
68public:
69    wxPen();
70
71    wxPen(
72        const wxColour & colour,
73        int width = 1,
74        wxPenStyle style = wxPENSTYLE_SOLID
75    );
76    %PreMethodCode
77        if (!wxPyCheckForApp()) return NULL;
78    %End
79
80    wxPen(
81        const wxPen & pen
82    );
83    %PreMethodCode
84        if (!wxPyCheckForApp()) return NULL;
85    %End
86
87    ~wxPen();
88
89    void SetColour(
90        wxColour & colour
91    );
92    %Docstring
93        SetColour(colour)
94        SetColour(red, green, blue)
95
96        The pen's colour is changed to the given colour.
97    %End
98
99    void SetColour(
100        unsigned char red,
101        unsigned char green,
102        unsigned char blue
103    );
104
105    wxPenCap GetCap() const;
106    %Docstring
107        GetCap() -> PenCap
108
109        Returns the pen cap style, which may be one of wxCAP_ROUND,
110        wxCAP_PROJECTING and wxCAP_BUTT.
111    %End
112
113    wxColour GetColour() const;
114    %Docstring
115        GetColour() -> Colour
116
117        Returns a reference to the pen colour.
118    %End
119
120    wxArrayInt* GetDashes(
121    ) const   /Factory/;
122    %Docstring
123        GetDashes() -> ArrayInt
124
125        Gets an array of dashes (defined as char in X, DWORD under Windows).
126    %End
127    %MethodCode
128        PyErr_Clear();
129        Py_BEGIN_ALLOW_THREADS
130        sipRes = _wxPen_GetDashes(sipCpp);
131        Py_END_ALLOW_THREADS
132        if (PyErr_Occurred()) sipIsErr = 1;
133    %End
134    %TypeCode
135    wxArrayInt* _wxPen_GetDashes(const wxPen* self)
136    {
137        wxArrayInt* arr = new wxArrayInt;
138        wxDash* dashes;
139        int num = self->GetDashes(&dashes);
140        for (int i=0; i<num; i++)
141            arr->Add(dashes[i]);
142        return arr;
143    }
144    %End
145
146    wxPenJoin GetJoin() const;
147    %Docstring
148        GetJoin() -> PenJoin
149
150        Returns the pen join style, which may be one of wxJOIN_BEVEL,
151        wxJOIN_ROUND and wxJOIN_MITER.
152    %End
153
154    wxBitmap * GetStipple() const;
155    %Docstring
156        GetStipple() -> Bitmap
157
158        Gets a pointer to the stipple bitmap.
159    %End
160
161    wxPenStyle GetStyle() const;
162    %Docstring
163        GetStyle() -> PenStyle
164
165        Returns the pen style.
166    %End
167
168    int GetWidth() const;
169    %Docstring
170        GetWidth() -> int
171
172        Returns the pen width.
173    %End
174
175    bool IsOk() const;
176    %Docstring
177        IsOk() -> bool
178
179        Returns true if the pen is initialised.
180    %End
181
182    bool IsNonTransparent() const;
183    %Docstring
184        IsNonTransparent() -> bool
185
186        Returns true if the pen is a valid non-transparent pen.
187    %End
188
189    bool IsTransparent() const;
190    %Docstring
191        IsTransparent() -> bool
192
193        Returns true if the pen is transparent.
194    %End
195
196    void SetCap(
197        wxPenCap capStyle
198    );
199    %Docstring
200        SetCap(capStyle)
201
202        Sets the pen cap style, which may be one of wxCAP_ROUND,
203        wxCAP_PROJECTING and wxCAP_BUTT.
204    %End
205
206    void SetDashes(
207        const wxArrayInt& dashes
208    );
209    %Docstring
210        SetDashes(dashes)
211
212        Associates an array of dash values (defined as char in X, DWORD under
213        Windows) with the pen.
214    %End
215    %MethodCode
216        size_t len = dashes->GetCount();
217        wxDashCArrayHolder* holder = new wxDashCArrayHolder;
218        holder->m_array = new wxDash[len];
219        for (int idx=0; idx<len; idx+=1) {
220            holder->m_array[idx] = (*dashes)[idx];
221        }
222        // Make a PyObject for the holder, and transfer its ownership to self.
223        PyObject* pyHolder = sipConvertFromNewType(
224                (void*)holder, sipType_wxDashCArrayHolder, (PyObject*)sipSelf);
225        Py_DECREF(pyHolder);
226        sipCpp->SetDashes(len, holder->m_array);
227    %End
228
229    void SetJoin(
230        wxPenJoin join_style
231    );
232    %Docstring
233        SetJoin(join_style)
234
235        Sets the pen join style, which may be one of wxJOIN_BEVEL,
236        wxJOIN_ROUND and wxJOIN_MITER.
237    %End
238
239    void SetStipple(
240        const wxBitmap & stipple
241    );
242    %Docstring
243        SetStipple(stipple)
244
245        Sets the bitmap for stippling.
246    %End
247
248    void SetStyle(
249        wxPenStyle style
250    );
251    %Docstring
252        SetStyle(style)
253
254        Set the pen style.
255    %End
256
257    void SetWidth(
258        int width
259    );
260    %Docstring
261        SetWidth(width)
262
263        Sets the pen width.
264    %End
265
266    bool operator!=(
267        const wxPen & pen
268    ) const;
269
270    bool operator==(
271        const wxPen & pen
272    ) const;
273
274    public:
275
276
277    %Property(name=Cap, get=GetCap, set=SetCap)
278    %Property(name=Colour, get=GetColour, set=SetColour)
279    %Property(name=Dashes, get=GetDashes, set=SetDashes)
280    %Property(name=Join, get=GetJoin, set=SetJoin)
281    %Property(name=Stipple, get=GetStipple, set=SetStipple)
282    %Property(name=Style, get=GetStyle, set=SetStyle)
283    %Property(name=Width, get=GetWidth, set=SetWidth)
284    void _copyFrom(const wxPen* other);
285    %Docstring
286        _copyFrom(other)
287
288        For internal use only.
289    %End
290    %MethodCode
291        PyErr_Clear();
292        Py_BEGIN_ALLOW_THREADS
293        _wxPen__copyFrom(sipCpp, other);
294        Py_END_ALLOW_THREADS
295        if (PyErr_Occurred()) sipIsErr = 1;
296    %End
297    %TypeCode
298    void _wxPen__copyFrom(wxPen* self, const wxPen* other)
299    {
300        *self = *other;
301    }
302    %End
303
304};  // end of class wxPen
305
306
307class wxPenList
308{
309    %Docstring
310        PenList()
311
312        There is only one instance of this class: wxThePenList.
313    %End
314    %TypeHeaderCode
315        #include <wx/pen.h>
316    %End
317
318public:
319    wxPenList();
320
321    wxPen * FindOrCreatePen(
322        const wxColour & colour,
323        int width = 1,
324        wxPenStyle style = wxPENSTYLE_SOLID
325    );
326    %Docstring
327        FindOrCreatePen(colour, width=1, style=PENSTYLE_SOLID) -> Pen
328
329        Finds a pen with the specified attributes and returns it, else creates
330        a new pen, adds it to the pen list, and returns it.
331    %End
332
333};  // end of class wxPenList
334
335
336wxPen wxNullPen;
337
338%Extract(id=pycode_core)
339# These stock pens will be initialized when the wx.App object is created.
340RED_PEN = Pen()
341BLUE_PEN = Pen()
342CYAN_PEN = Pen()
343GREEN_PEN = Pen()
344YELLOW_PEN = Pen()
345BLACK_PEN = Pen()
346WHITE_PEN = Pen()
347TRANSPARENT_PEN = Pen()
348BLACK_DASHED_PEN = Pen()
349GREY_PEN = Pen()
350MEDIUM_GREY_PEN = Pen()
351LIGHT_GREY_PEN = Pen()
352
353%End
354
355%Extract(id=pycode_core)
356wx.SOLID       = int(wx.PENSTYLE_SOLID)
357wx.DOT         = int(wx.PENSTYLE_DOT)
358wx.LONG_DASH   = int(wx.PENSTYLE_LONG_DASH)
359wx.SHORT_DASH  = int(wx.PENSTYLE_SHORT_DASH)
360wx.DOT_DASH    = int(wx.PENSTYLE_DOT_DASH)
361wx.USER_DASH   = int(wx.PENSTYLE_USER_DASH)
362wx.TRANSPARENT = int(wx.PENSTYLE_TRANSPARENT)
363
364%End
365
366
367//---------------------------------------------------------------------------
368
369