]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: brush.h | |
3 | // Purpose: interface of wxBrush | |
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:, ::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, | |
23 | ||
24 | @see wxBrushList, wxDC, wxDC::SetBrush | |
25 | */ | |
26 | class wxBrush : public wxGDIObject | |
27 | { | |
28 | public: | |
29 | //@{ | |
30 | /** | |
31 | Copy constructor, uses @ref overview_trefcount "reference counting". | |
32 | ||
33 | @param colour | |
34 | Colour object. | |
35 | @param colourName | |
36 | Colour name. The name will be looked up in the colour database. | |
37 | @param style | |
38 | One of: | |
39 | ||
40 | ||
41 | ||
42 | ||
43 | ||
44 | ||
45 | wxTRANSPARENT | |
46 | ||
47 | ||
48 | ||
49 | ||
50 | Transparent (no fill). | |
51 | ||
52 | ||
53 | ||
54 | ||
55 | ||
56 | wxSOLID | |
57 | ||
58 | ||
59 | ||
60 | ||
61 | Solid. | |
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 | wxSTIPPLE | |
68 | ||
69 | ||
70 | ||
71 | ||
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 | ||
104 | ||
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. | |
141 | @param stippleBitmap | |
142 | A bitmap to use for stippling. | |
143 | ||
144 | @remarks If a stipple brush is created, the brush style will be set to | |
145 | wxSTIPPLE. | |
146 | ||
147 | @see wxBrushList, wxColour, wxColourDatabase | |
148 | */ | |
149 | wxBrush(); | |
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); | |
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 | |
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. | |
167 | */ | |
168 | ~wxBrush(); | |
169 | ||
170 | /** | |
171 | Returns a reference to the brush colour. | |
172 | ||
173 | @see SetColour() | |
174 | */ | |
175 | wxColour GetColour() const; | |
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 | ||
183 | @see SetStipple() | |
184 | */ | |
185 | wxBitmap* GetStipple() const; | |
186 | ||
187 | /** | |
188 | Returns the brush style, one of: | |
189 | ||
190 | @b wxTRANSPARENT | |
191 | ||
192 | Transparent (no fill). | |
193 | ||
194 | @b wxSOLID | |
195 | ||
196 | Solid. | |
197 | ||
198 | @b wxBDIAGONAL_HATCH | |
199 | ||
200 | Backward diagonal hatch. | |
201 | ||
202 | @b wxCROSSDIAG_HATCH | |
203 | ||
204 | Cross-diagonal hatch. | |
205 | ||
206 | @b wxFDIAGONAL_HATCH | |
207 | ||
208 | Forward diagonal hatch. | |
209 | ||
210 | @b wxCROSS_HATCH | |
211 | ||
212 | Cross hatch. | |
213 | ||
214 | @b wxHORIZONTAL_HATCH | |
215 | ||
216 | Horizontal hatch. | |
217 | ||
218 | @b wxVERTICAL_HATCH | |
219 | ||
220 | Vertical hatch. | |
221 | ||
222 | @b wxSTIPPLE | |
223 | ||
224 | Stippled using a bitmap. | |
225 | ||
226 | @b wxSTIPPLE_MASK_OPAQUE | |
227 | ||
228 | Stippled using a bitmap's mask. | |
229 | ||
230 | @see SetStyle(), SetColour(), SetStipple() | |
231 | */ | |
232 | int GetStyle() const; | |
233 | ||
234 | /** | |
235 | Returns @true if the style of the brush is any of hatched fills. | |
236 | ||
237 | @see GetStyle() | |
238 | */ | |
239 | bool IsHatch() const; | |
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 | */ | |
246 | bool IsOk() const; | |
247 | ||
248 | //@{ | |
249 | /** | |
250 | Sets the brush colour using red, green and blue values. | |
251 | ||
252 | @see GetColour() | |
253 | */ | |
254 | void SetColour(wxColour& colour); | |
255 | void SetColour(const wxString& colourName); | |
256 | void SetColour(unsigned char red, unsigned char green, | |
257 | unsigned char blue); | |
258 | //@} | |
259 | ||
260 | /** | |
261 | Sets the stipple bitmap. | |
262 | ||
263 | @param bitmap | |
264 | The bitmap to use for stippling. | |
265 | ||
266 | @remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask | |
267 | associated to it, in which case the style will be set | |
268 | to wxSTIPPLE_MASK_OPAQUE. | |
269 | ||
270 | @see wxBitmap | |
271 | */ | |
272 | void SetStipple(const wxBitmap& bitmap); | |
273 | ||
274 | /** | |
275 | Sets the brush style. | |
276 | ||
277 | @param style | |
278 | One of: | |
279 | ||
280 | ||
281 | ||
282 | ||
283 | ||
284 | ||
285 | wxTRANSPARENT | |
286 | ||
287 | ||
288 | ||
289 | ||
290 | Transparent (no fill). | |
291 | ||
292 | ||
293 | ||
294 | ||
295 | ||
296 | wxSOLID | |
297 | ||
298 | ||
299 | ||
300 | ||
301 | Solid. | |
302 | ||
303 | ||
304 | ||
305 | ||
306 | ||
307 | wxBDIAGONAL_HATCH | |
308 | ||
309 | ||
310 | ||
311 | ||
312 | Backward diagonal hatch. | |
313 | ||
314 | ||
315 | ||
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() | |
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 | }; | |
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 |