]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/pen.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
18 wxPenRefData::wxPenRefData()
22 m_join
= wxJOIN_ROUND
;
28 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
31 m_style
= data
.m_style
;
32 m_width
= data
.m_width
;
35 m_nbDash
= data
.m_nbDash
;
37 m_colour
= data
.m_colour
;
40 wxPenRefData::~wxPenRefData()
54 // Should implement Create
55 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
57 m_refData
= new wxPenRefData
;
59 M_PENDATA
->m_colour
= col
;
60 M_PENDATA
->m_width
= Width
;
61 M_PENDATA
->m_style
= Style
;
62 M_PENDATA
->m_join
= wxJOIN_ROUND
;
63 M_PENDATA
->m_cap
= wxCAP_ROUND
;
64 M_PENDATA
->m_nbDash
= 0 ;
65 M_PENDATA
->m_dash
= 0 ;
70 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
72 m_refData
= new wxPenRefData
;
74 M_PENDATA
->m_stipple
= stipple
;
75 M_PENDATA
->m_width
= Width
;
76 M_PENDATA
->m_style
= wxSTIPPLE
;
77 M_PENDATA
->m_join
= wxJOIN_ROUND
;
78 M_PENDATA
->m_cap
= wxCAP_ROUND
;
79 M_PENDATA
->m_nbDash
= 0 ;
80 M_PENDATA
->m_dash
= 0 ;
87 // Don't change shared data
90 m_refData
= new wxPenRefData();
94 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
100 void wxPen::SetColour(const wxColour
& col
)
104 M_PENDATA
->m_colour
= col
;
109 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
113 M_PENDATA
->m_colour
.Set(r
, g
, b
);
118 void wxPen::SetWidth(int Width
)
122 M_PENDATA
->m_width
= Width
;
127 void wxPen::SetStyle(int Style
)
131 M_PENDATA
->m_style
= Style
;
136 void wxPen::SetStipple(const wxBitmap
& Stipple
)
140 M_PENDATA
->m_stipple
= Stipple
;
141 M_PENDATA
->m_style
= wxSTIPPLE
;
146 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
150 M_PENDATA
->m_nbDash
= nb_dashes
;
151 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
156 void wxPen::SetJoin(int Join
)
160 M_PENDATA
->m_join
= Join
;
165 void wxPen::SetCap(int Cap
)
169 M_PENDATA
->m_cap
= Cap
;
174 bool wxPen::RealizeResource()
176 // nothing to do here for mac