]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxDataViewIconText::IsSameAs() and make comparison operators members.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Aug 2011 15:31:33 +0000 (15:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Aug 2011 15:31:33 +0000 (15:31 +0000)
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

index ca89147b0a31e03bc5a0ef8657f08c959c3c6df2..612e87d455aabbcfaa4603af113e2b837f9edb1b 100644 (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)
 
 // ----------------------------------------------------------------------------