]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/brush.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "brush.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxBrush
, wxGDIObject
)
22 wxBrushRefData::wxBrushRefData()
28 wxBrushRefData::wxBrushRefData(const wxBrushRefData
& data
)
30 m_style
= data
.m_style
;
31 m_stipple
= data
.m_stipple
;
32 m_colour
= data
.m_colour
;
38 wxBrushRefData::~wxBrushRefData()
47 wxTheBrushList
->AddBrush(this);
53 wxTheBrushList
->RemoveBrush(this);
56 wxBrush::wxBrush(const wxColour
& col
, int Style
)
58 m_refData
= new wxBrushRefData
;
60 M_BRUSHDATA
->m_colour
= col
;
61 M_BRUSHDATA
->m_style
= Style
;
66 wxTheBrushList
->AddBrush(this);
69 wxBrush::wxBrush(const wxString
& col
, int Style
)
71 m_refData
= new wxBrushRefData
;
73 // Implicit conversion from string to wxColour via colour database
74 M_BRUSHDATA
->m_colour
= col
;
75 M_BRUSHDATA
->m_style
= Style
;
80 wxTheBrushList
->AddBrush(this);
83 wxBrush::wxBrush(const wxBitmap
& stipple
)
85 m_refData
= new wxBrushRefData
;
87 M_BRUSHDATA
->m_style
= wxSTIPPLE
;
88 M_BRUSHDATA
->m_stipple
= stipple
;
93 wxTheBrushList
->AddBrush(this);
96 void wxBrush::Unshare()
98 // Don't change shared data
101 m_refData
= new wxBrushRefData();
105 wxBrushRefData
* ref
= new wxBrushRefData(*(wxBrushRefData
*)m_refData
);
111 void wxBrush::SetColour(const wxColour
& col
)
115 M_BRUSHDATA
->m_colour
= col
;
120 void wxBrush::SetColour(const wxString
& col
)
124 M_BRUSHDATA
->m_colour
= col
;
129 void wxBrush::SetColour(const unsigned char r
, const unsigned char g
, const unsigned char b
)
133 M_BRUSHDATA
->m_colour
.Set(r
, g
, b
);
138 void wxBrush::SetStyle(int Style
)
142 M_BRUSHDATA
->m_style
= Style
;
147 void wxBrush::SetStipple(const wxBitmap
& Stipple
)
151 M_BRUSHDATA
->m_stipple
= Stipple
;
156 void wxBrush::RealizeResource()
158 // TODO: create the brush