diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index d95f0e1ab1..e5976eb85a 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -46,6 +46,16 @@ public: m_dash = data.m_dash; } + wxPenRefData( const wxPenInfo& info ) + { + m_width = info.GetWidth(); + m_style = info.GetStyle(); + m_joinStyle = info.GetJoin(); + m_capStyle = info.GetCap(); + m_colour = info.GetColour(); + m_countDashes = info.GetDashes((wxDash**)&m_dash); + } + bool operator == (const wxPenRefData& data) const { if ( m_countDashes != data.m_countDashes ) @@ -89,29 +99,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style ) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style)); } wxPen::wxPen(const wxColour& colour, int width, int style) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = (wxPenStyle)style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData + ( + wxPenInfo(colour, width).Style((wxPenStyle)style) + ); } wxPen::wxPen(const wxPenInfo& info) { - m_refData = new wxPenRefData(); - M_PENDATA->m_colour = info.GetColour(); - M_PENDATA->m_width = info.GetWidth(); - M_PENDATA->m_style = info.GetStyle(); - M_PENDATA->m_joinStyle = info.GetJoin(); - M_PENDATA->m_capStyle = info.GetCap(); - M_PENDATA->m_countDashes = info.GetDashes(&M_PENDATA->m_dash); + m_refData = new wxPenRefData(info); } wxPen::~wxPen() diff --git a/src/gtk1/pen.cpp b/src/gtk1/pen.cpp index d68c6bfce9..3e145d18ec 100644 --- a/src/gtk1/pen.cpp +++ b/src/gtk1/pen.cpp @@ -46,6 +46,18 @@ public: m_dash = data.m_dash; } + wxPenRefData( const wxPenInfo& info ) + { + m_width = info.GetWidth(); + m_style = info.GetStyle(); + m_joinStyle = info.GetJoin(); + m_capStyle = info.GetCap(); + m_colour = info.GetColour(); + wxDash* dash; + m_countDashes = info.GetDashes(&dash); + m_dash = (wxGTKDash*)dash; + } + bool operator == (const wxPenRefData& data) const { if ( m_countDashes != data.m_countDashes ) @@ -89,30 +101,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style ) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style)); } wxPen::wxPen(const wxColour& colour, int width, int style) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = (wxPenStyle)style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData + ( + wxPenInfo(colour, width).Style((wxPenStyle)style) + ); } wxPen::wxPen(const wxPenInfo& info) { - m_refData = new wxPenRefData(); - - M_PENDATA->m_colour = info.GetColour(); - M_PENDATA->m_width = info.GetWidth(); - M_PENDATA->m_style = info.GetStyle(); - M_PENDATA->m_joinStyle = info.GetJoin(); - M_PENDATA->m_capStyle = info.GetCap(); - M_PENDATA->m_countDashes = info.GetDashes(&M_PENDATA->m_dash); + m_refData = new wxPenRefData(info); } wxGDIRefData *wxPen::CreateGDIRefData() const diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index cf8af1986b..61a8648d3b 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -46,8 +46,7 @@ public: wxPenRefData(); wxPenRefData(const wxPenRefData& data); - wxPenRefData(const wxColour& col, int width, wxPenStyle style); - wxPenRefData(const wxBitmap& stipple, int width); + wxPenRefData(const wxPenInfo& info); virtual ~wxPenRefData(); bool operator==(const wxPenRefData& data) const @@ -170,24 +169,17 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data) m_hPen = 0; } -wxPenRefData::wxPenRefData(const wxColour& col, int width, wxPenStyle style) +wxPenRefData::wxPenRefData(const wxPenInfo& info) { Init(); - m_style = style; - m_width = width; - - m_colour = col; -} - -wxPenRefData::wxPenRefData(const wxBitmap& stipple, int width) -{ - Init(); - - m_style = wxPENSTYLE_STIPPLE; - m_width = width; - - m_stipple = stipple; + m_style = info.GetStyle(); + m_width = info.GetWidth(); + m_join = info.GetJoin(); + m_cap = info.GetCap(); + m_stipple = info.GetStipple(); + m_nbDash = info.GetDashes(&m_dash); + m_colour = info.GetColour(); } wxPenRefData::~wxPenRefData() @@ -401,31 +393,25 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen(const wxColour& col, int width, wxPenStyle style) { - m_refData = new wxPenRefData(col, width, style); + m_refData = new wxPenRefData(wxPenInfo(col, width).Style(style)); } wxPen::wxPen(const wxColour& colour, int width, int style) { - m_refData = new wxPenRefData(colour, width, (wxPenStyle)style); + m_refData = new wxPenRefData + ( + wxPenInfo(colour, width).Style((wxPenStyle)style) + ); } wxPen::wxPen(const wxBitmap& stipple, int width) { - m_refData = new wxPenRefData(stipple, width); + m_refData = new wxPenRefData(wxPenInfo().Stipple(stipple).Width(width)); } wxPen::wxPen(const wxPenInfo& info) { - m_refData = new wxPenRefData(); - - M_PENDATA->SetColour(info.GetColour()); - M_PENDATA->SetWidth(info.GetWidth()); - M_PENDATA->SetStyle(info.GetStyle()); - M_PENDATA->SetJoin(info.GetJoin()); - M_PENDATA->SetCap(info.GetCap()); - wxDash *dash; - int nb_dashes = info.GetDashes(&dash); - M_PENDATA->SetDashes(nb_dashes, dash); + m_refData = new wxPenRefData(info); } bool wxPen::operator==(const wxPen& pen) const diff --git a/src/osx/pen.cpp b/src/osx/pen.cpp index f6ea0a489d..40c9fba41b 100644 --- a/src/osx/pen.cpp +++ b/src/osx/pen.cpp @@ -23,6 +23,7 @@ class WXDLLEXPORT wxPenRefData : public wxGDIRefData public: wxPenRefData(); wxPenRefData(const wxPenRefData& data); + wxPenRefData(const wxPenInfo& info); virtual ~wxPenRefData(); wxPenRefData& operator=(const wxPenRefData& data); @@ -79,6 +80,16 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data) m_colour = data.m_colour; } +wxPenRefData::wxPenRefData(const wxPenInfo& info) +{ + m_style = info.GetStyle(); + m_width = info.GetWidth(); + m_join = info.GetJoin(); + m_cap = info.GetCap(); + m_nbDash = info.GetDashes(&m_dash); + m_colour = info.GetColour(); +} + wxPenRefData::~wxPenRefData() { } @@ -98,59 +109,28 @@ wxPen::~wxPen() // Should implement Create wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style) { - m_refData = new wxPenRefData; - - M_PENDATA->m_colour = col; - M_PENDATA->m_width = Width; - M_PENDATA->m_style = Style; - M_PENDATA->m_join = wxJOIN_ROUND ; - M_PENDATA->m_cap = wxCAP_ROUND ; - M_PENDATA->m_nbDash = 0 ; - M_PENDATA->m_dash = 0 ; + m_refData = new wxPenRefData(wxPenInfo(col, Width).Style(Style)); RealizeResource(); } wxPen::wxPen(const wxColour& col, int Width, int Style) { - m_refData = new wxPenRefData; - - M_PENDATA->m_colour = col; - M_PENDATA->m_width = Width; - M_PENDATA->m_style = (wxPenStyle)Style; - M_PENDATA->m_join = wxJOIN_ROUND ; - M_PENDATA->m_cap = wxCAP_ROUND ; - M_PENDATA->m_nbDash = 0 ; - M_PENDATA->m_dash = 0 ; + m_refData = new wxPenRefData(wxPenInfo(col, Width).Style((wxPenStyle)Style)); RealizeResource(); } -wxPen::wxPen(const wxBitmap& stipple, int Width) +wxPen::wxPen(const wxBitmap& stipple, int width) { - m_refData = new wxPenRefData; - - M_PENDATA->m_stipple = stipple; - M_PENDATA->m_width = Width; - M_PENDATA->m_style = wxPENSTYLE_STIPPLE; - M_PENDATA->m_join = wxJOIN_ROUND ; - M_PENDATA->m_cap = wxCAP_ROUND ; - M_PENDATA->m_nbDash = 0 ; - M_PENDATA->m_dash = 0 ; + m_refData = new wxPenRefData(wxPenInfo().Stipple(stipple).Width(width)); RealizeResource(); } wxPen::wxPen(const wxPenInfo& info) { - m_refData = new wxPenRefData; - - M_PENDATA->m_colour = info.GetColour(); - M_PENDATA->m_width = info.GetWidth(); - M_PENDATA->m_style = info.GetStyle(); - M_PENDATA->m_join = info.GetJoin(); - M_PENDATA->m_cap = info.GetCap(); - M_PENDATA->m_nbDash = info.GetDashes(&M_PENDATA->m_dash); + m_refData = new wxPenRefData(info); RealizeResource(); } diff --git a/src/x11/pen.cpp b/src/x11/pen.cpp index 9960466228..007c35fe25 100644 --- a/src/x11/pen.cpp +++ b/src/x11/pen.cpp @@ -52,6 +52,18 @@ public: m_stipple = data.m_stipple; } + wxPenRefData( const wxPenInfo& info ) + { + m_width = info.GetWidth(); + m_style = info.GetStyle(); + m_joinStyle = info.GetJoin(); + m_capStyle = info.GetCap(); + m_colour = info.GetColour(); + wxDash* dash; + m_countDashes = info.GetDashes(&dash); + m_dash = (wxX11Dash*)dash; + } + bool operator == (const wxPenRefData& data) const { return (m_style == data.m_style && @@ -79,30 +91,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style ) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style)); } wxPen::wxPen(const wxColour& colour, int width, int style) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = width; - M_PENDATA->m_style = (wxPenStyle)style; - M_PENDATA->m_colour = colour; + m_refData = new wxPenRefData + ( + wxPenInfo(colour, width).Style((wxPenStyle)style) + ); } wxPen::wxPen(const wxPenInfo& info) { - m_refData = new wxPenRefData(); - M_PENDATA->m_width = info.GetWidth(); - M_PENDATA->m_style = info.GetStyle(); - M_PENDATA->m_colour = info.GetColour(); - M_PENDATA->m_capStyle = info.GetCap(); - M_PENDATA->m_joinStyle = info.GetJoin(); - M_PENDATA->m_stipple = info.GetStipple(); - M_PENDATA->m_countDashes = info.GetDashes(&M_PENDATA->m_dash); + m_refData = new wxPenRefData(info); } wxPen::~wxPen()