+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NSDragOperationNone;
+
+ return impl->draggingEntered(sender, self, _cmd);
+}
+
+void wxOSX_draggingExited( id self, SEL _cmd, id <NSDraggingInfo> sender )
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return ;
+
+ return impl->draggingExited(sender, self, _cmd);
+}
+
+NSDragOperation wxOSX_draggingUpdated( id self, SEL _cmd, id <NSDraggingInfo>sender )
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NSDragOperationNone;
+
+ return impl->draggingUpdated(sender, self, _cmd);
+}
+
+BOOL wxOSX_performDragOperation( id self, SEL _cmd, id <NSDraggingInfo> sender )
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NSDragOperationNone;
+
+ return impl->performDragOperation(sender, self, _cmd) ? YES:NO ;
+}
+
+void wxOSX_mouseEvent(NSView* self, SEL _cmd, NSEvent *event)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->mouseEvent(event, self, _cmd);
+}
+
+void wxOSX_keyEvent(NSView* self, SEL _cmd, NSEvent *event)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->keyEvent(event, self, _cmd);
+}
+
+void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->insertText(text, self, _cmd);
+}
+
+BOOL wxOSX_performKeyEquivalent(NSView* self, SEL _cmd, NSEvent *event)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NO;
+
+ return impl->performKeyEquivalent(event, self, _cmd);
+}
+
+BOOL wxOSX_becomeFirstResponder(NSView* self, SEL _cmd)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NO;
+
+ return impl->becomeFirstResponder(self, _cmd);
+}
+
+BOOL wxOSX_resignFirstResponder(NSView* self, SEL _cmd)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NO;
+
+ return impl->resignFirstResponder(self, _cmd);
+}
+
+void wxOSX_resetCursorRects(NSView* self, SEL _cmd)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->resetCursorRects(self, _cmd);
+}
+
+BOOL wxOSX_isFlipped(NSView* self, SEL _cmd)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return NO;
+
+ return impl->isFlipped(self, _cmd) ? YES:NO;
+}
+
+void wxOSX_drawRect(NSView* self, SEL _cmd, NSRect rect)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ return impl->drawRect(&rect, self, _cmd);
+}
+
+void wxOSX_controlAction(NSView* self, SEL _cmd, id sender)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->controlAction(self, _cmd, sender);
+}
+
+void wxOSX_controlDoubleAction(NSView* self, SEL _cmd, id sender)
+{
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl == NULL)
+ return;
+
+ impl->controlDoubleAction(self, _cmd, sender);
+}
+
+unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget slf, void *_cmd)
+{
+ id <NSDraggingInfo>sender = (id <NSDraggingInfo>) s;
+ NSPasteboard *pboard = [sender draggingPasteboard];
+ NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
+
+ wxWindow* wxpeer = GetWXPeer();
+ if ( wxpeer == NULL )
+ return NSDragOperationNone;
+
+ wxDropTarget* target = wxpeer->GetDropTarget();
+ if ( target == NULL )
+ return NSDragOperationNone;
+
+ wxDragResult result = wxDragNone;
+ wxPoint pt = wxFromNSPoint( m_osxView, [sender draggingLocation] );
+
+ if ( sourceDragMask & NSDragOperationLink )
+ result = wxDragLink;
+ else if ( sourceDragMask & NSDragOperationCopy )
+ result = wxDragCopy;
+ else if ( sourceDragMask & NSDragOperationMove )
+ result = wxDragMove;
+
+ PasteboardRef pboardRef;
+ PasteboardCreate((CFStringRef)[pboard name], &pboardRef);
+ target->SetCurrentDragPasteboard(pboardRef);
+ result = target->OnEnter(pt.x, pt.y, result);
+ CFRelease(pboardRef);
+
+ NSDragOperation nsresult = NSDragOperationNone;
+ switch (result )