]>
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 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
17 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
19 wxPenRefData::wxPenRefData()
23 m_join
= wxJOIN_ROUND
;
29 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
32 m_style
= data
.m_style
;
33 m_width
= data
.m_width
;
36 m_nbDash
= data
.m_nbDash
;
38 m_colour
= data
.m_colour
;
41 wxPenRefData::~wxPenRefData()
55 // Should implement Create
56 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
58 m_refData
= new wxPenRefData
;
60 M_PENDATA
->m_colour
= col
;
61 M_PENDATA
->m_width
= Width
;
62 M_PENDATA
->m_style
= Style
;
63 M_PENDATA
->m_join
= wxJOIN_ROUND
;
64 M_PENDATA
->m_cap
= wxCAP_ROUND
;
65 M_PENDATA
->m_nbDash
= 0 ;
66 M_PENDATA
->m_dash
= 0 ;
71 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
73 m_refData
= new wxPenRefData
;
75 M_PENDATA
->m_stipple
= stipple
;
76 M_PENDATA
->m_width
= Width
;
77 M_PENDATA
->m_style
= wxSTIPPLE
;
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 ;
88 // Don't change shared data
91 m_refData
= new wxPenRefData();
95 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
101 void wxPen::SetColour(const wxColour
& col
)
105 M_PENDATA
->m_colour
= col
;
110 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
114 M_PENDATA
->m_colour
.Set(r
, g
, b
);
119 void wxPen::SetWidth(int Width
)
123 M_PENDATA
->m_width
= Width
;
128 void wxPen::SetStyle(int Style
)
132 M_PENDATA
->m_style
= Style
;
137 void wxPen::SetStipple(const wxBitmap
& Stipple
)
141 M_PENDATA
->m_stipple
= Stipple
;
142 M_PENDATA
->m_style
= wxSTIPPLE
;
147 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
151 M_PENDATA
->m_nbDash
= nb_dashes
;
152 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
157 void wxPen::SetJoin(int Join
)
161 M_PENDATA
->m_join
= Join
;
166 void wxPen::SetCap(int Cap
)
170 M_PENDATA
->m_cap
= Cap
;
175 bool wxPen::RealizeResource()
177 // nothing to do here for mac