native drop target method for cocoa

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2012-07-01 15:46:56 +00:00
parent f31c06b39e
commit 14de8214d6
2 changed files with 19 additions and 4 deletions

View File

@ -105,6 +105,8 @@ public :
void CaptureMouse();
void ReleaseMouse();
void SetDropTarget(wxDropTarget* target);
wxInt32 GetValue() const;
void SetValue( wxInt32 v );
wxBitmap GetBitmap() const;

View File

@ -2072,6 +2072,23 @@ bool wxWidgetCocoaImpl::SetFocus()
return true;
}
void wxWidgetCocoaImpl::SetDropTarget(wxDropTarget* target)
{
[m_osxView unregisterDraggedTypes];
if ( target == NULL )
return;
wxDataObject* dobj = target->GetDataObject();
if( dobj )
{
CFMutableArrayRef typesarray = CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks);
[m_osxView registerForDraggedTypes:(NSArray*)typesarray];
CFRelease(typesarray);
}
}
void wxWidgetCocoaImpl::RemoveFromParent()
{
@ -2534,10 +2551,6 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSView* v = [[wxNSView alloc] initWithFrame:r];
// temporary hook for dnd
[v registerForDraggedTypes:[NSArray arrayWithObjects:
NSStringPboardType, NSFilenamesPboardType, (NSString*) kPasteboardTypeFileURLPromise, NSTIFFPboardType, NSPICTPboardType, NSPDFPboardType, nil]];
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v, false, true );
return c;
}