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
);
31 ~wxBrushRefData(void);
40 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
43 class WXDLLEXPORT wxBrush
: public wxGDIObject
45 DECLARE_DYNAMIC_CLASS(wxBrush
)
49 wxBrush(const wxColour
& col
, int style
);
50 wxBrush(const wxBitmap
& stipple
);
51 inline wxBrush(const wxBrush
& brush
) { Ref(brush
); }
54 virtual void SetColour(const wxColour
& col
) ;
55 virtual void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
56 virtual void SetStyle(int style
) ;
57 virtual void SetStipple(const wxBitmap
& stipple
) ;
59 inline wxBrush
& operator = (const wxBrush
& brush
) { if (*this == brush
) return (*this); Ref(brush
); return *this; }
60 inline bool operator == (const wxBrush
& brush
) { return m_refData
== brush
.m_refData
; }
61 inline bool operator != (const wxBrush
& brush
) { return m_refData
!= brush
.m_refData
; }
63 inline wxColour
& GetColour(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_colour
: wxNullColour
); };
64 inline int GetStyle(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_style
: 0); };
65 inline wxBitmap
*GetStipple(void) const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_stipple
: 0); };
67 virtual bool Ok(void) const { return (m_refData
!= NULL
) ; }
70 bool RealizeResource(void);
71 WXHANDLE
GetResourceHandle(void) ;
72 bool FreeResource(bool force
= FALSE
);