]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/brush.cpp
fixed another @DEBUG@
[wxWidgets.git] / src / gtk1 / brush.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: brush.cpp
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "brush.h"
13#endif
14
15#include "wx/brush.h"
16
17//-----------------------------------------------------------------------------
18// wxBrush
19//-----------------------------------------------------------------------------
20
21class wxBrushRefData: public wxObjectRefData
22{
23 public:
24
25 wxBrushRefData(void);
26
27 int m_style;
28 wxBitmap m_stipple;
29 wxColour m_colour;
30};
31
32wxBrushRefData::wxBrushRefData(void)
33{
34 m_style = 0;
35};
36
37//-----------------------------------------------------------------------------
38
39#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
40
41IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
42
43wxBrush::wxBrush(void)
44{
45 if (wxTheBrushList) wxTheBrushList->AddBrush( this );
46};
47
debe6624 48wxBrush::wxBrush( const wxColour &colour, int style )
c801d85f
KB
49{
50 m_refData = new wxBrushRefData();
51 M_BRUSHDATA->m_style = style;
52 M_BRUSHDATA->m_colour = colour;
53
54 if (wxTheBrushList) wxTheBrushList->AddBrush( this );
55};
56
debe6624 57wxBrush::wxBrush( const wxString &colourName, int style )
c801d85f
KB
58{
59 m_refData = new wxBrushRefData();
60 M_BRUSHDATA->m_style = style;
61 M_BRUSHDATA->m_colour = colourName;
62
63 if (wxTheBrushList) wxTheBrushList->AddBrush( this );
64};
65
66wxBrush::wxBrush( const wxBitmap &stippleBitmap )
67{
68 m_refData = new wxBrushRefData();
69 M_BRUSHDATA->m_style = wxSTIPPLE;
70 M_BRUSHDATA->m_colour = *wxBLACK;
71 M_BRUSHDATA->m_stipple = stippleBitmap;
72
73 if (wxTheBrushList) wxTheBrushList->AddBrush( this );
74};
75
76wxBrush::wxBrush( const wxBrush &brush )
77{
78 Ref( brush );
79
80 if (wxTheBrushList) wxTheBrushList->AddBrush( this );
81};
82
83wxBrush::wxBrush( const wxBrush *brush )
84{
85 if (brush) Ref( *brush );
86
87 if (wxTheBrushList) wxTheBrushList->Append( this );
88};
89
90wxBrush::~wxBrush(void)
91{
92 if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
93};
94
95wxBrush& wxBrush::operator = ( const wxBrush& brush )
96{
97 if (*this == brush) return (*this);
98 Ref( brush );
99 return *this;
100};
101
102bool wxBrush::operator == ( const wxBrush& brush )
103{
104 return m_refData == brush.m_refData;
105};
106
107bool wxBrush::operator != ( const wxBrush& brush )
108{
109 return m_refData != brush.m_refData;
110};
111
112bool wxBrush::Ok(void) const
113{
114 return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
115};
116
117int wxBrush::GetStyle(void) const
118{
119 return M_BRUSHDATA->m_style;
120};
121
122wxColour &wxBrush::GetColour(void) const
123{
124 return M_BRUSHDATA->m_colour;
125};
126
127wxBitmap *wxBrush::GetStipple(void) const
128{
129 return &M_BRUSHDATA->m_stipple;
130};
131
132