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
& rData
);
33 WXHBRUSH m_hBrush
; // in OS/2 GPI this will be the PS the pen is associated with
37 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
40 class WXDLLEXPORT wxBrush
: public wxGDIObject
42 DECLARE_DYNAMIC_CLASS(wxBrush
)
46 wxBrush( const wxColour
& rCol
49 wxBrush(const wxBitmap
& rStipple
);
50 inline wxBrush(const wxBrush
& rBrush
) { Ref(rBrush
); }
53 inline wxBrush
& operator = (const wxBrush
& rBrush
) { if (*this == rBrush
) return (*this); Ref(rBrush
); return *this; }
54 inline bool operator == (const wxBrush
& rBrush
) { return m_refData
== rBrush
.m_refData
; }
55 inline bool operator != (const wxBrush
& rBrush
) { return m_refData
!= rBrush
.m_refData
; }
57 virtual void SetColour(const wxColour
& rColour
);
58 virtual void SetColour( unsigned char cRed
62 virtual void SetPS(HPS hPS
);
63 virtual void SetStyle(int nStyle
) ;
64 virtual void SetStipple(const wxBitmap
& rStipple
);
66 inline wxColour
& GetColour(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_vColour
: wxNullColour
); };
67 inline int GetStyle(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_nStyle
: 0); };
68 inline wxBitmap
* GetStipple(void) const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_vStipple
: 0); };
69 inline int GetPS(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_hBrush
: 0); };
71 inline virtual bool Ok(void) const { return (m_refData
!= NULL
) ; }
78 // Useful helper: create the brush resource
80 bool RealizeResource(void);
81 WXHANDLE
GetResourceHandle(void) ;
82 bool FreeResource(bool bForce
= FALSE
);
83 bool IsFree(void) const;
85 }; // end of CLASS wxBrush