From 60d10101b75097137a1bb7966fe381d2a90f2aa8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Aug 2011 15:31:33 +0000 Subject: [PATCH] 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 --- include/wx/dvrenderers.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/wx/dvrenderers.h b/include/wx/dvrenderers.h index ca89147b0a..612e87d455 100644 --- a/include/wx/dvrenderers.h +++ b/include/wx/dvrenderers.h @@ -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) // ---------------------------------------------------------------------------- -- 2.45.2