Refactor all wxPen ctors to use wxPenRefData(wxPenInfo) ctor
Centralize all pen creation logic in a single place (in each port) in the new wxPenRefData ctor taking wxPenInfo.
This commit is contained in:
@@ -46,6 +46,16 @@ public:
|
|||||||
m_dash = data.m_dash;
|
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
|
bool operator == (const wxPenRefData& data) const
|
||||||
{
|
{
|
||||||
if ( m_countDashes != data.m_countDashes )
|
if ( m_countDashes != data.m_countDashes )
|
||||||
@@ -89,29 +99,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject);
|
|||||||
|
|
||||||
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style));
|
||||||
M_PENDATA->m_width = width;
|
|
||||||
M_PENDATA->m_style = style;
|
|
||||||
M_PENDATA->m_colour = colour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxColour& colour, int width, int style)
|
wxPen::wxPen(const wxColour& colour, int width, int style)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData
|
||||||
M_PENDATA->m_width = width;
|
(
|
||||||
M_PENDATA->m_style = (wxPenStyle)style;
|
wxPenInfo(colour, width).Style((wxPenStyle)style)
|
||||||
M_PENDATA->m_colour = colour;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxPenInfo& info)
|
wxPen::wxPen(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(info);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::~wxPen()
|
wxPen::~wxPen()
|
||||||
|
@@ -46,6 +46,18 @@ public:
|
|||||||
m_dash = data.m_dash;
|
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
|
bool operator == (const wxPenRefData& data) const
|
||||||
{
|
{
|
||||||
if ( m_countDashes != data.m_countDashes )
|
if ( m_countDashes != data.m_countDashes )
|
||||||
@@ -89,30 +101,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject);
|
|||||||
|
|
||||||
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style));
|
||||||
M_PENDATA->m_width = width;
|
|
||||||
M_PENDATA->m_style = style;
|
|
||||||
M_PENDATA->m_colour = colour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxColour& colour, int width, int style)
|
wxPen::wxPen(const wxColour& colour, int width, int style)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData
|
||||||
M_PENDATA->m_width = width;
|
(
|
||||||
M_PENDATA->m_style = (wxPenStyle)style;
|
wxPenInfo(colour, width).Style((wxPenStyle)style)
|
||||||
M_PENDATA->m_colour = colour;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxPenInfo& info)
|
wxPen::wxPen(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(info);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGDIRefData *wxPen::CreateGDIRefData() const
|
wxGDIRefData *wxPen::CreateGDIRefData() const
|
||||||
|
@@ -46,8 +46,7 @@ public:
|
|||||||
|
|
||||||
wxPenRefData();
|
wxPenRefData();
|
||||||
wxPenRefData(const wxPenRefData& data);
|
wxPenRefData(const wxPenRefData& data);
|
||||||
wxPenRefData(const wxColour& col, int width, wxPenStyle style);
|
wxPenRefData(const wxPenInfo& info);
|
||||||
wxPenRefData(const wxBitmap& stipple, int width);
|
|
||||||
virtual ~wxPenRefData();
|
virtual ~wxPenRefData();
|
||||||
|
|
||||||
bool operator==(const wxPenRefData& data) const
|
bool operator==(const wxPenRefData& data) const
|
||||||
@@ -170,24 +169,17 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
|
|||||||
m_hPen = 0;
|
m_hPen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPenRefData::wxPenRefData(const wxColour& col, int width, wxPenStyle style)
|
wxPenRefData::wxPenRefData(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
m_style = style;
|
m_style = info.GetStyle();
|
||||||
m_width = width;
|
m_width = info.GetWidth();
|
||||||
|
m_join = info.GetJoin();
|
||||||
m_colour = col;
|
m_cap = info.GetCap();
|
||||||
}
|
m_stipple = info.GetStipple();
|
||||||
|
m_nbDash = info.GetDashes(&m_dash);
|
||||||
wxPenRefData::wxPenRefData(const wxBitmap& stipple, int width)
|
m_colour = info.GetColour();
|
||||||
{
|
|
||||||
Init();
|
|
||||||
|
|
||||||
m_style = wxPENSTYLE_STIPPLE;
|
|
||||||
m_width = width;
|
|
||||||
|
|
||||||
m_stipple = stipple;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPenRefData::~wxPenRefData()
|
wxPenRefData::~wxPenRefData()
|
||||||
@@ -401,31 +393,25 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject);
|
|||||||
|
|
||||||
wxPen::wxPen(const wxColour& col, int width, wxPenStyle style)
|
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)
|
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)
|
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)
|
wxPen::wxPen(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(info);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPen::operator==(const wxPen& pen) const
|
bool wxPen::operator==(const wxPen& pen) const
|
||||||
|
@@ -23,6 +23,7 @@ class WXDLLEXPORT wxPenRefData : public wxGDIRefData
|
|||||||
public:
|
public:
|
||||||
wxPenRefData();
|
wxPenRefData();
|
||||||
wxPenRefData(const wxPenRefData& data);
|
wxPenRefData(const wxPenRefData& data);
|
||||||
|
wxPenRefData(const wxPenInfo& info);
|
||||||
virtual ~wxPenRefData();
|
virtual ~wxPenRefData();
|
||||||
|
|
||||||
wxPenRefData& operator=(const wxPenRefData& data);
|
wxPenRefData& operator=(const wxPenRefData& data);
|
||||||
@@ -79,6 +80,16 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
|
|||||||
m_colour = data.m_colour;
|
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()
|
wxPenRefData::~wxPenRefData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -98,59 +109,28 @@ wxPen::~wxPen()
|
|||||||
// Should implement Create
|
// Should implement Create
|
||||||
wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style)
|
wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData;
|
m_refData = new wxPenRefData(wxPenInfo(col, Width).Style(Style));
|
||||||
|
|
||||||
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 ;
|
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxColour& col, int Width, int Style)
|
wxPen::wxPen(const wxColour& col, int Width, int Style)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData;
|
m_refData = new wxPenRefData(wxPenInfo(col, Width).Style((wxPenStyle)Style));
|
||||||
|
|
||||||
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 ;
|
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxBitmap& stipple, int Width)
|
wxPen::wxPen(const wxBitmap& stipple, int width)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData;
|
m_refData = new wxPenRefData(wxPenInfo().Stipple(stipple).Width(width));
|
||||||
|
|
||||||
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 ;
|
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxPenInfo& info)
|
wxPen::wxPen(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData;
|
m_refData = new wxPenRefData(info);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,18 @@ public:
|
|||||||
m_stipple = data.m_stipple;
|
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
|
bool operator == (const wxPenRefData& data) const
|
||||||
{
|
{
|
||||||
return (m_style == data.m_style &&
|
return (m_style == data.m_style &&
|
||||||
@@ -79,30 +91,20 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject);
|
|||||||
|
|
||||||
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(wxPenInfo(colour, width).Style(style));
|
||||||
M_PENDATA->m_width = width;
|
|
||||||
M_PENDATA->m_style = style;
|
|
||||||
M_PENDATA->m_colour = colour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxColour& colour, int width, int style)
|
wxPen::wxPen(const wxColour& colour, int width, int style)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData
|
||||||
M_PENDATA->m_width = width;
|
(
|
||||||
M_PENDATA->m_style = (wxPenStyle)style;
|
wxPenInfo(colour, width).Style((wxPenStyle)style)
|
||||||
M_PENDATA->m_colour = colour;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::wxPen(const wxPenInfo& info)
|
wxPen::wxPen(const wxPenInfo& info)
|
||||||
{
|
{
|
||||||
m_refData = new wxPenRefData();
|
m_refData = new wxPenRefData(info);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen::~wxPen()
|
wxPen::~wxPen()
|
||||||
|
Reference in New Issue
Block a user