]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/pen.cpp
corrected wake up code
[wxWidgets.git] / src / mac / carbon / pen.cpp
CommitLineData
e9576ca5 1/////////////////////////////////////////////////////////////////////////////
46562151 2// Name: src/mac/carbon/pen.cpp
e9576ca5 3// Purpose: wxPen
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
46562151 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878
SC
12#include "wx/wxprec.h"
13
e9576ca5
SC
14#include "wx/utils.h"
15#include "wx/pen.h"
16
e9576ca5 17IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
e9576ca5
SC
18
19wxPenRefData::wxPenRefData()
20{
21 m_style = wxSOLID;
22 m_width = 1;
23 m_join = wxJOIN_ROUND ;
24 m_cap = wxCAP_ROUND ;
25 m_nbDash = 0 ;
2f1ae414 26 m_dash = 0 ;
e9576ca5
SC
27}
28
29wxPenRefData::wxPenRefData(const wxPenRefData& data)
e40298d5 30: wxGDIRefData()
e9576ca5
SC
31{
32 m_style = data.m_style;
33 m_width = data.m_width;
34 m_join = data.m_join;
35 m_cap = data.m_cap;
36 m_nbDash = data.m_nbDash;
37 m_dash = data.m_dash;
38 m_colour = data.m_colour;
e9576ca5
SC
39}
40
41wxPenRefData::~wxPenRefData()
42{
e9576ca5
SC
43}
44
45// Pens
46
47wxPen::wxPen()
48{
e9576ca5
SC
49}
50
51wxPen::~wxPen()
52{
e9576ca5
SC
53}
54
55// Should implement Create
56wxPen::wxPen(const wxColour& col, int Width, int Style)
57{
58 m_refData = new wxPenRefData;
46562151 59
e9576ca5
SC
60 M_PENDATA->m_colour = col;
61 M_PENDATA->m_width = Width;
62 M_PENDATA->m_style = Style;
63 M_PENDATA->m_join = wxJOIN_ROUND ;
64 M_PENDATA->m_cap = wxCAP_ROUND ;
65 M_PENDATA->m_nbDash = 0 ;
2f1ae414 66 M_PENDATA->m_dash = 0 ;
46562151 67
e9576ca5 68 RealizeResource();
e9576ca5
SC
69}
70
71wxPen::wxPen(const wxBitmap& stipple, int Width)
72{
73 m_refData = new wxPenRefData;
46562151 74
e9576ca5
SC
75 M_PENDATA->m_stipple = stipple;
76 M_PENDATA->m_width = Width;
77 M_PENDATA->m_style = wxSTIPPLE;
78 M_PENDATA->m_join = wxJOIN_ROUND ;
79 M_PENDATA->m_cap = wxCAP_ROUND ;
80 M_PENDATA->m_nbDash = 0 ;
2f1ae414 81 M_PENDATA->m_dash = 0 ;
46562151 82
e9576ca5 83 RealizeResource();
e9576ca5
SC
84}
85
86void wxPen::Unshare()
87{
e40298d5
JS
88 // Don't change shared data
89 if (!m_refData)
e9576ca5 90 {
e40298d5
JS
91 m_refData = new wxPenRefData();
92 }
e9576ca5
SC
93 else
94 {
e40298d5
JS
95 wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
96 UnRef();
97 m_refData = ref;
98 }
e9576ca5
SC
99}
100
101void wxPen::SetColour(const wxColour& col)
102{
103 Unshare();
46562151 104
e9576ca5 105 M_PENDATA->m_colour = col;
46562151 106
e9576ca5
SC
107 RealizeResource();
108}
109
1a1498c0 110void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
e9576ca5
SC
111{
112 Unshare();
46562151 113
e9576ca5 114 M_PENDATA->m_colour.Set(r, g, b);
46562151 115
e9576ca5
SC
116 RealizeResource();
117}
118
119void wxPen::SetWidth(int Width)
120{
121 Unshare();
46562151 122
e9576ca5 123 M_PENDATA->m_width = Width;
46562151 124
e9576ca5
SC
125 RealizeResource();
126}
127
128void wxPen::SetStyle(int Style)
129{
130 Unshare();
46562151 131
e9576ca5 132 M_PENDATA->m_style = Style;
46562151 133
e9576ca5
SC
134 RealizeResource();
135}
136
137void wxPen::SetStipple(const wxBitmap& Stipple)
138{
139 Unshare();
46562151 140
e9576ca5
SC
141 M_PENDATA->m_stipple = Stipple;
142 M_PENDATA->m_style = wxSTIPPLE;
46562151 143
e9576ca5
SC
144 RealizeResource();
145}
146
147void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
148{
149 Unshare();
46562151 150
e9576ca5 151 M_PENDATA->m_nbDash = nb_dashes;
2f1ae414 152 M_PENDATA->m_dash = (wxDash *)Dash;
46562151 153
e9576ca5
SC
154 RealizeResource();
155}
156
157void wxPen::SetJoin(int Join)
158{
159 Unshare();
46562151 160
e9576ca5 161 M_PENDATA->m_join = Join;
46562151 162
e9576ca5
SC
163 RealizeResource();
164}
165
166void wxPen::SetCap(int Cap)
167{
168 Unshare();
46562151 169
e9576ca5 170 M_PENDATA->m_cap = Cap;
46562151 171
e9576ca5
SC
172 RealizeResource();
173}
174
175bool wxPen::RealizeResource()
176{
e40298d5 177 // nothing to do here for mac
46562151 178 return true;
e9576ca5 179}