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