]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/brush.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "brush.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxBrush
, wxGDIObject
)
22 wxBrushRefData::wxBrushRefData()
27 wxBrushRefData::wxBrushRefData(const wxBrushRefData
& data
)
29 m_style
= data
.m_style
;
30 m_stipple
= data
.m_stipple
;
31 m_colour
= data
.m_colour
;
34 wxBrushRefData::~wxBrushRefData()
42 wxTheBrushList
->AddBrush(this);
48 wxTheBrushList
->RemoveBrush(this);
51 wxBrush::wxBrush(const wxColour
& col
, int Style
)
53 m_refData
= new wxBrushRefData
;
55 M_BRUSHDATA
->m_colour
= col
;
56 M_BRUSHDATA
->m_style
= Style
;
61 wxTheBrushList
->AddBrush(this);
64 wxBrush::wxBrush(const wxBitmap
& stipple
)
66 m_refData
= new wxBrushRefData
;
68 M_BRUSHDATA
->m_style
= wxSTIPPLE
;
69 M_BRUSHDATA
->m_stipple
= stipple
;
74 wxTheBrushList
->AddBrush(this);
77 void wxBrush::Unshare()
79 // Don't change shared data
82 m_refData
= new wxBrushRefData();
86 wxBrushRefData
* ref
= new wxBrushRefData(*(wxBrushRefData
*)m_refData
);
92 void wxBrush::SetColour(const wxColour
& col
)
96 M_BRUSHDATA
->m_colour
= col
;
101 void wxBrush::SetColour(unsigned char r
, unsigned char g
, unsigned char b
)
105 M_BRUSHDATA
->m_colour
.Set(r
, g
, b
);
110 void wxBrush::SetStyle(int Style
)
114 M_BRUSHDATA
->m_style
= Style
;
119 void wxBrush::SetStipple(const wxBitmap
& Stipple
)
123 M_BRUSHDATA
->m_stipple
= Stipple
;
128 bool wxBrush::RealizeResource()
130 // Nothing more to do