1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBrush class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "brush.h"
19 #include "wx/gdicmn.h"
20 #include "wx/gdiobj.h"
21 #include "wx/bitmap.h"
23 class WXDLLEXPORT wxBrush
;
29 kwxMacBrushThemeBackground
32 class WXDLLEXPORT wxBrushRefData
: public wxGDIRefData
34 friend class WXDLLEXPORT wxBrush
;
37 wxBrushRefData(const wxBrushRefData
& data
);
41 wxMacBrushKind m_macBrushKind
;
46 ThemeBrush m_macThemeBrush
;
48 ThemeBackgroundKind m_macThemeBackground
;
49 Rect m_macThemeBackgroundExtent
;
52 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
55 class WXDLLEXPORT wxBrush
: public wxGDIObject
57 DECLARE_DYNAMIC_CLASS(wxBrush
)
61 wxBrush(ThemeBrush macThemeBrush
) ;
62 wxBrush(const wxColour
& col
, int style
);
63 wxBrush(const wxBitmap
& stipple
);
64 inline wxBrush(const wxBrush
& brush
) { Ref(brush
); }
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
) ;
71 virtual void SetMacTheme(ThemeBrush macThemeBrush
) ;
72 virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground
, const Rect
&extent
) ;
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
; }
78 inline wxMacBrushKind
MacGetBrushKind() const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_macBrushKind
: kwxMacBrushColour
); };
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
); };
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); };
86 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
90 // Useful helper: create the brush resource
91 bool RealizeResource();
93 // When setting properties, we must make sure we're not changing