]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/pen.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "pen.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class wxPenRefData
: public wxObjectRefData
35 wxPenRefData::wxPenRefData(void)
39 m_joinStyle
= wxJOIN_ROUND
;
40 m_capStyle
= wxCAP_ROUND
;
43 //-----------------------------------------------------------------------------
45 #define M_PENDATA ((wxPenRefData *)m_refData)
47 IMPLEMENT_DYNAMIC_CLASS(wxPen
,wxGDIObject
)
51 if (wxThePenList
) wxThePenList
->AddPen( this );
54 wxPen::wxPen( const wxColour
&colour
, int width
, int style
)
56 m_refData
= new wxPenRefData();
57 M_PENDATA
->m_width
= width
;
58 M_PENDATA
->m_style
= style
;
59 M_PENDATA
->m_colour
= colour
;
61 if (wxThePenList
) wxThePenList
->AddPen( this );
64 wxPen::wxPen( const wxString
&colourName
, int width
, int style
)
66 m_refData
= new wxPenRefData();
67 M_PENDATA
->m_width
= width
;
68 M_PENDATA
->m_style
= style
;
69 M_PENDATA
->m_colour
= colourName
;
71 if (wxThePenList
) wxThePenList
->AddPen( this );
74 wxPen::wxPen( const wxPen
& pen
)
77 if (wxThePenList
) wxThePenList
->AddPen( this );
80 wxPen::wxPen( const wxPen
* pen
)
85 if (wxThePenList
) wxThePenList
->AddPen( this );
90 if (wxThePenList
) wxThePenList
->RemovePen( this );
93 wxPen
& wxPen::operator = ( const wxPen
& pen
)
95 if (*this == pen
) return (*this);
100 bool wxPen::operator == ( const wxPen
& pen
)
102 return m_refData
== pen
.m_refData
;
105 bool wxPen::operator != ( const wxPen
& pen
)
107 return m_refData
!= pen
.m_refData
;
110 void wxPen::SetColour( const wxColour
&colour
)
113 m_refData
= new wxPenRefData();
115 M_PENDATA
->m_colour
= colour
;
118 void wxPen::SetColour( const wxString
&colourName
)
121 m_refData
= new wxPenRefData();
123 M_PENDATA
->m_colour
= colourName
;
126 void wxPen::SetColour( int red
, int green
, int blue
)
129 m_refData
= new wxPenRefData();
131 M_PENDATA
->m_colour
.Set( red
, green
, blue
);
134 void wxPen::SetCap( int capStyle
)
137 m_refData
= new wxPenRefData();
139 M_PENDATA
->m_capStyle
= capStyle
;
142 void wxPen::SetJoin( int joinStyle
)
145 m_refData
= new wxPenRefData();
147 M_PENDATA
->m_joinStyle
= joinStyle
;
150 void wxPen::SetStyle( int style
)
153 m_refData
= new wxPenRefData();
155 M_PENDATA
->m_style
= style
;
158 void wxPen::SetWidth( int width
)
161 m_refData
= new wxPenRefData();
163 M_PENDATA
->m_width
= width
;
166 int wxPen::GetCap(void) const
168 return M_PENDATA
->m_capStyle
;
171 int wxPen::GetJoin(void) const
176 return M_PENDATA
->m_joinStyle
;
179 int wxPen::GetStyle(void) const
184 return M_PENDATA
->m_style
;
187 int wxPen::GetWidth(void) const
192 return M_PENDATA
->m_width
;
195 wxColour
&wxPen::GetColour(void) const
200 return M_PENDATA
->m_colour
;
203 bool wxPen::Ok(void) const