]>
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 IMPLEMENT_DYNAMIC_CLASS(wxPen
, wxGDIObject
)
22 wxPenRefData::wxPenRefData()
26 m_join
= wxJOIN_ROUND
;
29 m_dash
= (wxMOTIFDash
*)NULL
;
32 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
34 m_style
= data
.m_style
;
35 m_width
= data
.m_width
;
38 m_nbDash
= data
.m_nbDash
;
40 m_colour
= data
.m_colour
;
43 wxPenRefData::~wxPenRefData()
52 wxThePenList
->AddPen(this);
58 wxThePenList
->RemovePen(this);
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
= (wxMOTIFDash
*)NULL
;
77 wxThePenList
->AddPen(this);
80 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
82 m_refData
= new wxPenRefData
;
84 M_PENDATA
->m_stipple
= stipple
;
85 M_PENDATA
->m_width
= Width
;
86 M_PENDATA
->m_style
= wxSTIPPLE
;
87 M_PENDATA
->m_join
= wxJOIN_ROUND
;
88 M_PENDATA
->m_cap
= wxCAP_ROUND
;
89 M_PENDATA
->m_nbDash
= 0 ;
90 M_PENDATA
->m_dash
= (wxMOTIFDash
*)NULL
;
95 wxThePenList
->AddPen(this);
100 // Don't change shared data
103 m_refData
= new wxPenRefData();
107 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
113 void wxPen::SetColour(const wxColour
& col
)
117 M_PENDATA
->m_colour
= col
;
122 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
126 M_PENDATA
->m_colour
.Set(r
, g
, b
);
131 void wxPen::SetWidth(int Width
)
135 M_PENDATA
->m_width
= Width
;
140 void wxPen::SetStyle(int Style
)
144 M_PENDATA
->m_style
= Style
;
149 void wxPen::SetStipple(const wxBitmap
& Stipple
)
153 M_PENDATA
->m_stipple
= Stipple
;
154 M_PENDATA
->m_style
= wxSTIPPLE
;
159 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
163 M_PENDATA
->m_nbDash
= nb_dashes
;
164 M_PENDATA
->m_dash
= (wxMOTIFDash
*)Dash
;
169 void wxPen::SetJoin(int Join
)
173 M_PENDATA
->m_join
= Join
;
178 void wxPen::SetCap(int Cap
)
182 M_PENDATA
->m_cap
= Cap
;
187 bool wxPen::RealizeResource()
189 // Nothing more to do