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