]>
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 #if !USE_SHARED_LIBRARIES
21 IMPLEMENT_DYNAMIC_CLASS(wxBrush
, wxGDIObject
)
24 wxBrushRefData::wxBrushRefData()
29 wxBrushRefData::wxBrushRefData(const wxBrushRefData
& data
)
31 m_style
= data
.m_style
;
32 m_stipple
= data
.m_stipple
;
33 m_colour
= data
.m_colour
;
36 wxBrushRefData::~wxBrushRefData()
44 wxTheBrushList
->AddBrush(this);
50 wxTheBrushList
->RemoveBrush(this);
53 wxBrush::wxBrush(const wxColour
& col
, int Style
)
55 m_refData
= new wxBrushRefData
;
57 M_BRUSHDATA
->m_colour
= col
;
58 M_BRUSHDATA
->m_style
= Style
;
63 wxTheBrushList
->AddBrush(this);
66 wxBrush::wxBrush(const wxString
& col
, int Style
)
68 m_refData
= new wxBrushRefData
;
70 // Implicit conversion from string to wxColour via colour database
71 M_BRUSHDATA
->m_colour
= col
;
72 M_BRUSHDATA
->m_style
= Style
;
77 wxTheBrushList
->AddBrush(this);
80 wxBrush::wxBrush(const wxBitmap
& stipple
)
82 m_refData
= new wxBrushRefData
;
84 M_BRUSHDATA
->m_style
= wxSTIPPLE
;
85 M_BRUSHDATA
->m_stipple
= stipple
;
90 wxTheBrushList
->AddBrush(this);
93 void wxBrush::Unshare()
95 // Don't change shared data
98 m_refData
= new wxBrushRefData();
102 wxBrushRefData
* ref
= new wxBrushRefData(*(wxBrushRefData
*)m_refData
);
108 void wxBrush::SetColour(const wxColour
& col
)
112 M_BRUSHDATA
->m_colour
= col
;
117 void wxBrush::SetColour(const wxString
& col
)
121 M_BRUSHDATA
->m_colour
= col
;
126 void wxBrush::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
130 M_BRUSHDATA
->m_colour
.Set(r
, g
, b
);
135 void wxBrush::SetStyle(int Style
)
139 M_BRUSHDATA
->m_style
= Style
;
144 void wxBrush::SetStipple(const wxBitmap
& Stipple
)
148 M_BRUSHDATA
->m_stipple
= Stipple
;
153 bool wxBrush::RealizeResource()
155 // Nothing more to do