]> git.saurik.com Git - wxWidgets.git/blame - src/motif/brush.cpp
added AppleEvent Handler, somehow the standard event handler does not take care of...
[wxWidgets.git] / src / motif / brush.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
7ecb8b06 2// Name: src/motif/brush.cpp
4bb6408c
JS
3// Purpose: wxBrush
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
7ecb8b06 9// Licence: wxWindows licence
4bb6408c
JS
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
4bb6408c 20IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
4bb6408c
JS
21
22wxBrushRefData::wxBrushRefData()
23{
24 m_style = wxSOLID;
4bb6408c
JS
25}
26
27wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
28{
2d120f83
JS
29 m_style = data.m_style;
30 m_stipple = data.m_stipple;
31 m_colour = data.m_colour;
4bb6408c
JS
32}
33
34wxBrushRefData::~wxBrushRefData()
35{
4bb6408c
JS
36}
37
38// Brushes
39wxBrush::wxBrush()
40{
4bb6408c
JS
41}
42
43wxBrush::~wxBrush()
44{
4bb6408c
JS
45}
46
47wxBrush::wxBrush(const wxColour& col, int Style)
48{
49 m_refData = new wxBrushRefData;
7ecb8b06 50
4bb6408c
JS
51 M_BRUSHDATA->m_colour = col;
52 M_BRUSHDATA->m_style = Style;
7ecb8b06 53
4bb6408c 54 RealizeResource();
4bb6408c
JS
55}
56
4bb6408c
JS
57wxBrush::wxBrush(const wxBitmap& stipple)
58{
59 m_refData = new wxBrushRefData;
7ecb8b06 60
4bb6408c
JS
61 M_BRUSHDATA->m_style = wxSTIPPLE;
62 M_BRUSHDATA->m_stipple = stipple;
7ecb8b06 63
4bb6408c 64 RealizeResource();
4bb6408c
JS
65}
66
67void wxBrush::Unshare()
68{
2d120f83
JS
69 // Don't change shared data
70 if (!m_refData)
4bb6408c 71 {
2d120f83
JS
72 m_refData = new wxBrushRefData();
73 }
4bb6408c
JS
74 else
75 {
2d120f83
JS
76 wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
77 UnRef();
78 m_refData = ref;
79 }
4bb6408c
JS
80}
81
82void wxBrush::SetColour(const wxColour& col)
83{
84 Unshare();
7ecb8b06 85
4bb6408c 86 M_BRUSHDATA->m_colour = col;
7ecb8b06 87
4bb6408c
JS
88 RealizeResource();
89}
90
e4a81a2e 91void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
4bb6408c
JS
92{
93 Unshare();
7ecb8b06 94
4bb6408c 95 M_BRUSHDATA->m_colour.Set(r, g, b);
7ecb8b06 96
4bb6408c
JS
97 RealizeResource();
98}
99
100void wxBrush::SetStyle(int Style)
101{
102 Unshare();
7ecb8b06 103
4bb6408c 104 M_BRUSHDATA->m_style = Style;
7ecb8b06 105
4bb6408c
JS
106 RealizeResource();
107}
108
109void wxBrush::SetStipple(const wxBitmap& Stipple)
110{
111 Unshare();
7ecb8b06 112
4bb6408c 113 M_BRUSHDATA->m_stipple = Stipple;
7ecb8b06 114
4bb6408c
JS
115 RealizeResource();
116}
117
dfc54541 118bool wxBrush::RealizeResource()
4bb6408c 119{
dfc54541
JS
120 // Nothing more to do
121 return TRUE;
4bb6408c
JS
122}
123