]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/qt/pen.cpp
removed now obsoleted commented-out piece of code
[wxWidgets.git] / src / qt / pen.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: pen.cpp
3// Purpose: wxPen
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 "pen.h"
14#endif
15
16#include "wx/setup.h"
17#include "wx/utils.h"
18#include "wx/pen.h"
19
20IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
21
22wxPenRefData::wxPenRefData()
23{
24 m_style = wxSOLID;
25 m_width = 1;
26 m_join = wxJOIN_ROUND ;
27 m_cap = wxCAP_ROUND ;
28 m_nbDash = 0 ;
29 m_dash = (wxQTDash*)NULL;
30/* TODO: null data
31 m_hPen = 0;
32*/
33}
34
35wxPenRefData::wxPenRefData(const wxPenRefData& data)
36{
37 m_style = data.m_style;
38 m_width = data.m_width;
39 m_join = data.m_join;
40 m_cap = data.m_cap;
41 m_nbDash = data.m_nbDash;
42 m_dash = data.m_dash;
43 m_colour = data.m_colour;
44/* TODO: null data
45 m_hPen = 0;
46*/
47}
48
49wxPenRefData::~wxPenRefData()
50{
51 // TODO: delete data
52}
53
54// Pens
55
56wxPen::wxPen()
57{
58 if ( wxThePenList )
59 wxThePenList->AddPen(this);
60}
61
62wxPen::~wxPen()
63{
64 if (wxThePenList)
65 wxThePenList->RemovePen(this);
66}
67
68// Should implement Create
69wxPen::wxPen(const wxColour& col, int Width, int Style)
70{
71 m_refData = new wxPenRefData;
72
73 M_PENDATA->m_colour = col;
74 M_PENDATA->m_width = Width;
75 M_PENDATA->m_style = Style;
76 M_PENDATA->m_join = wxJOIN_ROUND ;
77 M_PENDATA->m_cap = wxCAP_ROUND ;
78 M_PENDATA->m_nbDash = 0 ;
79 M_PENDATA->m_dash = (wxQTDash*)NULL;
80
81 RealizeResource();
82
83 if ( wxThePenList )
84 wxThePenList->AddPen(this);
85}
86
87wxPen::wxPen(const wxBitmap& stipple, int Width)
88{
89 m_refData = new wxPenRefData;
90
91 M_PENDATA->m_stipple = stipple;
92 M_PENDATA->m_width = Width;
93 M_PENDATA->m_style = wxSTIPPLE;
94 M_PENDATA->m_join = wxJOIN_ROUND ;
95 M_PENDATA->m_cap = wxCAP_ROUND ;
96 M_PENDATA->m_nbDash = 0 ;
97 M_PENDATA->m_dash = (wxQTDash*)NULL;
98
99 RealizeResource();
100
101 if ( wxThePenList )
102 wxThePenList->AddPen(this);
103}
104
105wxPen::wxPen(const wxString& col, int Width, int Style)
106{
107 m_refData = new wxPenRefData;
108
109 M_PENDATA->m_colour = col;
110 M_PENDATA->m_width = Width;
111 M_PENDATA->m_style = Style;
112 M_PENDATA->m_join = wxJOIN_ROUND ;
113 M_PENDATA->m_cap = wxCAP_ROUND ;
114 M_PENDATA->m_nbDash = 0 ;
115 M_PENDATA->m_dash = (wxQTDash*)NULL;
116
117 RealizeResource();
118
119 if ( wxThePenList )
120 wxThePenList->AddPen(this);
121}
122
123void wxPen::Unshare()
124{
125 // Don't change shared data
126 if (!m_refData)
127 {
128 m_refData = new wxPenRefData();
129 }
130 else
131 {
132 wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
133 UnRef();
134 m_refData = ref;
135 }
136}
137
138void wxPen::SetColour(const wxColour& col)
139{
140 Unshare();
141
142 M_PENDATA->m_colour = col;
143
144 RealizeResource();
145}
146
147void wxPen::SetColour(const wxString& col)
148{
149 Unshare();
150
151 M_PENDATA->m_colour = col;
152
153 RealizeResource();
154}
155
156void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
157{
158 Unshare();
159
160 M_PENDATA->m_colour.Set(r, g, b);
161
162 RealizeResource();
163}
164
165void wxPen::SetWidth(int Width)
166{
167 Unshare();
168
169 M_PENDATA->m_width = Width;
170
171 RealizeResource();
172}
173
174void wxPen::SetStyle(int Style)
175{
176 Unshare();
177
178 M_PENDATA->m_style = Style;
179
180 RealizeResource();
181}
182
183void wxPen::SetStipple(const wxBitmap& Stipple)
184{
185 Unshare();
186
187 M_PENDATA->m_stipple = Stipple;
188 M_PENDATA->m_style = wxSTIPPLE;
189
190 RealizeResource();
191}
192
193void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
194{
195 Unshare();
196
197 M_PENDATA->m_nbDash = nb_dashes;
198 M_PENDATA->m_dash = (wxQTDash *)Dash;
199
200 RealizeResource();
201}
202
203void wxPen::SetJoin(int Join)
204{
205 Unshare();
206
207 M_PENDATA->m_join = Join;
208
209 RealizeResource();
210}
211
212void wxPen::SetCap(int Cap)
213{
214 Unshare();
215
216 M_PENDATA->m_cap = Cap;
217
218 RealizeResource();
219}
220
221bool wxPen::RealizeResource()
222{
223 // TODO: create actual pen
224 return FALSE;
225}
226
227