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:
@@ -63,6 +63,15 @@ wxBrush::wxBrush( const wxColour &colour, wxBrushStyle style )
|
||||
M_BRUSHDATA->m_colour = colour;
|
||||
}
|
||||
|
||||
#if FUTURE_WXWIN_COMPATIBILITY_3_0
|
||||
wxBrush::wxBrush(const wxColour& col, int style)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
M_BRUSHDATA->m_style = (wxBrushStyle)style;
|
||||
M_BRUSHDATA->m_colour = colour;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
@@ -102,33 +111,21 @@ bool wxBrush::operator == ( const wxBrush& brush ) const
|
||||
|
||||
wxBrushStyle wxBrush::GetStyle() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
wxFAIL_MSG( wxT("invalid brush") );
|
||||
return 0;
|
||||
}
|
||||
wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->m_style;
|
||||
}
|
||||
|
||||
wxColour &wxBrush::GetColour() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
wxFAIL_MSG( wxT("invalid brush") );
|
||||
return wxNullColour;
|
||||
}
|
||||
wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->m_colour;
|
||||
}
|
||||
|
||||
wxBitmap *wxBrush::GetStipple() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
wxFAIL_MSG( wxT("invalid brush") );
|
||||
return &wxNullBitmap;
|
||||
}
|
||||
wxCHECK_MSG( Ok(), NULL, _T("invalid brush") );
|
||||
|
||||
return &M_BRUSHDATA->m_stipple;
|
||||
}
|
||||
|
||||
@@ -96,13 +96,15 @@ wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
|
||||
M_PENDATA->m_colour = colour;
|
||||
}
|
||||
|
||||
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();
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = (wxPenStyle)style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
@@ -180,17 +182,23 @@ void wxPen::SetWidth( int width )
|
||||
|
||||
int wxPen::GetDashes( wxDash **ptr ) const
|
||||
{
|
||||
*ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL);
|
||||
return (M_PENDATA ? M_PENDATA->m_countDashes : 0);
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
*ptr = (wxDash*)M_PENDATA->m_dash;
|
||||
return M_PENDATA->m_countDashes;
|
||||
}
|
||||
|
||||
int wxPen::GetDashCount() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
return (M_PENDATA->m_countDashes);
|
||||
}
|
||||
|
||||
wxDash* wxPen::GetDash() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") );
|
||||
|
||||
return (wxDash*)M_PENDATA->m_dash;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user