Add wxDataViewIconText::IsSameAs() and make comparison operators members.

Add IsSameAs() to make it simpler to call from the derived class operator==()
implementation.

Also make comparison operators themselves members instead of global functions
to avoid considering them as matches for all operator==() uses in the program,
there is really no need for this as we do _not_ want to allow implicitly
converting something to wxDataViewIconText when comparing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-08-22 15:31:33 +00:00
parent 66d9eb612b
commit 60d10101b7

View File

@ -54,6 +54,21 @@ public:
void SetIcon( const wxIcon &icon ) { m_icon = icon; }
const wxIcon &GetIcon() const { return m_icon; }
bool IsSameAs(const wxDataViewIconText& other) const
{
return m_text == other.m_text && m_icon.IsSameAs(other.m_icon);
}
bool operator==(const wxDataViewIconText& other) const
{
return IsSameAs(other);
}
bool operator!=(const wxDataViewIconText& other) const
{
return !IsSameAs(other);
}
private:
wxString m_text;
wxIcon m_icon;
@ -61,19 +76,6 @@ private:
DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
};
inline
bool operator==(const wxDataViewIconText& left, const wxDataViewIconText& right)
{
return left.GetText() == right.GetText() &&
left.GetIcon().IsSameAs(right.GetIcon());
}
inline
bool operator!=(const wxDataViewIconText& left, const wxDataViewIconText& right)
{
return !(left == right);
}
DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
// ----------------------------------------------------------------------------