]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/brush.cpp
45a73b74af630dfe5cb39614ede311a5601f03cc
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()
30 wxBrushRefData::wxBrushRefData(const wxBrushRefData
& data
)
32 m_style
= data
.m_style
;
33 m_stipple
= data
.m_stipple
;
34 m_colour
= data
.m_colour
;
40 wxBrushRefData::~wxBrushRefData()
49 wxTheBrushList
->AddBrush(this);
55 wxTheBrushList
->RemoveBrush(this);
58 wxBrush::wxBrush(const wxColour
& col
, int Style
)
60 m_refData
= new wxBrushRefData
;
62 M_BRUSHDATA
->m_colour
= col
;
63 M_BRUSHDATA
->m_style
= Style
;
68 wxTheBrushList
->AddBrush(this);
71 wxBrush::wxBrush(const wxString
& col
, int Style
)
73 m_refData
= new wxBrushRefData
;
75 // Implicit conversion from string to wxColour via colour database
76 M_BRUSHDATA
->m_colour
= col
;
77 M_BRUSHDATA
->m_style
= Style
;
82 wxTheBrushList
->AddBrush(this);
85 wxBrush::wxBrush(const wxBitmap
& stipple
)
87 m_refData
= new wxBrushRefData
;
89 M_BRUSHDATA
->m_style
= wxSTIPPLE
;
90 M_BRUSHDATA
->m_stipple
= stipple
;
95 wxTheBrushList
->AddBrush(this);
98 void wxBrush::Unshare()
100 // Don't change shared data
103 m_refData
= new wxBrushRefData();
107 wxBrushRefData
* ref
= new wxBrushRefData(*(wxBrushRefData
*)m_refData
);
113 void wxBrush::SetColour(const wxColour
& col
)
117 M_BRUSHDATA
->m_colour
= col
;
122 void wxBrush::SetColour(const wxString
& col
)
126 M_BRUSHDATA
->m_colour
= col
;
131 void wxBrush::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
135 M_BRUSHDATA
->m_colour
.Set(r
, g
, b
);
140 void wxBrush::SetStyle(int Style
)
144 M_BRUSHDATA
->m_style
= Style
;
149 void wxBrush::SetStipple(const wxBitmap
& Stipple
)
153 M_BRUSHDATA
->m_stipple
= Stipple
;
158 void wxBrush::RealizeResource()
160 // TODO: create the brush