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 WXDLLIMPEXP_FWD_CORE wxBrush
;
21 class WXDLLEXPORT wxBrushRefData
: public wxGDIRefData
23 friend class WXDLLIMPEXP_FWD_CORE wxBrush
;
26 wxBrushRefData(const wxBrushRefData
& rData
);
27 virtual ~wxBrushRefData();
29 bool operator == (const wxBrushRefData
& data
) const
31 return (m_nStyle
== data
.m_nStyle
&&
32 m_vStipple
.IsSameAs(data
.m_vStipple
) &&
33 m_vColour
== data
.m_vColour
);
40 WXHBRUSH m_hBrush
; // in OS/2 GPI this will be the PS the pen is associated with
44 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
47 class WXDLLEXPORT wxBrush
: public wxBrushBase
51 wxBrush(const wxColour
& rCol
, int nStyle
= wxSOLID
);
52 wxBrush(const wxBitmap
& rStipple
);
55 bool operator == (const wxBrush
& rBrush
) const;
56 inline bool operator != (const wxBrush
& rBrush
) const { return !(*this == rBrush
); }
58 virtual void SetColour(const wxColour
& rColour
);
59 virtual void SetColour(unsigned char cRed
, unsigned char cGreen
, unsigned char cBrush
);
60 virtual void SetPS(HPS hPS
);
61 virtual void SetStyle(int nStyle
) ;
62 virtual void SetStipple(const wxBitmap
& rStipple
);
64 inline wxColour
& GetColour(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_vColour
: wxNullColour
); };
65 virtual int GetStyle(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_nStyle
: 0); };
66 inline wxBitmap
* GetStipple(void) const { return (M_BRUSHDATA
? & M_BRUSHDATA
->m_vStipple
: 0); };
67 inline int GetPS(void) const { return (M_BRUSHDATA
? M_BRUSHDATA
->m_hBrush
: 0); };
74 // Useful helper: create the brush resource
76 bool RealizeResource(void);
77 virtual WXHANDLE
GetResourceHandle(void) const;
78 bool FreeResource(bool bForce
= false);
79 bool IsFree(void) const;
82 virtual wxGDIRefData
*CreateGDIRefData() const;
83 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
86 DECLARE_DYNAMIC_CLASS(wxBrush
)
87 }; // end of CLASS wxBrush