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