+// Get the window with the focus
+
+NSView* GetViewFromResponder( NSResponder* responder )
+{
+ NSView* view = nil;
+ if ( [responder isKindOfClass:[NSTextView class]] )
+ {
+ NSView* delegate = [(NSTextView*)responder delegate];
+ if ( [delegate isKindOfClass:[NSTextField class] ] )
+ view = delegate;
+ else
+ view = (NSView*) responder;
+ }
+ else
+ {
+ if ( [responder isKindOfClass:[NSView class]] )
+ view = (NSView*) responder;
+ }
+ return view;
+}
+
+NSView* GetFocusedViewInWindow( NSWindow* keyWindow )
+{
+ NSView* focusedView = nil;
+ if ( keyWindow != nil )
+ focusedView = GetViewFromResponder([keyWindow firstResponder]);
+
+ return focusedView;
+}
+
+WXWidget wxWidgetImpl::FindFocus()
+{
+ return GetFocusedViewInWindow( [[NSApplication sharedApplication] keyWindow] );
+}
+