]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "pen.h"
16 #include "wx/wxprec.h"
21 #if !USE_SHARED_LIBRARIES
22 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
25 wxPenRefData::wxPenRefData()
29 m_join
= wxJOIN_ROUND
;
35 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
38 m_style
= data
.m_style
;
39 m_width
= data
.m_width
;
42 m_nbDash
= data
.m_nbDash
;
44 m_colour
= data
.m_colour
;
47 wxPenRefData::~wxPenRefData()
61 // Should implement Create
62 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
64 m_refData
= new wxPenRefData
;
66 M_PENDATA
->m_colour
= col
;
67 M_PENDATA
->m_width
= Width
;
68 M_PENDATA
->m_style
= Style
;
69 M_PENDATA
->m_join
= wxJOIN_ROUND
;
70 M_PENDATA
->m_cap
= wxCAP_ROUND
;
71 M_PENDATA
->m_nbDash
= 0 ;
72 M_PENDATA
->m_dash
= 0 ;
77 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
79 m_refData
= new wxPenRefData
;
81 M_PENDATA
->m_stipple
= stipple
;
82 M_PENDATA
->m_width
= Width
;
83 M_PENDATA
->m_style
= wxSTIPPLE
;
84 M_PENDATA
->m_join
= wxJOIN_ROUND
;
85 M_PENDATA
->m_cap
= wxCAP_ROUND
;
86 M_PENDATA
->m_nbDash
= 0 ;
87 M_PENDATA
->m_dash
= 0 ;
94 // Don't change shared data
97 m_refData
= new wxPenRefData();
101 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
107 void wxPen::SetColour(const wxColour
& col
)
111 M_PENDATA
->m_colour
= col
;
116 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
120 M_PENDATA
->m_colour
.Set(r
, g
, b
);
125 void wxPen::SetWidth(int Width
)
129 M_PENDATA
->m_width
= Width
;
134 void wxPen::SetStyle(int Style
)
138 M_PENDATA
->m_style
= Style
;
143 void wxPen::SetStipple(const wxBitmap
& Stipple
)
147 M_PENDATA
->m_stipple
= Stipple
;
148 M_PENDATA
->m_style
= wxSTIPPLE
;
153 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
157 M_PENDATA
->m_nbDash
= nb_dashes
;
158 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
163 void wxPen::SetJoin(int Join
)
167 M_PENDATA
->m_join
= Join
;
172 void wxPen::SetCap(int Cap
)
176 M_PENDATA
->m_cap
= Cap
;
181 bool wxPen::RealizeResource()
183 // nothing to do here for mac