]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
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 | ||
2f1ae414 | 20 | #if !USE_SHARED_LIBRARIES |
e9576ca5 | 21 | IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) |
2f1ae414 | 22 | #endif |
e9576ca5 SC |
23 | |
24 | wxBrushRefData::wxBrushRefData() | |
25 | { | |
26 | m_style = wxSOLID; | |
1dcbbdcf SC |
27 | m_isMacTheme = false ; |
28 | m_isMacThemeBackground = false ; | |
e9576ca5 SC |
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; | |
1dcbbdcf SC |
36 | m_isMacTheme = data.m_isMacTheme ; |
37 | m_macThemeBrush = data.m_macThemeBrush ; | |
e9576ca5 SC |
38 | } |
39 | ||
40 | wxBrushRefData::~wxBrushRefData() | |
41 | { | |
e9576ca5 SC |
42 | } |
43 | ||
44 | // Brushes | |
45 | wxBrush::wxBrush() | |
46 | { | |
e9576ca5 SC |
47 | } |
48 | ||
49 | wxBrush::~wxBrush() | |
50 | { | |
e9576ca5 SC |
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(); | |
e9576ca5 SC |
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(); | |
e9576ca5 SC |
71 | } |
72 | ||
1dcbbdcf SC |
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 | } | |
e9576ca5 SC |
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(); | |
1dcbbdcf SC |
100 | M_BRUSHDATA->m_isMacTheme = false; |
101 | M_BRUSHDATA->m_isMacThemeBackground = false ; | |
e9576ca5 SC |
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 | ||
1dcbbdcf SC |
111 | M_BRUSHDATA->m_isMacTheme = false; |
112 | M_BRUSHDATA->m_isMacThemeBackground = false ; | |
e9576ca5 SC |
113 | M_BRUSHDATA->m_colour.Set(r, g, b); |
114 | ||
115 | RealizeResource(); | |
116 | } | |
117 | ||
118 | void wxBrush::SetStyle(int Style) | |
119 | { | |
120 | Unshare(); | |
121 | ||
1dcbbdcf SC |
122 | M_BRUSHDATA->m_isMacTheme = false; |
123 | M_BRUSHDATA->m_isMacThemeBackground = false ; | |
e9576ca5 SC |
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 | ||
1dcbbdcf SC |
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 | ||
e9576ca5 SC |
160 | bool wxBrush::RealizeResource() |
161 | { | |
519cb848 | 162 | return TRUE; |
e9576ca5 SC |
163 | } |
164 |