]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/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
;
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
= 0 ;
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
= 0 ;
102 wxThePenList
->AddPen(this);
105 wxPen::wxPen(const wxString
& col
, int Width
, int Style
)
107 m_refData
= new wxPenRefData
;
109 M_PENDATA
->m_colour
= col
;
110 M_PENDATA
->m_width
= Width
;
111 M_PENDATA
->m_style
= Style
;
112 M_PENDATA
->m_join
= wxJOIN_ROUND
;
113 M_PENDATA
->m_cap
= wxCAP_ROUND
;
114 M_PENDATA
->m_nbDash
= 0 ;
115 M_PENDATA
->m_dash
= 0 ;
120 wxThePenList
->AddPen(this);
123 void wxPen::Unshare()
125 // Don't change shared data
128 m_refData
= new wxPenRefData();
132 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
138 void wxPen::SetColour(const wxColour
& col
)
142 M_PENDATA
->m_colour
= col
;
147 void wxPen::SetColour(const wxString
& col
)
151 M_PENDATA
->m_colour
= col
;
156 void wxPen::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
160 M_PENDATA
->m_colour
.Set(r
, g
, b
);
165 void wxPen::SetWidth(int Width
)
169 M_PENDATA
->m_width
= Width
;
174 void wxPen::SetStyle(int Style
)
178 M_PENDATA
->m_style
= Style
;
183 void wxPen::SetStipple(const wxBitmap
& Stipple
)
187 M_PENDATA
->m_stipple
= Stipple
;
188 M_PENDATA
->m_style
= wxSTIPPLE
;
193 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
197 M_PENDATA
->m_nbDash
= nb_dashes
;
198 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
203 void wxPen::SetJoin(int Join
)
207 M_PENDATA
->m_join
= Join
;
212 void wxPen::SetCap(int Cap
)
216 M_PENDATA
->m_cap
= Cap
;
221 bool wxPen::RealizeResource()
223 // TODO: create actual pen