]> git.saurik.com Git - wxWidgets.git/blame - src/stubs/brush.cpp
String changes for translations,
[wxWidgets.git] / src / stubs / brush.cpp
CommitLineData
93cf77c0
JS
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
20#if !USE_SHARED_LIBRARIES
21IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
22#endif
23
24wxBrushRefData::wxBrushRefData()
25{
26 m_style = wxSOLID;
27// TODO: null data
28}
29
30wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
31{
32 m_style = data.m_style;
33 m_stipple = data.m_stipple;
34 m_colour = data.m_colour;
35/* TODO: null data
36 m_hBrush = 0;
37*/
38}
39
40wxBrushRefData::~wxBrushRefData()
41{
42// TODO: delete data
43}
44
45// Brushes
46wxBrush::wxBrush()
47{
48 if ( wxTheBrushList )
49 wxTheBrushList->AddBrush(this);
50}
51
52wxBrush::~wxBrush()
53{
54 if ( wxTheBrushList )
55 wxTheBrushList->RemoveBrush(this);
56}
57
58wxBrush::wxBrush(const wxColour& col, int Style)
59{
60 m_refData = new wxBrushRefData;
61
62 M_BRUSHDATA->m_colour = col;
63 M_BRUSHDATA->m_style = Style;
64
65 RealizeResource();
66
67 if ( wxTheBrushList )
68 wxTheBrushList->AddBrush(this);
69}
70
93cf77c0
JS
71wxBrush::wxBrush(const wxBitmap& stipple)
72{
73 m_refData = new wxBrushRefData;
74
75 M_BRUSHDATA->m_style = wxSTIPPLE;
76 M_BRUSHDATA->m_stipple = stipple;
77
78 RealizeResource();
79
80 if ( wxTheBrushList )
81 wxTheBrushList->AddBrush(this);
82}
83
84void wxBrush::Unshare()
85{
86 // Don't change shared data
87 if (!m_refData)
88 {
89 m_refData = new wxBrushRefData();
90 }
91 else
92 {
93 wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
94 UnRef();
95 m_refData = ref;
96 }
97}
98
99void wxBrush::SetColour(const wxColour& col)
100{
101 Unshare();
102
103 M_BRUSHDATA->m_colour = col;
104
105 RealizeResource();
106}
107
e4a81a2e 108void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
93cf77c0
JS
109{
110 Unshare();
111
112 M_BRUSHDATA->m_colour.Set(r, g, b);
113
114 RealizeResource();
115}
116
117void wxBrush::SetStyle(int Style)
118{
119 Unshare();
120
121 M_BRUSHDATA->m_style = Style;
122
123 RealizeResource();
124}
125
126void wxBrush::SetStipple(const wxBitmap& Stipple)
127{
128 Unshare();
129
130 M_BRUSHDATA->m_stipple = Stipple;
131
132 RealizeResource();
133}
134
dfc54541 135bool wxBrush::RealizeResource()
93cf77c0
JS
136{
137// TODO: create the brush
dfc54541 138 return FALSE;
93cf77c0
JS
139}
140