Accept any kind of drag event, not just drops.

This commit is contained in:
pinkerton%netscape.com 1999-05-14 18:49:42 +00:00
Родитель e929ab6c86
Коммит 3ab8468ab9
2 изменённых файлов: 14 добавлений и 13 удалений

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

@ -188,22 +188,19 @@ PRBool nsMacEventHandler::HandleMenuCommand(
}
//-------------------------------------------------------------------------
//
// DropOccurred
// DragEvent
//
//-------------------------------------------------------------------------
//
// Someone on the outside told us that a drop from the DragManager has occurred in
// this window. We need to send this event into Gecko for processing. Create a Gecko
// event of type NS_DRAGDROP_DROP and pass it in.
// Someone on the outside told us that something related to a drag is happening. The
// exact event type is passed in as |aMessage|. We need to send this event into Gecko
// for processing. Create a Gecko event (using the appropriate message type) and pass
// it along.
//
// ¥¥¥THIS REALLY NEEDS TO BE CLEANED UP! TOO MUCH CODE COPIED FROM ConvertOSEventToMouseEvent
//
PRBool nsMacEventHandler::DropOccurred ( Point aMouseGlobal, UInt16 aKeyModifiers )
PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers )
{
printf("dispatching drop into Gecko\n");
printf("dispatching event %ld into Gecko\n", aMessage);
nsMouseEvent geckoEvent;
// convert the mouse to local coordinates. We have to do all the funny port origin
@ -234,10 +231,12 @@ printf("dispatching drop into Gecko\n");
widgetHit->LocalToWindowCoordinate(widgetOrigin);
widgetHitPoint.MoveBy(-widgetOrigin.x, -widgetOrigin.y);
}
else
widgetHit = mTopLevelWidget;
// nsEvent
geckoEvent.eventStructType = NS_DRAGDROP_EVENT;
geckoEvent.message = NS_DRAGDROP_DROP;
geckoEvent.message = aMessage;
geckoEvent.point = widgetHitPoint;
geckoEvent.time = PR_IntervalNow();

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

@ -23,6 +23,8 @@
#include "nsDeleteObserver.h"
#include "nsCOMPtr.h"
#include "nsGUIEvent.h"
#include "prtypes.h"
class nsWindow;
class nsMacWindow;
@ -36,8 +38,8 @@ public:
virtual PRBool HandleOSEvent(EventRecord& aOSEvent);
virtual PRBool HandleMenuCommand(EventRecord& aOSEvent, long aMenuResult);
// Tell Gecko that a drop has occurred
virtual PRBool DropOccurred ( Point aMouseGlobal, UInt16 aKeyModifiers ) ;
// Tell Gecko that a drag event has occurred and should go into Gecko
virtual PRBool DragEvent ( unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers ) ;
//virtual PRBool TrackDrag ( Point aMouseGlobal, UInt32 aKeyModifiers ) ;
protected: