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