1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/brush.h
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
);
27 virtual ~wxBrushRefData();
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 wxBrushBase
42 DECLARE_DYNAMIC_CLASS(wxBrush
)
46 wxBrush(const wxColour
& rCol
, int nStyle
= wxSOLID
);
47 wxBrush(const wxBitmap
& rStipple
);
50 inline bool operator == (const wxBrush
& rBrush
) const { return m_refData
== rBrush
.m_refData
; }
51 inline bool operator != (const wxBrush
& rBrush
) const { return m_refData
!= rBrush
.m_refData
; }
53 virtual void SetColour(const wxColour
& rColour
);
54 virtual void SetColour(unsigned char cRed
, unsigned char cGreen
, unsigned char cBrush
);
55 virtual void SetPS(HPS hPS
);
56 virtual void SetStyle(int nStyle
) ;
57 virtual void SetStipple(const wxBitmap
& rStipple
);
59 inline wxColour
& GetColour(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_vColour
: wxNullColour
); };
60 virtual int GetStyle(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_nStyle
: 0); };
61 inline wxBitmap
* GetStipple(void) const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_vStipple
: 0); };
62 inline int GetPS(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_hBrush
: 0); };
64 inline virtual bool Ok() const { return IsOk(); }
65 inline virtual bool IsOk(void) const { return (m_refData
!= NULL
) ; }
72 // Useful helper: create the brush resource
74 bool RealizeResource(void);
75 WXHANDLE
GetResourceHandle(void) ;
76 bool FreeResource(bool bForce
= false);
77 bool IsFree(void) const;
79 }; // end of CLASS wxBrush