]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: brush.h | |
01b2eeec KB |
3 | // Purpose: wxBrush class |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
01b2eeec KB |
12 | #ifndef _WX_BRUSH_H_ |
13 | #define _WX_BRUSH_H_ | |
7c78e7c7 RR |
14 | |
15 | #ifdef __GNUG__ | |
01b2eeec | 16 | #pragma interface "brush.h" |
7c78e7c7 RR |
17 | #endif |
18 | ||
01b2eeec | 19 | #include "wx/gdicmn.h" |
7c78e7c7 RR |
20 | #include "wx/gdiobj.h" |
21 | #include "wx/bitmap.h" | |
22 | ||
01b2eeec KB |
23 | class WXDLLEXPORT wxBrush; |
24 | ||
25 | class WXDLLEXPORT wxBrushRefData: public wxGDIRefData | |
26 | { | |
27 | friend class WXDLLEXPORT wxBrush; | |
28 | public: | |
29 | wxBrushRefData(); | |
30 | wxBrushRefData(const wxBrushRefData& data); | |
31 | ~wxBrushRefData(); | |
7c78e7c7 | 32 | |
01b2eeec KB |
33 | protected: |
34 | int m_style; | |
35 | wxBitmap m_stipple ; | |
36 | wxColour m_colour; | |
7c78e7c7 | 37 | |
01b2eeec KB |
38 | /* TODO: implementation |
39 | WXHBRUSH m_hBrush; | |
40 | */ | |
41 | }; | |
7c78e7c7 | 42 | |
01b2eeec KB |
43 | #define M_BRUSHDATA ((wxBrushRefData *)m_refData) |
44 | ||
45 | // Brush | |
46 | class WXDLLEXPORT wxBrush: public wxGDIObject | |
7c78e7c7 RR |
47 | { |
48 | DECLARE_DYNAMIC_CLASS(wxBrush) | |
49 | ||
01b2eeec KB |
50 | public: |
51 | wxBrush(); | |
52 | wxBrush(const wxColour& col, int style); | |
53 | wxBrush(const wxString& col, int style); | |
54 | wxBrush(const wxBitmap& stipple); | |
55 | inline wxBrush(const wxBrush& brush) { Ref(brush); } | |
56 | inline wxBrush(const wxBrush* brush) { if (brush) Ref(*brush); } | |
57 | ~wxBrush(); | |
58 | ||
59 | virtual void SetColour(const wxColour& col) ; | |
60 | virtual void SetColour(const wxString& col) ; | |
61 | virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; | |
62 | virtual void SetStyle(int style) ; | |
63 | virtual void SetStipple(const wxBitmap& stipple) ; | |
64 | ||
65 | inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; } | |
66 | inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; } | |
67 | inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; } | |
68 | ||
69 | inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); }; | |
70 | inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); }; | |
71 | inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); }; | |
72 | ||
73 | virtual bool Ok() const { return (m_refData != NULL) ; } | |
74 | ||
75 | // Implementation | |
76 | ||
77 | // Useful helper: create the brush resource | |
78 | void RealizeResource(); | |
79 | ||
80 | // When setting properties, we must make sure we're not changing | |
81 | // another object | |
82 | void Unshare(); | |
7c78e7c7 RR |
83 | }; |
84 | ||
01b2eeec KB |
85 | #endif |
86 | // _WX_BRUSH_H_ |