]> git.saurik.com Git - wxWidgets.git/blame - src/mac/brush.cpp
fix for using wxDataObjectComposite with the clipboard
[wxWidgets.git] / src / mac / brush.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: brush.cpp
3// Purpose: wxBrush
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "brush.h"
14#endif
15
16#include "wx/setup.h"
17#include "wx/utils.h"
18#include "wx/brush.h"
19
2f1ae414 20#if !USE_SHARED_LIBRARIES
e9576ca5 21IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
2f1ae414 22#endif
e9576ca5
SC
23
24wxBrushRefData::wxBrushRefData()
25{
26 m_style = wxSOLID;
e9576ca5
SC
27}
28
29wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
30{
31 m_style = data.m_style;
32 m_stipple = data.m_stipple;
33 m_colour = data.m_colour;
e9576ca5
SC
34}
35
36wxBrushRefData::~wxBrushRefData()
37{
e9576ca5
SC
38}
39
40// Brushes
41wxBrush::wxBrush()
42{
e9576ca5
SC
43}
44
45wxBrush::~wxBrush()
46{
e9576ca5
SC
47}
48
49wxBrush::wxBrush(const wxColour& col, int Style)
50{
51 m_refData = new wxBrushRefData;
52
53 M_BRUSHDATA->m_colour = col;
54 M_BRUSHDATA->m_style = Style;
55
56 RealizeResource();
e9576ca5
SC
57}
58
59wxBrush::wxBrush(const wxBitmap& stipple)
60{
61 m_refData = new wxBrushRefData;
62
63 M_BRUSHDATA->m_style = wxSTIPPLE;
64 M_BRUSHDATA->m_stipple = stipple;
65
66 RealizeResource();
e9576ca5
SC
67}
68
69void wxBrush::Unshare()
70{
71 // Don't change shared data
72 if (!m_refData)
73 {
74 m_refData = new wxBrushRefData();
75 }
76 else
77 {
78 wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
79 UnRef();
80 m_refData = ref;
81 }
82}
83
84void wxBrush::SetColour(const wxColour& col)
85{
86 Unshare();
87
88 M_BRUSHDATA->m_colour = col;
89
90 RealizeResource();
91}
92
93void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
94{
95 Unshare();
96
97 M_BRUSHDATA->m_colour.Set(r, g, b);
98
99 RealizeResource();
100}
101
102void wxBrush::SetStyle(int Style)
103{
104 Unshare();
105
106 M_BRUSHDATA->m_style = Style;
107
108 RealizeResource();
109}
110
111void wxBrush::SetStipple(const wxBitmap& Stipple)
112{
113 Unshare();
114
115 M_BRUSHDATA->m_stipple = Stipple;
116
117 RealizeResource();
118}
119
120bool wxBrush::RealizeResource()
121{
519cb848 122 return TRUE;
e9576ca5
SC
123}
124