]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
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
;
37 wxPenRefData::wxPenRefData(const wxPenRefData
& data
)
39 m_style
= data
.m_style
;
40 m_width
= data
.m_width
;
43 m_nbDash
= data
.m_nbDash
;
45 m_colour
= data
.m_colour
;
51 wxPenRefData::~wxPenRefData()
61 wxThePenList
->AddPen(this);
67 wxThePenList
->RemovePen(this);
70 // Should implement Create
71 wxPen::wxPen(const wxColour
& col
, int Width
, int Style
)
73 m_refData
= new wxPenRefData
;
75 M_PENDATA
->m_colour
= col
;
76 M_PENDATA
->m_width
= Width
;
77 M_PENDATA
->m_style
= Style
;
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 ;
86 wxThePenList
->AddPen(this);
89 wxPen::wxPen(const wxBitmap
& stipple
, int Width
)
91 m_refData
= new wxPenRefData
;
93 M_PENDATA
->m_stipple
= stipple
;
94 M_PENDATA
->m_width
= Width
;
95 M_PENDATA
->m_style
= wxSTIPPLE
;
96 M_PENDATA
->m_join
= wxJOIN_ROUND
;
97 M_PENDATA
->m_cap
= wxCAP_ROUND
;
98 M_PENDATA
->m_nbDash
= 0 ;
99 M_PENDATA
->m_dash
= 0 ;
104 wxThePenList
->AddPen(this);
107 wxPen::wxPen(const wxString
& col
, int Width
, int Style
)
109 m_refData
= new wxPenRefData
;
111 M_PENDATA
->m_colour
= col
;
112 M_PENDATA
->m_width
= Width
;
113 M_PENDATA
->m_style
= Style
;
114 M_PENDATA
->m_join
= wxJOIN_ROUND
;
115 M_PENDATA
->m_cap
= wxCAP_ROUND
;
116 M_PENDATA
->m_nbDash
= 0 ;
117 M_PENDATA
->m_dash
= 0 ;
122 wxThePenList
->AddPen(this);
125 void wxPen::Unshare()
127 // Don't change shared data
130 m_refData
= new wxPenRefData();
134 wxPenRefData
* ref
= new wxPenRefData(*(wxPenRefData
*)m_refData
);
140 void wxPen::SetColour(const wxColour
& col
)
144 M_PENDATA
->m_colour
= col
;
149 void wxPen::SetColour(const wxString
& col
)
153 M_PENDATA
->m_colour
= col
;
158 void wxPen::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
162 M_PENDATA
->m_colour
.Set(r
, g
, b
);
167 void wxPen::SetWidth(int Width
)
171 M_PENDATA
->m_width
= Width
;
176 void wxPen::SetStyle(int Style
)
180 M_PENDATA
->m_style
= Style
;
185 void wxPen::SetStipple(const wxBitmap
& Stipple
)
189 M_PENDATA
->m_stipple
= Stipple
;
190 M_PENDATA
->m_style
= wxSTIPPLE
;
195 void wxPen::SetDashes(int nb_dashes
, const wxDash
*Dash
)
199 M_PENDATA
->m_nbDash
= nb_dashes
;
200 M_PENDATA
->m_dash
= (wxDash
*)Dash
;
205 void wxPen::SetJoin(int Join
)
209 M_PENDATA
->m_join
= Join
;
214 void wxPen::SetCap(int Cap
)
218 M_PENDATA
->m_cap
= Cap
;
223 bool wxPen::RealizeResource()
225 // TODO: create actual pen