]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/pen.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
22 wxPenRefData::wxPenRefData()
26 m_join
= wxJOIN_ROUND
;
32 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
35 m_style
= data
.m_style
;
36 m_width
= data
.m_width
;
39 m_nbDash
= data
.m_nbDash
;
41 m_colour
= data
.m_colour
;
44 wxPenRefData::~wxPenRefData()
58 // Should implement Create
59 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
61 m_refData
= new wxPenRefData
;
63 M_PENDATA
->m_colour
= col
;
64 M_PENDATA
->m_width
= Width
;
65 M_PENDATA
->m_style
= Style
;
66 M_PENDATA
->m_join
= wxJOIN_ROUND
;
67 M_PENDATA
->m_cap
= wxCAP_ROUND
;
68 M_PENDATA
->m_nbDash
= 0 ;
69 M_PENDATA
->m_dash
= 0 ;
74 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
76 m_refData
= new wxPenRefData
;
78 M_PENDATA
->m_stipple
= stipple
;
79 M_PENDATA
->m_width
= Width
;
80 M_PENDATA
->m_style
= wxSTIPPLE
;
81 M_PENDATA
->m_join
= wxJOIN_ROUND
;
82 M_PENDATA
->m_cap
= wxCAP_ROUND
;
83 M_PENDATA
->m_nbDash
= 0 ;
84 M_PENDATA
->m_dash
= 0 ;
91 // Don't change shared data
94 m_refData
= new wxPenRefData();
98 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
104 void wxPen::SetColour(const wxColour
& col
)
108 M_PENDATA
->m_colour
= col
;
113 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
117 M_PENDATA
->m_colour
.Set(r
, g
, b
);
122 void wxPen::SetWidth(int Width
)
126 M_PENDATA
->m_width
= Width
;
131 void wxPen::SetStyle(int Style
)
135 M_PENDATA
->m_style
= Style
;
140 void wxPen::SetStipple(const wxBitmap
& Stipple
)
144 M_PENDATA
->m_stipple
= Stipple
;
145 M_PENDATA
->m_style
= wxSTIPPLE
;
150 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
154 M_PENDATA
->m_nbDash
= nb_dashes
;
155 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
160 void wxPen::SetJoin(int Join
)
164 M_PENDATA
->m_join
= Join
;
169 void wxPen::SetCap(int Cap
)
173 M_PENDATA
->m_cap
= Cap
;
178 bool wxPen::RealizeResource()
180 // nothing to do here for mac