1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBrush class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
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
;
25 class WXDLLEXPORT wxBrushRefData
: public wxGDIRefData
27 friend class WXDLLEXPORT wxBrush
;
30 wxBrushRefData(const wxBrushRefData
& data
);
39 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
42 class WXDLLEXPORT wxBrush
: public wxGDIObject
44 DECLARE_DYNAMIC_CLASS(wxBrush
)
48 wxBrush(const wxColour
& col
, int style
);
49 wxBrush(const wxBitmap
& stipple
);
50 inline wxBrush(const wxBrush
& brush
) { Ref(brush
); }
53 virtual void SetColour(const wxColour
& col
) ;
54 virtual void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
55 virtual void SetStyle(int style
) ;
56 virtual void SetStipple(const wxBitmap
& stipple
) ;
58 inline wxBrush
& operator = (const wxBrush
& brush
) { if (*this == brush
) return (*this); Ref(brush
); return *this; }
59 inline bool operator == (const wxBrush
& brush
) { return m_refData
== brush
.m_refData
; }
60 inline bool operator != (const wxBrush
& brush
) { return m_refData
!= brush
.m_refData
; }
62 inline wxColour
& GetColour() const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_colour
: wxNullColour
); };
63 inline int GetStyle() const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_style
: 0); };
64 inline wxBitmap
*GetStipple() const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_stipple
: 0); };
66 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
70 // Useful helper: create the brush resource
71 bool RealizeResource();
73 // When setting properties, we must make sure we're not changing