]>
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 | ||
b5dbe15d | 19 | class WXDLLIMPEXP_FWD_CORE wxBrush; |
0e320a79 DW |
20 | |
21 | class WXDLLEXPORT wxBrushRefData: public wxGDIRefData | |
22 | { | |
b5dbe15d | 23 | friend class WXDLLIMPEXP_FWD_CORE wxBrush; |
0e320a79 DW |
24 | public: |
25 | wxBrushRefData(); | |
15f03b25 | 26 | wxBrushRefData(const wxBrushRefData& rData); |
d3c7fc99 | 27 | virtual ~wxBrushRefData(); |
0e320a79 | 28 | |
7aa920b5 VZ |
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 | ||
0e320a79 | 36 | protected: |
46562151 WS |
37 | int 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; | |
0e320a79 DW |
42 | }; |
43 | ||
44 | #define M_BRUSHDATA ((wxBrushRefData *)m_refData) | |
45 | ||
46 | // Brush | |
cb9d5bd0 | 47 | class WXDLLEXPORT wxBrush: public wxBrushBase |
0e320a79 | 48 | { |
15f03b25 | 49 | DECLARE_DYNAMIC_CLASS(wxBrush) |
0e320a79 DW |
50 | |
51 | public: | |
15f03b25 | 52 | wxBrush(); |
46562151 | 53 | wxBrush(const wxColour& rCol, int nStyle = wxSOLID); |
15f03b25 | 54 | wxBrush(const wxBitmap& rStipple); |
d3c7fc99 | 55 | virtual ~wxBrush(); |
15f03b25 | 56 | |
86e75e59 | 57 | bool operator == (const wxBrush& rBrush) const; |
55ccdb93 | 58 | inline bool operator != (const wxBrush& rBrush) const { return !(*this == rBrush); } |
15f03b25 DW |
59 | |
60 | virtual void SetColour(const wxColour& rColour); | |
1a1498c0 | 61 | virtual void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBrush); |
15f03b25 DW |
62 | virtual void SetPS(HPS hPS); |
63 | virtual void SetStyle(int nStyle) ; | |
64 | virtual void SetStipple(const wxBitmap& rStipple); | |
65 | ||
66 | inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); }; | |
cb9d5bd0 | 67 | virtual int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); }; |
15f03b25 DW |
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); }; | |
70 | ||
15f03b25 DW |
71 | // |
72 | // Implementation | |
73 | // | |
74 | ||
75 | // | |
76 | // Useful helper: create the brush resource | |
77 | // | |
78 | bool RealizeResource(void); | |
17b1d76b | 79 | virtual WXHANDLE GetResourceHandle(void) const; |
ab9d0a8c | 80 | bool FreeResource(bool bForce = false); |
15f03b25 DW |
81 | bool IsFree(void) const; |
82 | void Unshare(void); | |
83 | }; // end of CLASS wxBrush | |
0e320a79 DW |
84 | |
85 | #endif | |
86 | // _WX_BRUSH_H_ |