]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/brush.h
fixed uninitialized wxGridCellAttr::m_defGridAttr (patch 491231)
[wxWidgets.git] / include / wx / mac / brush.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: brush.h
3 // Purpose: wxBrush class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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 typedef enum
26 {
27 kwxMacBrushColour ,
28 kwxMacBrushTheme ,
29 kwxMacBrushThemeBackground
30 } wxMacBrushKind ;
31
32 class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
33 {
34 friend class WXDLLEXPORT wxBrush;
35 public:
36 wxBrushRefData();
37 wxBrushRefData(const wxBrushRefData& data);
38 ~wxBrushRefData();
39
40 protected:
41 wxMacBrushKind m_macBrushKind ;
42 int m_style;
43 wxBitmap m_stipple ;
44 wxColour m_colour;
45
46 ThemeBrush m_macThemeBrush ;
47
48 ThemeBackgroundKind m_macThemeBackground ;
49 Rect m_macThemeBackgroundExtent ;
50 };
51
52 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
53
54 // Brush
55 class WXDLLEXPORT wxBrush: public wxGDIObject
56 {
57 DECLARE_DYNAMIC_CLASS(wxBrush)
58
59 public:
60 wxBrush();
61 wxBrush(ThemeBrush macThemeBrush ) ;
62 wxBrush(const wxColour& col, int style);
63 wxBrush(const wxBitmap& stipple);
64 inline wxBrush(const wxBrush& brush) { Ref(brush); }
65 ~wxBrush();
66
67 virtual void SetColour(const wxColour& col) ;
68 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
69 virtual void SetStyle(int style) ;
70 virtual void SetStipple(const wxBitmap& stipple) ;
71 virtual void SetMacTheme(ThemeBrush macThemeBrush) ;
72 virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground , const Rect &extent) ;
73
74 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
75 inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
76 inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
77
78 inline wxMacBrushKind MacGetBrushKind() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); };
79
80 ThemeBackgroundKind GetMacThemeBackground(Rect *extent) const ;
81 inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); };
82 inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
83 inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
84 inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
85
86 virtual bool Ok() const { return (m_refData != NULL) ; }
87
88 // Implementation
89
90 // Useful helper: create the brush resource
91 bool RealizeResource();
92
93 // When setting properties, we must make sure we're not changing
94 // another object
95 void Unshare();
96 };
97
98 #endif
99 // _WX_BRUSH_H_