]> git.saurik.com Git - wxWidgets.git/commitdiff
generic GetFromWindow() implementation for non-MSW platforms
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 10 Feb 2006 02:29:30 +0000 (02:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 10 Feb 2006 02:29:30 +0000 (02:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37437 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/dpycmn.cpp

index f5d398867bb6303c172f48f22cb4a1e73082c307..7425df4ef6780bd834b28dfcf8761ed37d323ed6 100644 (file)
@@ -44,5 +44,19 @@ wxDisplayBase::wxDisplayBase(size_t index)
                     wxT("An invalid index was passed to wxDisplay") );
 }
 
                     wxT("An invalid index was passed to wxDisplay") );
 }
 
+// MSW has its own specific implementation of this
+#ifndef __WXMSW__
+
+int wxDisplayBase::GetFromWindow(wxWindow *window)
+{
+    wxCHECK_MSG( window, wxNOT_FOUND, _T("NULL window") );
+
+    // consider that the window belong to the display containing its centre
+    const wxRect r(window->GetRect());
+    return GetFromPoint(wxPoint(r.x + r.width/2, r.y + r.height/2));
+}
+
+#endif // !__WXMSW__
+
 #endif // wxUSE_DISPLAY
 
 #endif // wxUSE_DISPLAY