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