]> git.saurik.com Git - wxWidgets.git/blob - src/mac/brush.cpp
added debugging code for redrawing
[wxWidgets.git] / src / mac / brush.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: brush.cpp
3 // Purpose: wxBrush
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "brush.h"
14 #endif
15
16 #include "wx/setup.h"
17 #include "wx/utils.h"
18 #include "wx/brush.h"
19
20 #if !USE_SHARED_LIBRARIES
21 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
22 #endif
23
24 wxBrushRefData::wxBrushRefData()
25 {
26 m_style = wxSOLID;
27 m_isMacTheme = false ;
28 m_isMacThemeBackground = false ;
29 }
30
31 wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
32 {
33 m_style = data.m_style;
34 m_stipple = data.m_stipple;
35 m_colour = data.m_colour;
36 m_isMacTheme = data.m_isMacTheme ;
37 m_macThemeBrush = data.m_macThemeBrush ;
38 }
39
40 wxBrushRefData::~wxBrushRefData()
41 {
42 }
43
44 // Brushes
45 wxBrush::wxBrush()
46 {
47 }
48
49 wxBrush::~wxBrush()
50 {
51 }
52
53 wxBrush::wxBrush(const wxColour& col, int Style)
54 {
55 m_refData = new wxBrushRefData;
56
57 M_BRUSHDATA->m_colour = col;
58 M_BRUSHDATA->m_style = Style;
59
60 RealizeResource();
61 }
62
63 wxBrush::wxBrush(const wxBitmap& stipple)
64 {
65 m_refData = new wxBrushRefData;
66
67 M_BRUSHDATA->m_style = wxSTIPPLE;
68 M_BRUSHDATA->m_stipple = stipple;
69
70 RealizeResource();
71 }
72
73 wxBrush::wxBrush(ThemeBrush macThemeBrush )
74 {
75 m_refData = new wxBrushRefData;
76
77 M_BRUSHDATA->m_isMacTheme = true;
78 M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
79
80 RealizeResource();
81 }
82 void wxBrush::Unshare()
83 {
84 // Don't change shared data
85 if (!m_refData)
86 {
87 m_refData = new wxBrushRefData();
88 }
89 else
90 {
91 wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
92 UnRef();
93 m_refData = ref;
94 }
95 }
96
97 void wxBrush::SetColour(const wxColour& col)
98 {
99 Unshare();
100 M_BRUSHDATA->m_isMacTheme = false;
101 M_BRUSHDATA->m_isMacThemeBackground = false ;
102 M_BRUSHDATA->m_colour = col;
103
104 RealizeResource();
105 }
106
107 void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
108 {
109 Unshare();
110
111 M_BRUSHDATA->m_isMacTheme = false;
112 M_BRUSHDATA->m_isMacThemeBackground = false ;
113 M_BRUSHDATA->m_colour.Set(r, g, b);
114
115 RealizeResource();
116 }
117
118 void wxBrush::SetStyle(int Style)
119 {
120 Unshare();
121
122 M_BRUSHDATA->m_isMacTheme = false;
123 M_BRUSHDATA->m_isMacThemeBackground = false ;
124 M_BRUSHDATA->m_style = Style;
125
126 RealizeResource();
127 }
128
129 void wxBrush::SetStipple(const wxBitmap& Stipple)
130 {
131 Unshare();
132
133 M_BRUSHDATA->m_stipple = Stipple;
134
135 RealizeResource();
136 }
137
138 void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
139 {
140 Unshare();
141
142 M_BRUSHDATA->m_isMacTheme = true;
143 M_BRUSHDATA->m_isMacThemeBackground = false ;
144 M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
145
146 RealizeResource();
147 }
148
149 void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
150 {
151 Unshare();
152
153 M_BRUSHDATA->m_isMacTheme = false;
154 M_BRUSHDATA->m_isMacThemeBackground = true ;
155 M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
156
157 RealizeResource();
158 }
159
160 bool wxBrush::RealizeResource()
161 {
162 return TRUE;
163 }
164