used to work in somewhat unexpected way as it compared only internal pointers
and not the object data. The code using it will have to be updated:
* If the object was compared with wxNullXXX, use IsOk() method instead
- * If valid object need to be compated, use IsRefTo() to reproduce the old
+ * If valid object need to be compated, use IsSameAs() to reproduce the old
behaviour or change the code to avoid comparing bitmaps &c
- wxFontData::GetColour() now returns a const colour.
- wxDC objects can't be created directly now (this never worked, now it doesn't
bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
\end{verbatim}
-\membersection{wxObject::IsRefTo}\label{wxobjectisrefto}
+\membersection{wxObject::IsSameAs}\label{wxobjectissameas}
-\func{bool}{IsRefTo}{\param{const wxObject *}{ obj}}
+\func{bool}{IsSameAs}{\param{const wxObject\& }{ obj}}
-Returns \true if this object is referencing the \arg{obj}'s data.
-Note that this function only does a {\tt shallow} comparison.
+Returns \true if this object has the same data pointer as \arg{obj}. Notice
+that \true is returned if the data pointers are \NULL in both objects.
+
+This function only does a \emph{shallow} comparison, i.e. it doesn't compare
+the objects pointed to by the data pointers of these objects.
\membersection{wxObject::Ref}\label{wxobjectref}
Also note that if you only need to do a {\tt shallow} comparison between two
\helpref{wxObject}{wxobject}-derived classes, you should not use the $==$ and $!=$ operators
-but rather the \helpref{wxObject::IsRefTo}{wxobjectisrefto} function.
+but rather the \helpref{wxObject::IsSameAs}{wxobjectissameas} function.
\subsection{Object destruction}\label{refcountdestruct}
m_join == data.m_join &&
m_cap == data.m_cap &&
m_colour == data.m_colour &&
- (m_style != wxSTIPPLE || m_stipple.IsRefTo(&data.m_stipple)) &&
+ (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) &&
(m_style != wxUSER_DASH ||
(m_nbDash == data.m_nbDash &&
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
m_join == data.m_join &&
m_cap == data.m_cap &&
m_colour == data.m_colour &&
- (m_style != wxSTIPPLE || m_stipple.IsRefTo(&data.m_stipple)) &&
+ (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) &&
(m_style != wxUSER_DASH ||
(m_nbDash == data.m_nbDash &&
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
// Make sure this object has only one reference
void UnShare() { AllocExclusive(); }
- // Do a shallow comparison of our referenced data with the given object's
- // refdata
- bool IsRefTo(const wxObject *p) const { return m_refData == p->m_refData; }
+ // check if this object references the same data as the other one
+ bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
protected:
// ensure that our data is not shared with anybody else: if we have no
m_nJoin == data.m_nJoin &&
m_nCap == data.m_nCap &&
m_vColour == data.m_vColour &&
- (m_style != wxSTIPPLE || m_stipple.IsRefTo(&data.m_stipple)) &&
+ (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) &&
(m_style != wxUSER_DASH ||
(m_dash == data.m_dash &&
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
m_join == data.m_join &&
m_cap == data.m_cap &&
m_colour == data.m_colour &&
- (m_style != wxSTIPPLE || m_stipple.IsRefTo(&data.m_stipple)) &&
+ (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) &&
(m_style != wxUSER_DASH ||
(m_nbDash == data.m_nbDash &&
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
// implements a wxVariantData-derived class using for the Eq() method a shallow
-// comparison (through wxObject::IsRefTo function)
+// comparison (through wxObject::IsSameAs function)
#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \
\
\
classname##VariantData & otherData = (classname##VariantData &) data;\
\
- return (otherData.m_value.IsRefTo(&m_value));\
+ return (otherData.m_value.IsSameAs(m_value));\
}\
{
// setting an invalid cursor is ok, it means that we don't have any special
// cursor
- if ( m_cursor.IsRefTo(&cursor) )
+ if ( m_cursor.IsSameAs(cursor) )
{
// no change
return false;
if ( !bmpPrev.Ok() )
bmpPrev = m_bitmap;
- if ( !bmp.IsRefTo(&bmpPrev) )
+ if ( !bmp.IsSameAs(bmpPrev) )
m_statbmp->SetBitmap(bmp);
}
#endif // wxUSE_STATBMP
bool operator == (const wxBrushRefData& data) const
{
return (m_style == data.m_style &&
- m_stipple.IsRefTo(&data.m_stipple) &&
+ m_stipple.IsSameAs(data.m_stipple) &&
m_colour == data.m_colour);
}
bool operator == (const wxBrushRefData& data) const
{
return (m_style == data.m_style &&
- m_stipple.IsRefTo(&data.m_stipple) &&
+ m_stipple.IsSameAs(data.m_stipple) &&
m_colour == data.m_colour);
}
bool operator == ( const wxBrushRefData& brush ) const
{
return m_style == brush.m_style &&
- m_stipple.IsRefTo(&brush.m_stipple) &&
+ m_stipple.IsSameAs(brush.m_stipple) &&
m_colour == brush.m_colour &&
m_macBrushKind == brush.m_macBrushKind &&
m_macThemeBrush == brush.m_macThemeBrush &&
bool wxWindowMac::SetCursor(const wxCursor& cursor)
{
- if (m_cursor.IsRefTo(&cursor))
+ if (m_cursor.IsSameAs(cursor))
return false;
if (!cursor.IsOk())
bool operator == (const wxBrushRefData& data) const
{
return (m_style == data.m_style &&
- m_stipple.IsRefTo(&data.m_stipple) &&
+ m_stipple.IsSameAs(data.m_stipple) &&
m_colour == data.m_colour);
}
m_capStyle == data.m_capStyle &&
m_joinStyle == data.m_joinStyle &&
m_colour == data.m_colour &&
- (m_style != wxSTIPPLE || m_stipple.IsRefTo(&data.m_stipple)) &&
+ (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) &&
(m_style != wxUSER_DASH ||
(m_dash == data.m_dash &&
memcmp(m_dash, data.m_dash, m_countDashes*sizeof(wxDash)) == 0));
// don't compare HBRUSHes
return m_style == data.m_style &&
m_colour == data.m_colour &&
- m_stipple.IsRefTo(&data.m_stipple);
+ m_stipple.IsSameAs(data.m_stipple);
}
void wxBrushRefData::DoSetStipple(const wxBitmap& stipple)
bool operator == (const wxBrushRefData& data) const
{
return (m_style == data.m_style &&
- m_stipple.IsRefTo(&data.m_stipple) &&
+ m_stipple.IsSameAs(&data.m_stipple) &&
m_colour == data.m_colour);
}