make Camino work with new cocoa drag and drop implementation. b=332913 r=smorgan sr=pinkerton

This commit is contained in:
joshmoz%gmail.com 2006-10-25 22:46:10 +00:00
Родитель 75db080f6d
Коммит 70355b56fb
3 изменённых файлов: 3 добавлений и 120 удалений

Просмотреть файл

@ -808,16 +808,6 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
return mWindow;
}
- (BOOL)shouldAcceptDragFromSource:(id)dragSource
{
if ((dragSource == self) || (dragSource == mTabItem) || (dragSource == [[mWindow delegate] proxyIconView]))
return NO;
if ([mTabItem isMemberOfClass:[BrowserTabViewItem class]] && (dragSource == [(BrowserTabViewItem*)mTabItem tabItemContentsView]))
return NO;
return YES;
}
//
// closeBrowserWindow

Просмотреть файл

@ -55,7 +55,6 @@ class nsIDOMNode;
class nsIDOMPopupBlockedEvent;
class nsIDOMEvent;
class nsIEventSink;
class nsIDragHelperService;
class nsIPrintSettings;
class nsIURI;
class nsISupports;
@ -121,11 +120,6 @@ typedef enum {
- (NSMenu*)contextMenu;
- (NSWindow*)nativeWindow;
// Ask whether the browser should accept a drag from the given source.
// Should return NO if the source is a container for the browser, or
// another item that represents the same entity (e.g. tab or proxy icon)
- (BOOL)shouldAcceptDragFromSource:(id)dragSource;
// Gecko wants to close the "window" associated with this instance. Some
// embedding apps might want to multiplex multiple gecko views in one
// window (tabbed browsing). This gives them the chance to change the
@ -171,10 +165,6 @@ typedef enum {
CHBrowserListener* _listener;
NSWindow* mWindow;
nsIDragHelperService* mDragHelper;
NSPoint mLastTrackedLocation;
NSWindow* mLastTrackedWindow;
nsIPrintSettings* mPrintSettings; // we own this
BOOL mUseGlobalPrintSettings;
}

Просмотреть файл

@ -107,13 +107,12 @@
#import "mozView.h"
typedef unsigned int DragReference;
#include "nsIDragHelperService.h"
// Cut/copy/paste
#include "nsIClipboardCommands.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIEventSink.h"
// Undo/redo
#include "nsICommandManager.h"
#include "nsICommandParams.h"
@ -240,10 +239,6 @@ const long NSFindPanelActionSetFindString = 7;
baseWin->InitWindow((NSView*)self, nsnull, 0, 0, (int)frame.size.width, (int)frame.size.height);
baseWin->Create();
// register the view as a drop site for text, files, and urls.
[self registerForDraggedTypes: [NSArray arrayWithObjects:
NSStringPboardType, NSURLPboardType, NSFilenamesPboardType, nil]];
// The value of mUseGlobalPrintSettings can't change during our lifetime.
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
PRBool tempBool = PR_TRUE;
@ -1299,98 +1294,6 @@ const long NSFindPanelActionSetFindString = 7;
}
#pragma mark -
- (BOOL)shouldAcceptDrag:(id <NSDraggingInfo>)sender
{
id<CHBrowserContainer> browserContainer = [self getBrowserContainer];
if (browserContainer)
return [browserContainer shouldAcceptDragFromSource:[sender draggingSource]];
return YES;
}
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender
{
if (![self shouldAcceptDrag:sender])
return NSDragOperationNone;
// NSLog(@"draggingEntered");
nsCOMPtr<nsIDragHelperService> helper(do_GetService("@mozilla.org/widget/draghelperservice;1"));
mDragHelper = helper.get();
NS_IF_ADDREF(mDragHelper);
NS_ASSERTION ( mDragHelper, "Couldn't get a drag service, we're in big trouble" );
if ( mDragHelper ) {
mLastTrackedLocation = [sender draggingLocation];
mLastTrackedWindow = [sender draggingDestinationWindow];
nsCOMPtr<nsIEventSink> sink;
[self findEventSink:getter_AddRefs(sink) forPoint:mLastTrackedLocation inWindow:mLastTrackedWindow];
if (sink)
mDragHelper->Enter ( [sender draggingSequenceNumber], sink );
}
return NSDragOperationCopy;
}
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
// NSLog(@"draggingExited");
if ( mDragHelper ) {
nsCOMPtr<nsIEventSink> sink;
[self findEventSink:getter_AddRefs(sink)
forPoint:mLastTrackedLocation /* [sender draggingLocation] */
inWindow:mLastTrackedWindow /* [sender draggingDestinationWindow] */
];
if (sink)
mDragHelper->Leave( [sender draggingSequenceNumber], sink );
NS_RELEASE(mDragHelper);
}
}
- (unsigned int)draggingUpdated:(id <NSDraggingInfo>)sender
{
if (![self shouldAcceptDrag:sender])
return NSDragOperationNone;
// NSLog(@"draggingUpdated");
PRBool dropAllowed = PR_FALSE;
if ( mDragHelper ) {
mLastTrackedLocation = [sender draggingLocation];
mLastTrackedWindow = [sender draggingDestinationWindow];
nsCOMPtr<nsIEventSink> sink;
[self findEventSink:getter_AddRefs(sink) forPoint:mLastTrackedLocation inWindow:mLastTrackedWindow];
if (sink)
mDragHelper->Tracking([sender draggingSequenceNumber], sink, &dropAllowed);
}
return dropAllowed ? NSDragOperationCopy : NSDragOperationNone;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
if (![self shouldAcceptDrag:sender])
return NO;
PRBool dragAccepted = PR_FALSE;
if ( mDragHelper ) {
nsCOMPtr<nsIEventSink> sink;
[self findEventSink:getter_AddRefs(sink) forPoint:[sender draggingLocation]
inWindow:[sender draggingDestinationWindow]];
if (sink)
mDragHelper->Drop([sender draggingSequenceNumber], sink, &dragAccepted);
}
return dragAccepted ? YES : NO;
}
#pragma mark -
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem