make the Pen/Brush code backward compatible as discussed on wx-dev; marked the blocks of code to deprecate in future with FUTURE_WXWIN_COMPATIBILITY_3_0; add wxCHECK_MSG in all ports to block Get*() calls on invalid objects (as already is for all other refcounted objects and for most ports)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -435,12 +435,12 @@ wxPen::wxPen(const wxColour& col, int width, wxPenStyle style)
|
||||
m_refData = new wxPenRefData(col, width, style);
|
||||
}
|
||||
|
||||
/* error: `wxBrushStyle' has not been declared
|
||||
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
|
||||
#if FUTURE_WXWIN_COMPATIBILITY_3_0
|
||||
wxPen::wxPen(const wxColour& colour, int width, int style)
|
||||
{
|
||||
m_refData = new wxPenRefData(colour, width, (wxPenStyle)style);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
wxPen::wxPen(const wxBitmap& stipple, int width)
|
||||
{
|
||||
@@ -542,36 +542,42 @@ void wxPen::SetCap(wxPenCap cap)
|
||||
|
||||
wxColour& wxPen::GetColour() const
|
||||
{
|
||||
return m_refData ? M_PENDATA->GetColour() : wxNullColour;
|
||||
wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->GetColour();
|
||||
}
|
||||
|
||||
int wxPen::GetWidth() const
|
||||
{
|
||||
return m_refData ? M_PENDATA->GetWidth() : 0;
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->GetWidth();
|
||||
}
|
||||
|
||||
wxPenStyle wxPen::GetStyle() const
|
||||
{
|
||||
return m_refData ? M_PENDATA->GetStyle() : wxPENSTYLE_MAX;
|
||||
wxCHECK_MSG( Ok(), wxPENSTYLE_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->GetStyle();
|
||||
}
|
||||
|
||||
wxPenJoin wxPen::GetJoin() const
|
||||
{
|
||||
return m_refData ? M_PENDATA->GetJoin() : wxJOIN_INVALID;
|
||||
wxCHECK_MSG( Ok(), wxJOIN_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->GetJoin();
|
||||
}
|
||||
|
||||
wxPenCap wxPen::GetCap() const
|
||||
{
|
||||
return m_refData ? M_PENDATA->GetCap() : wxCAP_INVALID;
|
||||
wxCHECK_MSG( Ok(), wxCAP_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->GetCap();
|
||||
}
|
||||
|
||||
int wxPen::GetDashes(wxDash** ptr) const
|
||||
{
|
||||
if ( !m_refData )
|
||||
{
|
||||
*ptr = NULL;
|
||||
return 0;
|
||||
}
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
*ptr = M_PENDATA->GetDash();
|
||||
return M_PENDATA->GetDashCount();
|
||||
@@ -579,15 +585,21 @@ int wxPen::GetDashes(wxDash** ptr) const
|
||||
|
||||
wxDash* wxPen::GetDash() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") );
|
||||
|
||||
return m_refData ? M_PENDATA->GetDash() : NULL;
|
||||
}
|
||||
|
||||
int wxPen::GetDashCount() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
return m_refData ? M_PENDATA->GetDashCount() : 0;
|
||||
}
|
||||
|
||||
wxBitmap* wxPen::GetStipple() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") );
|
||||
|
||||
return m_refData ? M_PENDATA->GetStipple() : NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user