]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "pen.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
22 wxPenRefData::wxPenRefData()
26 m_join
= wxJOIN_ROUND
;
29 m_dash
= (wxXSTUBXDash
*)NULL
;
35 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
37 m_style
= data
.m_style
;
38 m_width
= data
.m_width
;
41 m_nbDash
= data
.m_nbDash
;
43 m_colour
= data
.m_colour
;
49 wxPenRefData::~wxPenRefData()
59 wxThePenList
->AddPen(this);
65 wxThePenList
->RemovePen(this);
68 // Should implement Create
69 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
71 m_refData
= new wxPenRefData
;
73 M_PENDATA
->m_colour
= col
;
74 M_PENDATA
->m_width
= Width
;
75 M_PENDATA
->m_style
= Style
;
76 M_PENDATA
->m_join
= wxJOIN_ROUND
;
77 M_PENDATA
->m_cap
= wxCAP_ROUND
;
78 M_PENDATA
->m_nbDash
= 0 ;
79 M_PENDATA
->m_dash
= (wxXSTUBXDash
*)NULL
;
84 wxThePenList
->AddPen(this);
87 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
89 m_refData
= new wxPenRefData
;
91 M_PENDATA
->m_stipple
= stipple
;
92 M_PENDATA
->m_width
= Width
;
93 M_PENDATA
->m_style
= wxSTIPPLE
;
94 M_PENDATA
->m_join
= wxJOIN_ROUND
;
95 M_PENDATA
->m_cap
= wxCAP_ROUND
;
96 M_PENDATA
->m_nbDash
= 0 ;
97 M_PENDATA
->m_dash
= (wxXSTUBXDash
*)NULL
;
102 wxThePenList
->AddPen(this);
105 void wxPen::Unshare()
107 // Don't change shared data
110 m_refData
= new wxPenRefData();
114 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
120 void wxPen::SetColour(const wxColour
& col
)
124 M_PENDATA
->m_colour
= col
;
129 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
133 M_PENDATA
->m_colour
.Set(r
, g
, b
);
138 void wxPen::SetWidth(int Width
)
142 M_PENDATA
->m_width
= Width
;
147 void wxPen::SetStyle(int Style
)
151 M_PENDATA
->m_style
= Style
;
156 void wxPen::SetStipple(const wxBitmap
& Stipple
)
160 M_PENDATA
->m_stipple
= Stipple
;
161 M_PENDATA
->m_style
= wxSTIPPLE
;
166 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
170 M_PENDATA
->m_nbDash
= nb_dashes
;
171 M_PENDATA
->m_dash
= (wxXSTUBXDash
*)Dash
;
176 void wxPen::SetJoin(int Join
)
180 M_PENDATA
->m_join
= Join
;
185 void wxPen::SetCap(int Cap
)
189 M_PENDATA
->m_cap
= Cap
;
194 bool wxPen::RealizeResource()
196 // TODO: create actual pen