]> git.saurik.com Git - wxWidgets.git/commitdiff
adding a more extensive version to arrive at the impl when given a native control...
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 4 Jun 2013 06:54:50 +0000 (06:54 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 4 Jun 2013 06:54:50 +0000 (06:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/core/private.h
src/osx/carbon/window.cpp
src/osx/cocoa/window.mm

index 0bf016b71fd8f36c2babff584bf12964da09099e..f6fe11ee6867d8a233e10068a2087baeec105847 100644 (file)
@@ -341,9 +341,16 @@ public :
 
     // static methods for associating native controls and their implementations
 
+    // finds the impl associated with this native control
     static wxWidgetImpl*
                         FindFromWXWidget(WXWidget control);
 
+    // finds the impl associated with this native control, if the native control itself is not known
+    // also checks whether its parent is eg a registered scrollview, ie whether the control is a native subpart
+    // of a known control
+    static wxWidgetImpl*
+                        FindBestFromWXWidget(WXWidget control);
+    
     static void         RemoveAssociations( wxWidgetImpl* impl);
 
     static void         Associate( WXWidget control, wxWidgetImpl *impl );
index 48ae71bbfb08371323c40857bb68b8ac94913258..b918d152d845129d2b0351ae17982e02b465838f 100644 (file)
@@ -87,6 +87,12 @@ WXWidget wxWidgetImpl::FindFocus()
     return control;
 }
 
+// no compositing to take into account under carbon
+wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control)
+{
+    return FindFromWXWidget(control);
+}
+
 // ---------------------------------------------------------------------------
 // Carbon Events
 // ---------------------------------------------------------------------------
index a5aaeac505e01a45772550acb474263fa6bee92b..f7c6fcb8c3d6a9d80a15577133352bc644d44a4a 100644 (file)
@@ -71,9 +71,22 @@ NSView* GetFocusedViewInWindow( NSWindow* keyWindow )
 
 WXWidget wxWidgetImpl::FindFocus()
 {
-    return GetFocusedViewInWindow( [NSApp keyWindow] );
+    return GetFocusedViewInWindow( [NSApp keyWindow] );;
 }
 
+wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control)
+{
+    wxWidgetImpl* impl = FindFromWXWidget(control);
+    
+    // NSScrollViews can have their subviews like NSClipView
+    // therefore check and use the NSScrollView peer in that case
+    if ( impl == NULL && [[control superview] isKindOfClass:[NSScrollView class]])
+        impl = FindFromWXWidget([control superview]);
+    
+    return impl;
+}
+
+
 NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin )
 {
     int x, y, w, h ;