]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_pen.i
fixed some docstrings
[wxWidgets.git] / wxPython / src / _pen.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _pen.i
3// Purpose: SWIG interface for wxPen
4//
5// Author: Robin Dunn
6//
7// Created: 7-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
18// wxDash is a signed char, byte is unsigned char...
19%typemap(in) (int dashes, wxDash* dashes_array ) {
20 $1 = PyList_Size($input);
21 $2 = (wxDash*)byte_LIST_helper($input);
22 if ($2 == NULL) SWIG_fail;
23}
24%typemap(freearg) (int dashes, wxDash* dashes_array ) {
25 if ($2) delete [] $2;
26}
27
28//---------------------------------------------------------------------------
29%newgroup
30
31
32class wxPen : public wxGDIObject {
33public:
34 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
35 ~wxPen();
36
37 int GetCap();
38 wxColour GetColour();
39 int GetJoin();
40 int GetStyle();
41 int GetWidth();
42
43 bool Ok();
44
45 void SetCap(int cap_style);
46 void SetColour(wxColour& colour);
47 void SetJoin(int join_style);
48 void SetStyle(int style);
49 void SetWidth(int width);
50
51 void SetDashes(int dashes, wxDash* dashes_array);
52 //int GetDashes(wxDash **dashes);
53 %extend {
54 PyObject* GetDashes() {
55 wxDash* dashes;
56 int count = self->GetDashes(&dashes);
57 wxPyBeginBlockThreads();
58 PyObject* retval = PyList_New(0);
59 for (int x=0; x<count; x++)
60 PyList_Append(retval, PyInt_FromLong(dashes[x]));
61 wxPyEndBlockThreads();
62 return retval;
63 }
64 }
b159c5c4 65
22faec7d
RD
66 %extend {
67 bool __eq__(const wxPen* other) { return other ? (*self == *other) : False; }
68 bool __ne__(const wxPen* other) { return other ? (*self != *other) : True; }
69 }
d14a1e28 70
9fd4be55
RD
71#ifndef __WXMAC__
72// wxDash* GetDash() const;
3f0ff538 73 int GetDashCount() const;
9fd4be55
RD
74#endif
75
d14a1e28
RD
76#ifdef __WXMSW__
77 wxBitmap* GetStipple();
78 void SetStipple(wxBitmap& stipple);
79#endif
80
81 %pythoncode { def __nonzero__(self): return self.Ok() }
82};
83
84
85// The list of ints for the dashes needs to exist for the life of the pen
86// so we make it part of the class to save it. See pyclasses.h
87
88%{
89wxPyPen::~wxPyPen()
90{
91 if (m_dash)
92 delete [] m_dash;
93}
94
95void wxPyPen::SetDashes(int nb_dashes, const wxDash *dash)
96{
97 if (m_dash)
98 delete [] m_dash;
99 m_dash = new wxDash[nb_dashes];
100 for (int i=0; i<nb_dashes; i++) {
101 m_dash[i] = dash[i];
102 }
103 wxPen::SetDashes(nb_dashes, m_dash);
104}
105%}
106
107
108class wxPyPen : public wxPen {
109public:
110 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
111 ~wxPyPen();
112
113 void SetDashes(int dashes, wxDash* dashes_array);
114};
115
116// wxPyPen is aliased to wxPen
117%pythoncode { Pen = PyPen };
118
119//---------------------------------------------------------------------------