]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxRegion::Equal() for wxOSX.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 15 Jul 2011 22:58:36 +0000 (22:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 15 Jul 2011 22:58:36 +0000 (22:58 +0000)
As there doesn't seem to be any native functions for comparing HIShapes,
compute their differences to find out if they are equal.

Closes #13339.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/osx/carbon/region.cpp

index 9b7329e2e764e3fea32c960e59b76adef627bf6e..bd4bc0f8db35a453265d0c0f046572e2104a86be 100644 (file)
@@ -441,6 +441,10 @@ All (GUI):
 
 - Support float, double and file name values in wxGenericValidator (troelsk).
 
+OSX:
+
+- Implement wxRegion::Equal() (Dr.Acula).
+
 GTK:
 
 - Generate events for two auxiliary mouse buttons in wxGTK (Marcin Wojdyr).
index ffd0f106d9f6bcfe9918ff9762fa8151cc2f1dc2..448ae707a915f72ff016d88702a22a642400eb05 100644 (file)
@@ -242,11 +242,21 @@ bool wxRegion::DoCombine(const wxRegion& region, wxRegionOp op)
 //# Information on region
 //-----------------------------------------------------------------------------
 
-bool wxRegion::DoIsEqual(const wxRegion& WXUNUSED(region)) const
+bool wxRegion::DoIsEqual(const wxRegion& region) const
 {
-    wxFAIL_MSG( wxT("not implemented") );
+    // There doesn't seem to be any native function for checking the equality
+    // of HIShapes so we compute their differences to determine if they are
+    // equal.
+    wxRegion r(this);
+    r.Subtract(region);
 
-    return false;
+    if ( !r.IsEmpty() )
+        return false;
+
+    wxRegion r2(region);
+    r2.Subtract(*this);
+
+    return r2.IsEmpty();
 }
 
 // Outer bounds of region