]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
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
;
34 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
36 m_style
= data
.m_style
;
37 m_width
= data
.m_width
;
40 m_nbDash
= data
.m_nbDash
;
42 m_colour
= data
.m_colour
;
45 wxPenRefData::~wxPenRefData()
54 wxThePenList
->AddPen(this);
60 wxThePenList
->RemovePen(this);
63 // Should implement Create
64 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
66 m_refData
= new wxPenRefData
;
68 M_PENDATA
->m_colour
= col
;
69 M_PENDATA
->m_width
= Width
;
70 M_PENDATA
->m_style
= Style
;
71 M_PENDATA
->m_join
= wxJOIN_ROUND
;
72 M_PENDATA
->m_cap
= wxCAP_ROUND
;
73 M_PENDATA
->m_nbDash
= 0 ;
74 M_PENDATA
->m_dash
= 0 ;
79 wxThePenList
->AddPen(this);
82 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
84 m_refData
= new wxPenRefData
;
86 M_PENDATA
->m_stipple
= stipple
;
87 M_PENDATA
->m_width
= Width
;
88 M_PENDATA
->m_style
= wxSTIPPLE
;
89 M_PENDATA
->m_join
= wxJOIN_ROUND
;
90 M_PENDATA
->m_cap
= wxCAP_ROUND
;
91 M_PENDATA
->m_nbDash
= 0 ;
92 M_PENDATA
->m_dash
= 0 ;
97 wxThePenList
->AddPen(this);
100 wxPen::wxPen(const wxString
& col
, int Width
, int Style
)
102 m_refData
= new wxPenRefData
;
104 M_PENDATA
->m_colour
= col
;
105 M_PENDATA
->m_width
= Width
;
106 M_PENDATA
->m_style
= Style
;
107 M_PENDATA
->m_join
= wxJOIN_ROUND
;
108 M_PENDATA
->m_cap
= wxCAP_ROUND
;
109 M_PENDATA
->m_nbDash
= 0 ;
110 M_PENDATA
->m_dash
= 0 ;
115 wxThePenList
->AddPen(this);
118 void wxPen::Unshare()
120 // Don't change shared data
123 m_refData
= new wxPenRefData();
127 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
133 void wxPen::SetColour(const wxColour
& col
)
137 M_PENDATA
->m_colour
= col
;
142 void wxPen::SetColour(const wxString
& col
)
146 M_PENDATA
->m_colour
= col
;
151 void wxPen::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
155 M_PENDATA
->m_colour
.Set(r
, g
, b
);
160 void wxPen::SetWidth(int Width
)
164 M_PENDATA
->m_width
= Width
;
169 void wxPen::SetStyle(int Style
)
173 M_PENDATA
->m_style
= Style
;
178 void wxPen::SetStipple(const wxBitmap
& Stipple
)
182 M_PENDATA
->m_stipple
= Stipple
;
183 M_PENDATA
->m_style
= wxSTIPPLE
;
188 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
192 M_PENDATA
->m_nbDash
= nb_dashes
;
193 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
198 void wxPen::SetJoin(int Join
)
202 M_PENDATA
->m_join
= Join
;
207 void wxPen::SetCap(int Cap
)
211 M_PENDATA
->m_cap
= Cap
;
216 bool wxPen::RealizeResource()
218 // Nothing more to do