]> git.saurik.com Git - wxWidgets.git/blob - src/stubs/brush.cpp
added default ctor for wxDirDialog
[wxWidgets.git] / src / stubs / brush.cpp
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
21 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
22 #endif
23
24 wxBrushRefData::wxBrushRefData()
25 {
26 m_style = wxSOLID;
27 // TODO: null data
28 }
29
30 wxBrushRefData::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
40 wxBrushRefData::~wxBrushRefData()
41 {
42 // TODO: delete data
43 }
44
45 // Brushes
46 wxBrush::wxBrush()
47 {
48 if ( wxTheBrushList )
49 wxTheBrushList->AddBrush(this);
50 }
51
52 wxBrush::~wxBrush()
53 {
54 if ( wxTheBrushList )
55 wxTheBrushList->RemoveBrush(this);
56 }
57
58 wxBrush::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
71 wxBrush::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
84 void 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
99 void wxBrush::SetColour(const wxColour& col)
100 {
101 Unshare();
102
103 M_BRUSHDATA->m_colour = col;
104
105 RealizeResource();
106 }
107
108 void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
109 {
110 Unshare();
111
112 M_BRUSHDATA->m_colour.Set(r, g, b);
113
114 RealizeResource();
115 }
116
117 void wxBrush::SetStyle(int Style)
118 {
119 Unshare();
120
121 M_BRUSHDATA->m_style = Style;
122
123 RealizeResource();
124 }
125
126 void wxBrush::SetStipple(const wxBitmap& Stipple)
127 {
128 Unshare();
129
130 M_BRUSHDATA->m_stipple = Stipple;
131
132 RealizeResource();
133 }
134
135 bool wxBrush::RealizeResource()
136 {
137 // TODO: create the brush
138 return FALSE;
139 }
140