1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBrush class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/gdicmn.h"
16 #include "wx/gdiobj.h"
17 #include "wx/bitmap.h"
19 class WXDLLEXPORT wxBrush
;
21 class WXDLLEXPORT wxBrushRefData
: public wxGDIRefData
23 friend class WXDLLEXPORT wxBrush
;
26 wxBrushRefData(const wxBrushRefData
& data
);
36 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
39 class WXDLLEXPORT wxBrush
: public wxGDIObject
41 DECLARE_DYNAMIC_CLASS(wxBrush
)
45 wxBrush(const wxColour
& col
, int style
);
46 wxBrush(const wxBitmap
& stipple
);
47 inline wxBrush(const wxBrush
& brush
) { Ref(brush
); }
50 virtual void SetColour(const wxColour
& col
) ;
51 virtual void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
52 virtual void SetStyle(int style
) ;
53 virtual void SetStipple(const wxBitmap
& stipple
) ;
55 inline wxBrush
& operator = (const wxBrush
& brush
) { if (*this == brush
) return (*this); Ref(brush
); return *this; }
56 inline bool operator == (const wxBrush
& brush
) { return m_refData
== brush
.m_refData
; }
57 inline bool operator != (const wxBrush
& brush
) { return m_refData
!= brush
.m_refData
; }
59 inline wxColour
& GetColour() const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_colour
: wxNullColour
); };
60 inline int GetStyle() const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_style
: 0); };
61 inline wxBitmap
*GetStipple() const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_stipple
: 0); };
63 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
67 // Useful helper: create the brush resource
68 bool RealizeResource();
70 WXHANDLE
GetResourceHandle(void) ;
71 bool FreeResource(bool force
= FALSE
);
74 // When setting properties, we must make sure we're not changing