Forgot about the drag source delegate, which is the perfect place to put GiveFeedback related handling.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -55,6 +55,7 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code)
|
|||||||
- (void)setImplementation: (wxDropSource *)dropSource;
|
- (void)setImplementation: (wxDropSource *)dropSource;
|
||||||
- (BOOL)finished;
|
- (BOOL)finished;
|
||||||
- (NSDragOperation)code;
|
- (NSDragOperation)code;
|
||||||
|
- (void)draggedImage:(NSImage *)anImage movedTo:(NSPoint)aPoint;
|
||||||
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
|
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -84,6 +85,48 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code)
|
|||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)draggedImage:(NSImage *)anImage movedTo:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
bool optionDown = GetCurrentKeyModifiers() & optionKey;
|
||||||
|
wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
|
||||||
|
|
||||||
|
if (wxDropSource* source = impl)
|
||||||
|
{
|
||||||
|
if (!source->GiveFeedback(result))
|
||||||
|
{
|
||||||
|
wxStockCursor cursorID = wxCURSOR_NONE;
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case wxDragCopy:
|
||||||
|
cursorID = wxCURSOR_COPY_ARROW;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxDragMove:
|
||||||
|
cursorID = wxCURSOR_ARROW;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxDragNone:
|
||||||
|
cursorID = wxCURSOR_NO_ENTRY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxDragError:
|
||||||
|
case wxDragLink:
|
||||||
|
case wxDragCancel:
|
||||||
|
default:
|
||||||
|
// put these here to make gcc happy
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursorID != wxCURSOR_NONE)
|
||||||
|
{
|
||||||
|
wxCursor cursor( cursorID );
|
||||||
|
cursor.MacInstall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
|
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
|
||||||
{
|
{
|
||||||
resultCode = operation;
|
resultCode = operation;
|
||||||
|
@@ -880,45 +880,6 @@ unsigned int wxWidgetCocoaImpl::draggingUpdated(void* s, WXWidget WXUNUSED(slf),
|
|||||||
else if ( sourceDragMask & NSDragOperationMove )
|
else if ( sourceDragMask & NSDragOperationMove )
|
||||||
result = wxDragMove;
|
result = wxDragMove;
|
||||||
|
|
||||||
// FIXME: This doesn't seem the right place for the code, as GiveFeedback
|
|
||||||
// will only get called when the drop target is inside the app itself
|
|
||||||
// but at least some cases will work now.
|
|
||||||
if (wxDropSource* source = wxDropSource::GetCurrentDropSource())
|
|
||||||
{
|
|
||||||
if (!source->GiveFeedback(result))
|
|
||||||
{
|
|
||||||
wxStockCursor cursorID = wxCURSOR_NONE;
|
|
||||||
|
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
case wxDragCopy:
|
|
||||||
cursorID = wxCURSOR_COPY_ARROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxDragMove:
|
|
||||||
cursorID = wxCURSOR_ARROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxDragNone:
|
|
||||||
cursorID = wxCURSOR_NO_ENTRY;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxDragError:
|
|
||||||
case wxDragLink:
|
|
||||||
case wxDragCancel:
|
|
||||||
default:
|
|
||||||
// put these here to make gcc happy
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cursorID != wxCURSOR_NONE)
|
|
||||||
{
|
|
||||||
wxCursor cursor( cursorID );
|
|
||||||
cursor.MacInstall();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PasteboardRef pboardRef;
|
PasteboardRef pboardRef;
|
||||||
PasteboardCreate((CFStringRef)[pboard name], &pboardRef);
|
PasteboardCreate((CFStringRef)[pboard name], &pboardRef);
|
||||||
target->SetCurrentDragPasteboard(pboardRef);
|
target->SetCurrentDragPasteboard(pboardRef);
|
||||||
|
Reference in New Issue
Block a user