]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/brush.h
added support for appearance brushes
[wxWidgets.git] / include / wx / mac / brush.h
CommitLineData
0dbd6262
SC
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
23class WXDLLEXPORT wxBrush;
24
25class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
26{
27 friend class WXDLLEXPORT wxBrush;
28public:
29 wxBrushRefData();
30 wxBrushRefData(const wxBrushRefData& data);
31 ~wxBrushRefData();
32
33protected:
34 int m_style;
35 wxBitmap m_stipple ;
36 wxColour m_colour;
0ff8e4b5
SC
37 bool m_isMacTheme ;
38 ThemeBrush m_macThemeBrush ;
39 bool m_isMacThemeBackground ;
40 ThemeBackgroundKind m_macThemeBackground ;
0dbd6262
SC
41};
42
43#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
44
45// Brush
46class WXDLLEXPORT wxBrush: public wxGDIObject
47{
48 DECLARE_DYNAMIC_CLASS(wxBrush)
49
50public:
51 wxBrush();
0ff8e4b5 52 wxBrush(ThemeBrush macThemeBrush ) ;
0dbd6262
SC
53 wxBrush(const wxColour& col, int style);
54 wxBrush(const wxBitmap& stipple);
55 inline wxBrush(const wxBrush& brush) { Ref(brush); }
56 ~wxBrush();
57
58 virtual void SetColour(const wxColour& col) ;
59 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
60 virtual void SetStyle(int style) ;
61 virtual void SetStipple(const wxBitmap& stipple) ;
0ff8e4b5
SC
62 virtual void SetMacTheme(ThemeBrush macThemeBrush) ;
63 virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground ) ;
0dbd6262
SC
64
65 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
66 inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
67 inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
68
0ff8e4b5
SC
69 inline bool IsMacTheme() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacTheme : false); };
70 inline bool IsMacThemeBackground() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacThemeBackground : false); };
71 inline ThemeBackgroundKind GetMacThemeBackground() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacThemeBackground ? M_BRUSHDATA->m_macThemeBackground : 0) : 0); };
72 inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); };
0dbd6262
SC
73 inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
74 inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
75 inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
76
77 virtual bool Ok() const { return (m_refData != NULL) ; }
78
79// Implementation
80
81 // Useful helper: create the brush resource
82 bool RealizeResource();
83
84 // When setting properties, we must make sure we're not changing
85 // another object
86 void Unshare();
87};
88
89#endif
90 // _WX_BRUSH_H_