]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: brush.h | |
3 | // Purpose: documentation for wxBrush class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxBrush | |
11 | @wxheader{brush.h} | |
12 | ||
13 | A brush is a drawing tool for filling in areas. It is used for painting | |
14 | the background of rectangles, ellipses, etc. It has a colour and a | |
15 | style. | |
16 | ||
17 | @library{wxcore} | |
18 | @category{gdi} | |
19 | ||
20 | @stdobjects | |
21 | Objects: | |
22 | wxNullBrush | |
23 | Pointers: | |
24 | wxBLUE_BRUSH | |
25 | ||
26 | wxGREEN_BRUSH | |
27 | ||
28 | wxWHITE_BRUSH | |
29 | ||
30 | wxBLACK_BRUSH | |
31 | ||
32 | wxGREY_BRUSH | |
33 | ||
34 | wxMEDIUM_GREY_BRUSH | |
35 | ||
36 | wxLIGHT_GREY_BRUSH | |
37 | ||
38 | wxTRANSPARENT_BRUSH | |
39 | ||
40 | wxCYAN_BRUSH | |
41 | ||
42 | wxRED_BRUSH | |
43 | ||
44 | @seealso | |
45 | wxBrushList, wxDC, wxDC::SetBrush | |
46 | */ | |
47 | class wxBrush : public wxGDIObject | |
48 | { | |
49 | public: | |
50 | //@{ | |
51 | /** | |
52 | Copy constructor, uses @ref overview_trefcount "reference counting". | |
53 | ||
54 | @param colour | |
55 | Colour object. | |
56 | ||
57 | @param colourName | |
58 | Colour name. The name will be looked up in the colour database. | |
59 | ||
60 | @param style | |
61 | One of: | |
62 | ||
63 | wxTRANSPARENT | |
64 | ||
65 | ||
66 | Transparent (no fill). | |
67 | ||
68 | wxSOLID | |
69 | ||
70 | ||
71 | Solid. | |
72 | ||
73 | wxSTIPPLE | |
74 | ||
75 | ||
76 | Uses a bitmap as a stipple. | |
77 | ||
78 | wxBDIAGONAL_HATCH | |
79 | ||
80 | ||
81 | Backward diagonal hatch. | |
82 | ||
83 | wxCROSSDIAG_HATCH | |
84 | ||
85 | ||
86 | Cross-diagonal hatch. | |
87 | ||
88 | wxFDIAGONAL_HATCH | |
89 | ||
90 | ||
91 | Forward diagonal hatch. | |
92 | ||
93 | wxCROSS_HATCH | |
94 | ||
95 | ||
96 | Cross hatch. | |
97 | ||
98 | wxHORIZONTAL_HATCH | |
99 | ||
100 | ||
101 | Horizontal hatch. | |
102 | ||
103 | wxVERTICAL_HATCH | |
104 | ||
105 | ||
106 | Vertical hatch. | |
107 | ||
108 | @param brush | |
109 | Pointer or reference to a brush to copy. | |
110 | ||
111 | @param stippleBitmap | |
112 | A bitmap to use for stippling. | |
113 | ||
114 | @remarks If a stipple brush is created, the brush style will be set to | |
115 | wxSTIPPLE. | |
116 | ||
117 | @sa wxBrushList, wxColour, wxColourDatabase | |
118 | */ | |
119 | wxBrush(); | |
120 | wxBrush(const wxColour& colour, int style = wxSOLID); | |
121 | wxBrush(const wxString& colourName, int style); | |
122 | wxBrush(const wxBitmap& stippleBitmap); | |
123 | wxBrush(const wxBrush& brush); | |
124 | //@} | |
125 | ||
126 | /** | |
127 | Destructor. | |
128 | See @ref overview_refcountdestruct "reference-counted object destruction" for | |
129 | more info. | |
130 | ||
131 | @remarks Although all remaining brushes are deleted when the application | |
132 | exits, the application should try to clean up all | |
133 | brushes itself. This is because wxWidgets cannot know | |
134 | if a pointer to the brush object is stored in an | |
135 | application data structure, and there is a risk of | |
136 | double deletion. | |
137 | */ | |
138 | ~wxBrush(); | |
139 | ||
140 | /** | |
141 | Returns a reference to the brush colour. | |
142 | ||
143 | @sa SetColour() | |
144 | */ | |
145 | wxColour GetColour(); | |
146 | ||
147 | /** | |
148 | Gets a pointer to the stipple bitmap. If the brush does not have a wxSTIPPLE | |
149 | style, | |
150 | this bitmap may be non-@NULL but uninitialised (@ref wxBitmap::isok | |
151 | wxBitmap:IsOk returns @false). | |
152 | ||
153 | @sa SetStipple() | |
154 | */ | |
155 | wxBitmap * GetStipple(); | |
156 | ||
157 | /** | |
158 | Returns the brush style, one of: | |
159 | ||
160 | @b wxTRANSPARENT | |
161 | ||
162 | ||
163 | Transparent (no fill). | |
164 | ||
165 | @b wxSOLID | |
166 | ||
167 | ||
168 | Solid. | |
169 | ||
170 | @b wxBDIAGONAL_HATCH | |
171 | ||
172 | ||
173 | Backward diagonal hatch. | |
174 | ||
175 | @b wxCROSSDIAG_HATCH | |
176 | ||
177 | ||
178 | Cross-diagonal hatch. | |
179 | ||
180 | @b wxFDIAGONAL_HATCH | |
181 | ||
182 | ||
183 | Forward diagonal hatch. | |
184 | ||
185 | @b wxCROSS_HATCH | |
186 | ||
187 | ||
188 | Cross hatch. | |
189 | ||
190 | @b wxHORIZONTAL_HATCH | |
191 | ||
192 | ||
193 | Horizontal hatch. | |
194 | ||
195 | @b wxVERTICAL_HATCH | |
196 | ||
197 | ||
198 | Vertical hatch. | |
199 | ||
200 | @b wxSTIPPLE | |
201 | ||
202 | ||
203 | Stippled using a bitmap. | |
204 | ||
205 | @b wxSTIPPLE_MASK_OPAQUE | |
206 | ||
207 | ||
208 | Stippled using a bitmap's mask. | |
209 | ||
210 | ||
211 | @sa SetStyle(), SetColour(), SetStipple() | |
212 | */ | |
213 | int GetStyle(); | |
214 | ||
215 | /** | |
216 | Returns @true if the style of the brush is any of hatched fills. | |
217 | ||
218 | @sa GetStyle() | |
219 | */ | |
220 | bool IsHatch(); | |
221 | ||
222 | /** | |
223 | Returns @true if the brush is initialised. It will return @false if the default | |
224 | constructor has been used (for example, the brush is a member of a class, or | |
225 | @NULL has been assigned to it). | |
226 | */ | |
227 | #define bool IsOk() /* implementation is private */ | |
228 | ||
229 | //@{ | |
230 | /** | |
231 | Sets the brush colour using red, green and blue values. | |
232 | ||
233 | @sa GetColour() | |
234 | */ | |
235 | void SetColour(wxColour& colour); | |
236 | void SetColour(const wxString& colourName); | |
237 | void SetColour(unsigned char red, unsigned char green, | |
238 | unsigned char blue); | |
239 | //@} | |
240 | ||
241 | /** | |
242 | Sets the stipple bitmap. | |
243 | ||
244 | @param bitmap | |
245 | The bitmap to use for stippling. | |
246 | ||
247 | @remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask | |
248 | associated to it, in which case the style will be set | |
249 | to wxSTIPPLE_MASK_OPAQUE. | |
250 | ||
251 | @sa wxBitmap | |
252 | */ | |
253 | void SetStipple(const wxBitmap& bitmap); | |
254 | ||
255 | /** | |
256 | Sets the brush style. | |
257 | ||
258 | @param style | |
259 | One of: | |
260 | ||
261 | wxTRANSPARENT | |
262 | ||
263 | ||
264 | Transparent (no fill). | |
265 | ||
266 | wxSOLID | |
267 | ||
268 | ||
269 | Solid. | |
270 | ||
271 | wxBDIAGONAL_HATCH | |
272 | ||
273 | ||
274 | Backward diagonal hatch. | |
275 | ||
276 | wxCROSSDIAG_HATCH | |
277 | ||
278 | ||
279 | Cross-diagonal hatch. | |
280 | ||
281 | wxFDIAGONAL_HATCH | |
282 | ||
283 | ||
284 | Forward diagonal hatch. | |
285 | ||
286 | wxCROSS_HATCH | |
287 | ||
288 | ||
289 | Cross hatch. | |
290 | ||
291 | wxHORIZONTAL_HATCH | |
292 | ||
293 | ||
294 | Horizontal hatch. | |
295 | ||
296 | wxVERTICAL_HATCH | |
297 | ||
298 | ||
299 | Vertical hatch. | |
300 | ||
301 | wxSTIPPLE | |
302 | ||
303 | ||
304 | Stippled using a bitmap. | |
305 | ||
306 | wxSTIPPLE_MASK_OPAQUE | |
307 | ||
308 | ||
309 | Stippled using a bitmap's mask. | |
310 | ||
311 | @sa GetStyle() | |
312 | */ | |
313 | void SetStyle(int style); | |
314 | ||
315 | /** | |
316 | Inequality operator. | |
317 | See @ref overview_refcountequality "reference-counted object comparison" for | |
318 | more info. | |
319 | */ | |
320 | bool operator !=(const wxBrush& brush); | |
321 | ||
322 | /** | |
323 | Assignment operator, using @ref overview_trefcount "reference counting". | |
324 | */ | |
325 | wxBrush operator =(const wxBrush& brush); | |
326 | ||
327 | /** | |
328 | Equality operator. | |
329 | See @ref overview_refcountequality "reference-counted object comparison" for | |
330 | more info. | |
331 | */ | |
332 | bool operator ==(const wxBrush& brush); | |
333 | }; |