]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/brush.h
use wx-style header and commets; fix indentation to be 4 spaces; move Doxygen comment...
[wxWidgets.git] / include / wx / os2 / brush.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/brush.h
3 // Purpose: wxBrush class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/13/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BRUSH_H_
13 #define _WX_BRUSH_H_
14
15 #include "wx/gdicmn.h"
16 #include "wx/gdiobj.h"
17 #include "wx/bitmap.h"
18
19 class WXDLLIMPEXP_FWD_CORE wxBrush;
20
21 class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
22 {
23 friend class WXDLLIMPEXP_FWD_CORE wxBrush;
24 public:
25 wxBrushRefData();
26 wxBrushRefData(const wxBrushRefData& rData);
27 virtual ~wxBrushRefData();
28
29 bool operator == (const wxBrushRefData& data) const
30 {
31 return (m_nStyle == data.m_nStyle &&
32 m_vStipple.IsSameAs(data.m_vStipple) &&
33 m_vColour == data.m_vColour);
34 }
35
36 protected:
37 wxBrushStyle m_nStyle;
38 wxBitmap m_vStipple;
39 wxColour m_vColour;
40 WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with
41 AREABUNDLE m_vBundle;
42 };
43
44 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
45
46 // Brush
47 class WXDLLEXPORT wxBrush: public wxBrushBase
48 {
49 public:
50 wxBrush();
51 wxBrush(const wxColour& rCol, wxBrushStyle nStyle = wxBRUSHSTYLE_SOLID);
52 #if FUTURE_WXWIN_COMPATIBILITY_3_0
53 wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) );
54 #endif
55 wxBrush(const wxBitmap& rStipple);
56 virtual ~wxBrush();
57
58 bool operator == (const wxBrush& rBrush) const;
59 inline bool operator != (const wxBrush& rBrush) const { return !(*this == rBrush); }
60
61 virtual void SetColour(const wxColour& rColour);
62 virtual void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBrush);
63 virtual void SetPS(HPS hPS);
64 virtual void SetStyle(wxBrushStyle nStyle);
65 virtual void SetStipple(const wxBitmap& rStipple);
66
67 inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); };
68 virtual wxBrushStyle GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); };
69 inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); };
70 inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
71
72 //
73 // Implementation
74 //
75
76 //
77 // Useful helper: create the brush resource
78 //
79 bool RealizeResource(void);
80 virtual WXHANDLE GetResourceHandle(void) const;
81 bool FreeResource(bool bForce = false);
82 bool IsFree(void) const;
83
84 protected:
85 virtual wxGDIRefData *CreateGDIRefData() const;
86 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
87
88 private:
89 DECLARE_DYNAMIC_CLASS(wxBrush)
90 }; // end of CLASS wxBrush
91
92 #endif
93 // _WX_BRUSH_H_