]> git.saurik.com Git - wxWidgets.git/blob - interface/brush.h
b94094f5ba1c78d1af195188acc5650a11c3ae0c
[wxWidgets.git] / interface / brush.h
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 @param colourName
57 Colour name. The name will be looked up in the colour database.
58 @param style
59 One of:
60
61
62
63
64
65
66 wxTRANSPARENT
67
68
69
70
71 Transparent (no fill).
72
73
74
75
76
77 wxSOLID
78
79
80
81
82 Solid.
83
84
85
86
87
88 wxSTIPPLE
89
90
91
92
93 Uses a bitmap as a stipple.
94
95
96
97
98
99 wxBDIAGONAL_HATCH
100
101
102
103
104 Backward diagonal hatch.
105
106
107
108
109
110 wxCROSSDIAG_HATCH
111
112
113
114
115 Cross-diagonal hatch.
116
117
118
119
120
121 wxFDIAGONAL_HATCH
122
123
124
125
126 Forward diagonal hatch.
127
128
129
130
131
132 wxCROSS_HATCH
133
134
135
136
137 Cross hatch.
138
139
140
141
142
143 wxHORIZONTAL_HATCH
144
145
146
147
148 Horizontal hatch.
149
150
151
152
153
154 wxVERTICAL_HATCH
155
156
157
158
159 Vertical hatch.
160 @param brush
161 Pointer or reference to a brush to copy.
162 @param stippleBitmap
163 A bitmap to use for stippling.
164
165 @remarks If a stipple brush is created, the brush style will be set to
166 wxSTIPPLE.
167
168 @see wxBrushList, wxColour, wxColourDatabase
169 */
170 wxBrush();
171 wxBrush(const wxColour& colour, int style = wxSOLID);
172 wxBrush(const wxString& colourName, int style);
173 wxBrush(const wxBitmap& stippleBitmap);
174 wxBrush(const wxBrush& brush);
175 //@}
176
177 /**
178 Destructor.
179 See @ref overview_refcountdestruct "reference-counted object destruction" for
180 more info.
181
182 @remarks Although all remaining brushes are deleted when the application
183 exits, the application should try to clean up all
184 brushes itself. This is because wxWidgets cannot know
185 if a pointer to the brush object is stored in an
186 application data structure, and there is a risk of
187 double deletion.
188 */
189 ~wxBrush();
190
191 /**
192 Returns a reference to the brush colour.
193
194 @see SetColour()
195 */
196 wxColour GetColour();
197
198 /**
199 Gets a pointer to the stipple bitmap. If the brush does not have a wxSTIPPLE
200 style,
201 this bitmap may be non-@NULL but uninitialised (@ref wxBitmap::isok
202 wxBitmap:IsOk returns @false).
203
204 @see SetStipple()
205 */
206 wxBitmap* GetStipple();
207
208 /**
209 Returns the brush style, one of:
210
211 @b wxTRANSPARENT
212
213 Transparent (no fill).
214
215 @b wxSOLID
216
217 Solid.
218
219 @b wxBDIAGONAL_HATCH
220
221 Backward diagonal hatch.
222
223 @b wxCROSSDIAG_HATCH
224
225 Cross-diagonal hatch.
226
227 @b wxFDIAGONAL_HATCH
228
229 Forward diagonal hatch.
230
231 @b wxCROSS_HATCH
232
233 Cross hatch.
234
235 @b wxHORIZONTAL_HATCH
236
237 Horizontal hatch.
238
239 @b wxVERTICAL_HATCH
240
241 Vertical hatch.
242
243 @b wxSTIPPLE
244
245 Stippled using a bitmap.
246
247 @b wxSTIPPLE_MASK_OPAQUE
248
249 Stippled using a bitmap's mask.
250
251 @see SetStyle(), SetColour(), SetStipple()
252 */
253 int GetStyle();
254
255 /**
256 Returns @true if the style of the brush is any of hatched fills.
257
258 @see GetStyle()
259 */
260 bool IsHatch();
261
262 /**
263 Returns @true if the brush is initialised. It will return @false if the default
264 constructor has been used (for example, the brush is a member of a class, or
265 @NULL has been assigned to it).
266 */
267 bool IsOk();
268
269 //@{
270 /**
271 Sets the brush colour using red, green and blue values.
272
273 @see GetColour()
274 */
275 void SetColour(wxColour& colour);
276 void SetColour(const wxString& colourName);
277 void SetColour(unsigned char red, unsigned char green,
278 unsigned char blue);
279 //@}
280
281 /**
282 Sets the stipple bitmap.
283
284 @param bitmap
285 The bitmap to use for stippling.
286
287 @remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask
288 associated to it, in which case the style will be set
289 to wxSTIPPLE_MASK_OPAQUE.
290
291 @see wxBitmap
292 */
293 void SetStipple(const wxBitmap& bitmap);
294
295 /**
296 Sets the brush style.
297
298 @param style
299 One of:
300
301
302
303
304
305
306 wxTRANSPARENT
307
308
309
310
311 Transparent (no fill).
312
313
314
315
316
317 wxSOLID
318
319
320
321
322 Solid.
323
324
325
326
327
328 wxBDIAGONAL_HATCH
329
330
331
332
333 Backward diagonal hatch.
334
335
336
337
338
339 wxCROSSDIAG_HATCH
340
341
342
343
344 Cross-diagonal hatch.
345
346
347
348
349
350 wxFDIAGONAL_HATCH
351
352
353
354
355 Forward diagonal hatch.
356
357
358
359
360
361 wxCROSS_HATCH
362
363
364
365
366 Cross hatch.
367
368
369
370
371
372 wxHORIZONTAL_HATCH
373
374
375
376
377 Horizontal hatch.
378
379
380
381
382
383 wxVERTICAL_HATCH
384
385
386
387
388 Vertical hatch.
389
390
391
392
393
394 wxSTIPPLE
395
396
397
398
399 Stippled using a bitmap.
400
401
402
403
404
405 wxSTIPPLE_MASK_OPAQUE
406
407
408
409
410 Stippled using a bitmap's mask.
411
412 @see GetStyle()
413 */
414 void SetStyle(int style);
415
416 /**
417 Inequality operator.
418 See @ref overview_refcountequality "reference-counted object comparison" for
419 more info.
420 */
421 bool operator !=(const wxBrush& brush);
422
423 /**
424 Assignment operator, using @ref overview_trefcount "reference counting".
425 */
426 wxBrush operator =(const wxBrush& brush);
427
428 /**
429 Equality operator.
430 See @ref overview_refcountequality "reference-counted object comparison" for
431 more info.
432 */
433 bool operator ==(const wxBrush& brush);
434 };