]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/pen.cpp
1e3ced2a3a484c777157da7da10c70737831a760
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
;
37 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
39 m_style
= data
.m_style
;
40 m_width
= data
.m_width
;
43 m_nbDash
= data
.m_nbDash
;
45 m_colour
= data
.m_colour
;
51 wxPenRefData::~wxPenRefData()
61 wxThePenList
->AddPen(this);
67 wxThePenList
->RemovePen(this);
70 // Should implement Create
71 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
73 m_refData
= new wxPenRefData
;
75 M_PENDATA
->m_colour
= col
;
76 M_PENDATA
->m_width
= Width
;
77 M_PENDATA
->m_style
= Style
;
78 M_PENDATA
->m_join
= wxJOIN_ROUND
;
79 M_PENDATA
->m_cap
= wxCAP_ROUND
;
80 M_PENDATA
->m_nbDash
= 0 ;
81 M_PENDATA
->m_dash
= 0 ;
86 wxThePenList
->AddPen(this);
89 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
91 m_refData
= new wxPenRefData
;
93 M_PENDATA
->m_stipple
= stipple
;
94 M_PENDATA
->m_width
= Width
;
95 M_PENDATA
->m_style
= wxSTIPPLE
;
96 M_PENDATA
->m_join
= wxJOIN_ROUND
;
97 M_PENDATA
->m_cap
= wxCAP_ROUND
;
98 M_PENDATA
->m_nbDash
= 0 ;
99 M_PENDATA
->m_dash
= 0 ;
104 wxThePenList
->AddPen(this);
107 void wxPen::Unshare()
109 // Don't change shared data
112 m_refData
= new wxPenRefData();
116 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
122 void wxPen::SetColour(const wxColour
& col
)
126 M_PENDATA
->m_colour
= col
;
131 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
135 M_PENDATA
->m_colour
.Set(r
, g
, b
);
140 void wxPen::SetWidth(int Width
)
144 M_PENDATA
->m_width
= Width
;
149 void wxPen::SetStyle(int Style
)
153 M_PENDATA
->m_style
= Style
;
158 void wxPen::SetStipple(const wxBitmap
& Stipple
)
162 M_PENDATA
->m_stipple
= Stipple
;
163 M_PENDATA
->m_style
= wxSTIPPLE
;
168 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
172 M_PENDATA
->m_nbDash
= nb_dashes
;
173 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
178 void wxPen::SetJoin(int Join
)
182 M_PENDATA
->m_join
= Join
;
187 void wxPen::SetCap(int Cap
)
191 M_PENDATA
->m_cap
= Cap
;
196 bool wxPen::RealizeResource()
198 // TODO: create actual pen