]> git.saurik.com Git - wxWidgets.git/blame - interface/brush.h
fixed links to global variables; fixed categories; use @see instead of @seealso
[wxWidgets.git] / interface / brush.h
CommitLineData
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}
7c913512 12
23324ae1
FM
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.
7c913512 16
23324ae1
FM
17 @library{wxcore}
18 @category{gdi}
7c913512 19
23324ae1
FM
20 @stdobjects
21 Objects:
22 wxNullBrush
23 Pointers:
24 wxBLUE_BRUSH
7c913512 25
23324ae1 26 wxGREEN_BRUSH
7c913512 27
23324ae1 28 wxWHITE_BRUSH
7c913512 29
23324ae1 30 wxBLACK_BRUSH
7c913512 31
23324ae1 32 wxGREY_BRUSH
7c913512 33
23324ae1 34 wxMEDIUM_GREY_BRUSH
7c913512 35
23324ae1 36 wxLIGHT_GREY_BRUSH
7c913512 37
23324ae1 38 wxTRANSPARENT_BRUSH
7c913512 39
23324ae1 40 wxCYAN_BRUSH
7c913512 41
23324ae1 42 wxRED_BRUSH
7c913512 43
23324ae1
FM
44 @seealso
45 wxBrushList, wxDC, wxDC::SetBrush
46*/
47class wxBrush : public wxGDIObject
48{
49public:
50 //@{
51 /**
52 Copy constructor, uses @ref overview_trefcount "reference counting".
53
7c913512 54 @param colour
4cc4bfaf 55 Colour object.
7c913512 56 @param colourName
4cc4bfaf 57 Colour name. The name will be looked up in the colour database.
7c913512 58 @param style
4cc4bfaf 59 One of:
23324ae1 60
23324ae1
FM
61
62
23324ae1 63
23324ae1
FM
64
65
4cc4bfaf 66 wxTRANSPARENT
23324ae1 67
23324ae1
FM
68
69
23324ae1 70
4cc4bfaf 71 Transparent (no fill).
23324ae1
FM
72
73
23324ae1 74
23324ae1
FM
75
76
4cc4bfaf 77 wxSOLID
23324ae1 78
23324ae1
FM
79
80
23324ae1 81
4cc4bfaf 82 Solid.
23324ae1
FM
83
84
23324ae1 85
23324ae1
FM
86
87
4cc4bfaf 88 wxSTIPPLE
23324ae1 89
23324ae1
FM
90
91
23324ae1 92
4cc4bfaf
FM
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
23324ae1 125
4cc4bfaf
FM
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.
7c913512 162 @param stippleBitmap
4cc4bfaf 163 A bitmap to use for stippling.
23324ae1
FM
164
165 @remarks If a stipple brush is created, the brush style will be set to
4cc4bfaf 166 wxSTIPPLE.
23324ae1 167
4cc4bfaf 168 @see wxBrushList, wxColour, wxColourDatabase
23324ae1
FM
169 */
170 wxBrush();
7c913512
FM
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);
23324ae1
FM
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
4cc4bfaf
FM
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.
23324ae1
FM
188 */
189 ~wxBrush();
190
191 /**
192 Returns a reference to the brush colour.
193
4cc4bfaf 194 @see SetColour()
23324ae1 195 */
328f5751 196 wxColour GetColour() const;
23324ae1
FM
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
4cc4bfaf 204 @see SetStipple()
23324ae1 205 */
328f5751 206 wxBitmap* GetStipple() const;
23324ae1
FM
207
208 /**
209 Returns the brush style, one of:
210
211 @b wxTRANSPARENT
212
23324ae1
FM
213 Transparent (no fill).
214
215 @b wxSOLID
216
23324ae1
FM
217 Solid.
218
219 @b wxBDIAGONAL_HATCH
220
23324ae1
FM
221 Backward diagonal hatch.
222
223 @b wxCROSSDIAG_HATCH
224
23324ae1
FM
225 Cross-diagonal hatch.
226
227 @b wxFDIAGONAL_HATCH
228
23324ae1
FM
229 Forward diagonal hatch.
230
231 @b wxCROSS_HATCH
232
23324ae1
FM
233 Cross hatch.
234
235 @b wxHORIZONTAL_HATCH
236
23324ae1
FM
237 Horizontal hatch.
238
239 @b wxVERTICAL_HATCH
240
23324ae1
FM
241 Vertical hatch.
242
243 @b wxSTIPPLE
244
23324ae1
FM
245 Stippled using a bitmap.
246
247 @b wxSTIPPLE_MASK_OPAQUE
248
23324ae1
FM
249 Stippled using a bitmap's mask.
250
4cc4bfaf 251 @see SetStyle(), SetColour(), SetStipple()
23324ae1 252 */
328f5751 253 int GetStyle() const;
23324ae1
FM
254
255 /**
256 Returns @true if the style of the brush is any of hatched fills.
257
4cc4bfaf 258 @see GetStyle()
23324ae1 259 */
328f5751 260 bool IsHatch() const;
23324ae1
FM
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 */
328f5751 267 bool IsOk() const;
23324ae1
FM
268
269 //@{
270 /**
271 Sets the brush colour using red, green and blue values.
272
4cc4bfaf 273 @see GetColour()
23324ae1
FM
274 */
275 void SetColour(wxColour& colour);
7c913512
FM
276 void SetColour(const wxString& colourName);
277 void SetColour(unsigned char red, unsigned char green,
278 unsigned char blue);
23324ae1
FM
279 //@}
280
281 /**
282 Sets the stipple bitmap.
283
7c913512 284 @param bitmap
4cc4bfaf 285 The bitmap to use for stippling.
23324ae1
FM
286
287 @remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask
4cc4bfaf
FM
288 associated to it, in which case the style will be set
289 to wxSTIPPLE_MASK_OPAQUE.
23324ae1 290
4cc4bfaf 291 @see wxBitmap
23324ae1
FM
292 */
293 void SetStipple(const wxBitmap& bitmap);
294
295 /**
296 Sets the brush style.
297
7c913512 298 @param style
4cc4bfaf 299 One of:
23324ae1 300
23324ae1
FM
301
302
23324ae1 303
23324ae1
FM
304
305
4cc4bfaf 306 wxTRANSPARENT
23324ae1 307
23324ae1
FM
308
309
23324ae1 310
4cc4bfaf 311 Transparent (no fill).
23324ae1
FM
312
313
23324ae1 314
23324ae1
FM
315
316
4cc4bfaf 317 wxSOLID
23324ae1 318
23324ae1
FM
319
320
23324ae1 321
4cc4bfaf 322 Solid.
23324ae1
FM
323
324
23324ae1 325
23324ae1
FM
326
327
4cc4bfaf 328 wxBDIAGONAL_HATCH
23324ae1 329
23324ae1
FM
330
331
23324ae1 332
4cc4bfaf 333 Backward diagonal hatch.
23324ae1
FM
334
335
23324ae1 336
4cc4bfaf
FM
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()
23324ae1
FM
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};