]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/brush.h
function HasValue() added
[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 and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __BRUSHH__
13 #define __BRUSHH__
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(void);
31
32 protected:
33 int m_style;
34 wxBitmap m_stipple ;
35 wxColour m_colour;
36 WXHBRUSH m_hBrush;
37 };
38
39 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
40
41 // Brush
42 class WXDLLEXPORT wxBrush: public wxGDIObject
43 {
44 DECLARE_DYNAMIC_CLASS(wxBrush)
45
46 public:
47 wxBrush(void);
48 wxBrush(const wxColour& col, const int style);
49 wxBrush(const wxString& col, const int style);
50 wxBrush(const wxBitmap& stipple);
51 inline wxBrush(const wxBrush& brush) { Ref(brush); }
52 inline wxBrush(const wxBrush* brush) { /* UnRef(); */ if (brush) Ref(*brush); }
53 ~wxBrush(void);
54
55 virtual void SetColour(const wxColour& col) ;
56 virtual void SetColour(const wxString& col) ;
57 virtual void SetColour(const unsigned char r, const unsigned char g, const unsigned char b) ;
58 virtual void SetStyle(const int style) ;
59 virtual void SetStipple(const wxBitmap& stipple) ;
60
61 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
62 inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
63 inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
64
65 inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
66 inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
67 inline wxBitmap *GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
68
69 virtual bool Ok(void) const { return (m_refData != NULL) ; }
70
71 // Internal
72 bool RealizeResource(void);
73 WXHANDLE GetResourceHandle(void) ;
74 bool FreeResource(bool force = FALSE);
75 /*
76 bool UseResource(void);
77 bool ReleaseResource(void);
78 */
79
80 bool IsFree(void);
81 };
82
83 #endif
84 // __BRUSHH__