[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1127
Date       : Fri May 19 12:41:08 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxXtra/cwfrompoint.cpp
   M /Trunk/XaraLX/wxXtra/cwfrompoint.h

Make an alternative version of wxChildWindowFromPoint which does not require a wxWindow * to be passed.


Diff:
Index: Trunk/XaraLX/wxXtra/cwfrompoint.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/cwfrompoint.cpp	(revision 1126)
+++ Trunk/XaraLX/wxXtra/cwfrompoint.cpp	(revision 1127)
@@ -72,7 +72,7 @@
 
     wxPoint pos = win->GetPosition();
     wxSize sz = win->GetSize();
-    if (win->GetParent())
+    if (win->GetParent() && !win->IsTopLevel()) // Do not translate coords in TLWs as they are already screen coords
     {
         pos = win->GetParent()->ClientToScreen(pos);
     }
@@ -84,4 +84,23 @@
         return NULL;
 }
 
+// The same routine again but without the window hint
 
+wxWindow* wxChildWindowFromPoint(const wxPoint& pt, bool hidden /* =true */, int depth /* =1 */)
+{
+    // Go backwards through the list since windows
+    // on top are likely to have been appended most
+    // recently.
+    wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetLast();
+    while (node)
+    {
+        wxWindow* win = node->GetData();
+        wxWindow* found = wxChildWindowFromPoint(win, pt, hidden, depth);
+        if (found)
+            return found;
+        node = node->GetPrevious();
+    }
+    return NULL;
+}
+
+
Index: Trunk/XaraLX/wxXtra/cwfrompoint.h
===================================================================
--- Trunk/XaraLX/wxXtra/cwfrompoint.h	(revision 1126)
+++ Trunk/XaraLX/wxXtra/cwfrompoint.h	(revision 1127)
@@ -12,5 +12,6 @@
 #include <wx/wx.h>
 
 extern wxWindow* wxChildWindowFromPoint(wxWindow* win, const wxPoint& pt, bool hidden=true, int depth=1);
+extern wxWindow* wxChildWindowFromPoint(const wxPoint& pt, bool hidden=true, int depth=1);
 
 #endif // __WXXTRA_DOUBLEBUFFER_H


Xara