]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
46562151 | 2 | // Name: wx/os2/brush.h |
0e320a79 | 3 | // Purpose: wxBrush class |
37f214d5 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
37f214d5 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
37f214d5 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_BRUSH_H_ | |
13 | #define _WX_BRUSH_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/gdicmn.h" |
16 | #include "wx/gdiobj.h" | |
17 | #include "wx/bitmap.h" | |
18 | ||
19 | class WXDLLEXPORT wxBrush; | |
20 | ||
21 | class WXDLLEXPORT wxBrushRefData: public wxGDIRefData | |
22 | { | |
23 | friend class WXDLLEXPORT wxBrush; | |
24 | public: | |
25 | wxBrushRefData(); | |
15f03b25 | 26 | wxBrushRefData(const wxBrushRefData& rData); |
d3c7fc99 | 27 | virtual ~wxBrushRefData(); |
0e320a79 DW |
28 | |
29 | protected: | |
46562151 WS |
30 | int m_nStyle; |
31 | wxBitmap m_vStipple ; | |
32 | wxColour m_vColour; | |
33 | WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with | |
34 | AREABUNDLE m_vBundle; | |
0e320a79 DW |
35 | }; |
36 | ||
37 | #define M_BRUSHDATA ((wxBrushRefData *)m_refData) | |
38 | ||
39 | // Brush | |
cb9d5bd0 | 40 | class WXDLLEXPORT wxBrush: public wxBrushBase |
0e320a79 | 41 | { |
15f03b25 | 42 | DECLARE_DYNAMIC_CLASS(wxBrush) |
0e320a79 DW |
43 | |
44 | public: | |
15f03b25 | 45 | wxBrush(); |
46562151 | 46 | wxBrush(const wxColour& rCol, int nStyle = wxSOLID); |
15f03b25 | 47 | wxBrush(const wxBitmap& rStipple); |
d3c7fc99 | 48 | virtual ~wxBrush(); |
15f03b25 | 49 | |
ba2de0a1 SN |
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; } | |
15f03b25 DW |
52 | |
53 | virtual void SetColour(const wxColour& rColour); | |
1a1498c0 | 54 | virtual void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBrush); |
15f03b25 DW |
55 | virtual void SetPS(HPS hPS); |
56 | virtual void SetStyle(int nStyle) ; | |
57 | virtual void SetStipple(const wxBitmap& rStipple); | |
58 | ||
59 | inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); }; | |
cb9d5bd0 | 60 | virtual int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); }; |
15f03b25 DW |
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); }; | |
63 | ||
b7cacb43 VZ |
64 | inline virtual bool Ok() const { return IsOk(); } |
65 | inline virtual bool IsOk(void) const { return (m_refData != NULL) ; } | |
15f03b25 DW |
66 | |
67 | // | |
68 | // Implementation | |
69 | // | |
70 | ||
71 | // | |
72 | // Useful helper: create the brush resource | |
73 | // | |
74 | bool RealizeResource(void); | |
17b1d76b | 75 | virtual WXHANDLE GetResourceHandle(void) const; |
ab9d0a8c | 76 | bool FreeResource(bool bForce = false); |
15f03b25 DW |
77 | bool IsFree(void) const; |
78 | void Unshare(void); | |
79 | }; // end of CLASS wxBrush | |
0e320a79 DW |
80 | |
81 | #endif | |
82 | // _WX_BRUSH_H_ |