]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/brush.h
Added missing declaration of wxIcon::operator =(const wxIcon &)
[wxWidgets.git] / include / wx / msw / brush.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: brush.h
3 // Purpose: wxBrush class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BRUSH_H_
13 #define _WX_BRUSH_H_
14
15 #ifdef __GNUG__
16 #pragma interface "brush.h"
17 #endif
18
19 #include "wx/gdicmn.h"
20 #include "wx/gdiobj.h"
21 #include "wx/bitmap.h"
22
23 class WXDLLEXPORT wxBrush;
24
25 class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
26 {
27 friend class WXDLLEXPORT wxBrush;
28 public:
29 wxBrushRefData(void);
30 wxBrushRefData(const wxBrushRefData& data);
31 ~wxBrushRefData(void);
32
33 protected:
34 int m_style;
35 wxBitmap m_stipple ;
36 wxColour m_colour;
37 WXHBRUSH m_hBrush;
38 };
39
40 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
41
42 // Brush
43 class WXDLLEXPORT wxBrush: public wxGDIObject
44 {
45 DECLARE_DYNAMIC_CLASS(wxBrush)
46
47 public:
48 wxBrush(void);
49 wxBrush(const wxColour& col, int style);
50 wxBrush(const wxString& col, int style);
51 wxBrush(const wxBitmap& stipple);
52 inline wxBrush(const wxBrush& brush) { Ref(brush); }
53 inline wxBrush(const wxBrush* brush) { if (brush) Ref(*brush); }
54 ~wxBrush(void);
55
56 virtual void SetColour(const wxColour& col) ;
57 virtual void SetColour(const wxString& col) ;
58 virtual void SetColour(const unsigned char r, const unsigned char g, const unsigned char b) ;
59 virtual void SetStyle(int style) ;
60 virtual void SetStipple(const wxBitmap& stipple) ;
61
62 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
63 inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
64 inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
65
66 inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
67 inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
68 inline wxBitmap *GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
69
70 virtual bool Ok(void) const { return (m_refData != NULL) ; }
71
72 // Internal
73 bool RealizeResource(void);
74 WXHANDLE GetResourceHandle(void) ;
75 bool FreeResource(bool force = FALSE);
76 bool IsFree(void);
77 void Unshare();
78 };
79
80 #endif
81 // _WX_BRUSH_H_