]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/pen.cpp
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()
57 // Should implement Create
58 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
60 m_refData
= new wxPenRefData
;
62 M_PENDATA
->m_colour
= col
;
63 M_PENDATA
->m_width
= Width
;
64 M_PENDATA
->m_style
= Style
;
65 M_PENDATA
->m_join
= wxJOIN_ROUND
;
66 M_PENDATA
->m_cap
= wxCAP_ROUND
;
67 M_PENDATA
->m_nbDash
= 0 ;
68 M_PENDATA
->m_dash
= (wxMOTIFDash
*)NULL
;
73 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
75 m_refData
= new wxPenRefData
;
77 M_PENDATA
->m_stipple
= stipple
;
78 M_PENDATA
->m_width
= Width
;
79 M_PENDATA
->m_style
= wxSTIPPLE
;
80 M_PENDATA
->m_join
= wxJOIN_ROUND
;
81 M_PENDATA
->m_cap
= wxCAP_ROUND
;
82 M_PENDATA
->m_nbDash
= 0 ;
83 M_PENDATA
->m_dash
= (wxMOTIFDash
*)NULL
;
90 // Don't change shared data
93 m_refData
= new wxPenRefData();
97 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
103 void wxPen::SetColour(const wxColour
& col
)
107 M_PENDATA
->m_colour
= col
;
112 void wxPen::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
116 M_PENDATA
->m_colour
.Set(r
, g
, b
);
121 void wxPen::SetWidth(int Width
)
125 M_PENDATA
->m_width
= Width
;
130 void wxPen::SetStyle(int Style
)
134 M_PENDATA
->m_style
= Style
;
139 void wxPen::SetStipple(const wxBitmap
& Stipple
)
143 M_PENDATA
->m_stipple
= Stipple
;
144 M_PENDATA
->m_style
= wxSTIPPLE
;
149 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
153 M_PENDATA
->m_nbDash
= nb_dashes
;
154 M_PENDATA
->m_dash
= (wxMOTIFDash
*)Dash
;
159 void wxPen::SetJoin(int Join
)
163 M_PENDATA
->m_join
= Join
;
168 void wxPen::SetCap(int Cap
)
172 M_PENDATA
->m_cap
= Cap
;
177 bool wxPen::RealizeResource()
179 // Nothing more to do