1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "pen.h"
20 #if !USE_SHARED_LIBRARIES
21 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
24 wxPenRefData::wxPenRefData()
28 m_join
= wxJOIN_ROUND
;
34 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
36 m_style
= data
.m_style
;
37 m_width
= data
.m_width
;
40 m_nbDash
= data
.m_nbDash
;
42 m_colour
= data
.m_colour
;
45 wxPenRefData::~wxPenRefData()
54 wxThePenList
->AddPen(this);
60 wxThePenList
->RemovePen(this);
63 // Should implement Create
64 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
66 m_refData
= new wxPenRefData
;
68 M_PENDATA
->m_colour
= col
;
69 M_PENDATA
->m_width
= Width
;
70 M_PENDATA
->m_style
= Style
;
71 M_PENDATA
->m_join
= wxJOIN_ROUND
;
72 M_PENDATA
->m_cap
= wxCAP_ROUND
;
73 M_PENDATA
->m_nbDash
= 0 ;
74 M_PENDATA
->m_dash
= 0 ;
79 wxThePenList
->AddPen(this);
82 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
84 m_refData
= new wxPenRefData
;
86 M_PENDATA
->m_stipple
= stipple
;
87 M_PENDATA
->m_width
= Width
;
88 M_PENDATA
->m_style
= wxSTIPPLE
;
89 M_PENDATA
->m_join
= wxJOIN_ROUND
;
90 M_PENDATA
->m_cap
= wxCAP_ROUND
;
91 M_PENDATA
->m_nbDash
= 0 ;
92 M_PENDATA
->m_dash
= 0 ;
97 wxThePenList
->AddPen(this);
100 void wxPen::Unshare()
102 // Don't change shared data
105 m_refData
= new wxPenRefData();
109 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
115 void wxPen::SetColour(const wxColour
& col
)
119 M_PENDATA
->m_colour
= col
;
124 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
128 M_PENDATA
->m_colour
.Set(r
, g
, b
);
133 void wxPen::SetWidth(int Width
)
137 M_PENDATA
->m_width
= Width
;
142 void wxPen::SetStyle(int Style
)
146 M_PENDATA
->m_style
= Style
;
151 void wxPen::SetStipple(const wxBitmap
& Stipple
)
155 M_PENDATA
->m_stipple
= Stipple
;
156 M_PENDATA
->m_style
= wxSTIPPLE
;
161 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
165 M_PENDATA
->m_nbDash
= nb_dashes
;
166 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
171 void wxPen::SetJoin(int Join
)
175 M_PENDATA
->m_join
= Join
;
180 void wxPen::SetCap(int Cap
)
184 M_PENDATA
->m_cap
= Cap
;
189 bool wxPen::RealizeResource()
191 // nothing to do here for mac