зеркало из https://github.com/mozilla/gecko-dev.git
r=pedemont, sr=blizzard, a=asa OS/2 only - beginning of drag/drop
This commit is contained in:
Родитель
6a55e869ef
Коммит
b25f8d8f9b
|
@ -60,17 +60,9 @@ CPPSRCS = \
|
|||
nsToolkit.cpp \
|
||||
nsWidgetFactory.cpp \
|
||||
nsWindow.cpp \
|
||||
nsDragService.cpp \
|
||||
$(NULL)
|
||||
|
||||
# XXX FILES temporarily removed
|
||||
# nsDragService.cpp \
|
||||
|
||||
# XXX OS2TODO
|
||||
# nsNativeDragTarget.cpp \
|
||||
# nsNativeDragSource.cpp \
|
||||
# nsDataObj.cpp \
|
||||
# nsDataObjCollection.cpp \
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpwidgets_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,90 +1,69 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla OS/2 libraries.
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is John Fairhurst,
|
||||
* <john_fairhurst@iname.com>. Portions created by John Fairhurst are
|
||||
* Copyright (C) 1999 John Fairhurst. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
*/
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsdragservice_h
|
||||
#define _nsdragservice_h
|
||||
|
||||
// Drag service. Manages drag & drop events, converts between OS/2 and
|
||||
// mozilla-style databuffers.
|
||||
//
|
||||
// This exists as a singleton in the nsModule; it's created at creation of the
|
||||
// primaeval appshell and destroyed at DLL unload-time.
|
||||
//
|
||||
#ifndef nsDragService_h__
|
||||
#define nsDragService_h__
|
||||
|
||||
#include "nsBaseDragService.h"
|
||||
|
||||
class nsFileSpec;
|
||||
|
||||
// This implements nsIDragSession and nsIDragService.
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
|
||||
class nsDragService : public nsBaseDragService
|
||||
{
|
||||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
// nsIDragService
|
||||
NS_IMETHOD InvokeDragSession( nsIDOMNode *aDOMNode,
|
||||
nsISupportsArray *anArrayTransferables,
|
||||
nsIRegion *aRegion, PRUint32 aActionType);
|
||||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
// nsIDragSession
|
||||
NS_IMETHOD GetData( nsITransferable *aTransferable, PRUint32 aItemIndex);
|
||||
NS_IMETHOD GetNumDropItems( PRUint32 *aNumItems);
|
||||
NS_IMETHOD IsDataFlavorSupported( nsString *aDataFlavour);
|
||||
// nsIDragService
|
||||
NS_IMETHOD InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * aTransferables, nsIScriptableRegion * aRegion, PRUint32 aActionType);
|
||||
|
||||
// platform methods, called from nsWindow
|
||||
void InitDragOver( PDRAGINFO aDragInfo);
|
||||
MRESULT TermDragOver();
|
||||
// nsIDragSession
|
||||
NS_IMETHOD GetNumDropItems(PRUint32 *aNumDropItems);
|
||||
NS_IMETHOD GetData(nsITransferable *aTransferable, PRUint32 aItemIndex);
|
||||
NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval);
|
||||
|
||||
void InitDragExit( PDRAGINFO aDragInfo);
|
||||
void TermDragExit();
|
||||
HWND mDragWnd;
|
||||
|
||||
void InitDrop( PDRAGINFO aDragInfo);
|
||||
void TermDrop();
|
||||
// our source data items
|
||||
nsCOMPtr<nsISupportsArray> mSourceDataItems;
|
||||
|
||||
protected:
|
||||
// Natives
|
||||
void CreateDragItems( PULONG pCount, PDRAGITEM *ppItems,
|
||||
nsITransferable *aTransferable);
|
||||
void FillDragItem( PDRAGITEM aItem, nsITransferable *aTransferable);
|
||||
void FillDragItem( PDRAGITEM aItem, nsFileSpec *aFilespec);
|
||||
nsresult InvokeDrag( PDRAGITEM aItems, ULONG aCItems, PRUint32 aActionType);
|
||||
MRESULT HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
void DoPushedOS2FILE( PDRAGITEM pItem, const char *szRf,
|
||||
void **pData, PRUint32 *cData);
|
||||
void DoMozillaXfer( PDRAGITEM pItem, char *szFlavour,
|
||||
void **ppData, PRUint32 *cData);
|
||||
|
||||
HWND mDragWnd;
|
||||
HPOINTER mIcon;
|
||||
|
||||
// State; allocated draginfo & outstanding items
|
||||
PDRAGINFO mDragInfo;
|
||||
PFNWP mWndProc;
|
||||
ULONG mDragItems;
|
||||
|
||||
friend MRESULT EXPENTRY fnwpDragSource(HWND,ULONG,MPARAM,MPARAM);
|
||||
friend MRESULT EXPENTRY nsDragWindowProc( HWND, ULONG, MPARAM, MPARAM);
|
||||
};
|
||||
|
||||
nsresult NS_GetDragService( nsISupports **aDragService);
|
||||
|
||||
#endif
|
||||
#endif // nsDragService_h__
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
#include "nsClipboardHelper.h"
|
||||
#include "nsTransferable.h"
|
||||
#include "nsHTMLFormatConverter.h"
|
||||
// OS2TODO #include "nsDragService.h"
|
||||
|
||||
#include "nsFrameWindow.h" // OS/2 only
|
||||
|
||||
|
@ -79,7 +78,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
// OS2TODO NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
|
||||
|
||||
// custom "contructor" methods
|
||||
|
@ -240,15 +239,10 @@ static const nsModuleComponentInfo components[] =
|
|||
NS_CLIPBOARDHELPER_CID,
|
||||
"@mozilla.org/widget/clipboardhelper;1",
|
||||
nsClipboardHelperConstructor },
|
||||
|
||||
// OS2TODO
|
||||
#if 0
|
||||
{ "OS/2 Drag Service",
|
||||
NS_DRAGSERVICE_CID,
|
||||
"@mozilla.org/widget/dragservice;1",
|
||||
nsDragServiceConstructor },
|
||||
#endif
|
||||
|
||||
{ "OS/2 File Picker",
|
||||
NS_FILEPICKER_CID,
|
||||
"@mozilla.org/filepicker;1",
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsplugindefs.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
@ -1942,6 +1943,7 @@ PRBool nsWindow::OnKey( MPARAM mp1, MPARAM mp2)
|
|||
gWidgetModuleData->ConvertToUcs( (char *)inbuf, (PRUnichar *)outbuf, 4);
|
||||
|
||||
event.charCode = outbuf[0];
|
||||
|
||||
if (event.isControl && !(fsFlags & (KC_VIRTUALKEY | KC_DEADKEY))) {
|
||||
if (!event.isShift && (event.charCode >= 'A' && event.charCode <= 'Z'))
|
||||
{
|
||||
|
@ -2240,13 +2242,11 @@ PRBool nsWindow::ProcessMessage( ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT &rc)
|
|||
break;
|
||||
|
||||
case DM_DRAGOVER:
|
||||
rc = MRFROM2SHORT(DOR_DROP, DO_COPY);
|
||||
result = PR_TRUE;
|
||||
// result = OnDragOver( mp1, mp2, rc);
|
||||
result = OnDragOver(mp1, mp2, rc);
|
||||
break;
|
||||
|
||||
case DM_DRAGLEAVE:
|
||||
result = OnDragLeave( mp1, mp2);
|
||||
result = OnDragLeave(mp1, mp2);
|
||||
break;
|
||||
|
||||
case DM_DROP:
|
||||
|
@ -3000,30 +3000,44 @@ void nsWindow::RemoveFromStyle( ULONG style)
|
|||
|
||||
#define DispatchDragDropEvent(msg) DispatchStandardEvent(msg,NS_DRAGDROP_EVENT)
|
||||
|
||||
// XXXX KNOCKED OUT UNTIL nsDragService.cpp is fixed
|
||||
|
||||
PRBool nsWindow::OnDragOver( MPARAM mp1, MPARAM mp2, MRESULT &mr)
|
||||
PRBool nsWindow::OnDragOver(MPARAM mp1, MPARAM mp2, MRESULT &mr)
|
||||
{
|
||||
// Drawing drop feedback should be fun, have to get DrgGetPS() involved
|
||||
// somehow.
|
||||
nsresult rv;
|
||||
USHORT usDrop = DOR_DROP;
|
||||
USHORT usDefaultOp = DO_MOVE;
|
||||
PDRAGINFO pdraginfo = (PDRAGINFO)mp1;
|
||||
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("@mozilla.org/widget/dragservice;1", &rv);
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
if (dragSession) {
|
||||
PRBool canDrop;
|
||||
dragSession->GetCanDrop(&canDrop);
|
||||
if (!canDrop)
|
||||
usDrop = DOR_NODROP;
|
||||
|
||||
switch (pdraginfo->usOperation) {
|
||||
case DO_COPY:
|
||||
usDefaultOp = DO_COPY;
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_COPY);
|
||||
break;
|
||||
case DO_LINK:
|
||||
usDefaultOp = DO_LINK;
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_LINK);
|
||||
break;
|
||||
default:
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_MOVE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
usDrop = DOR_NEVERDROP;
|
||||
}
|
||||
|
||||
// Tell drag service about the drag
|
||||
// gWidgetModuleData->dragService->InitDragOver( (PDRAGINFO) mp1);
|
||||
mr = MRFROM2SHORT(usDrop, usDefaultOp);
|
||||
|
||||
// Invoke gecko for enter if appropriate
|
||||
// if( !mDragInside)
|
||||
// {
|
||||
// DispatchDragDropEvent( NS_DRAGDROP_ENTER);
|
||||
// mDragInside = TRUE;
|
||||
// }
|
||||
DispatchDragDropEvent(NS_DRAGDROP_OVER);
|
||||
|
||||
// Invoke for 'over' to set candrop flag
|
||||
// DispatchDragDropEvent( NS_DRAGDROP_OVER);
|
||||
|
||||
// Get action back from drag service
|
||||
// mr = gWidgetModuleData->dragService->TermDragOver();
|
||||
|
||||
return PR_TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool nsWindow::OnDragLeave( MPARAM mp1, MPARAM mp2)
|
||||
|
@ -3037,15 +3051,30 @@ PRBool nsWindow::OnDragLeave( MPARAM mp1, MPARAM mp2)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool nsWindow::OnDrop( MPARAM mp1, MPARAM mp2)
|
||||
PRBool nsWindow::OnDrop(MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
// gWidgetModuleData->dragService->InitDrop( (PDRAGINFO) mp1);
|
||||
DispatchDragDropEvent( NS_DRAGDROP_DROP);
|
||||
// gWidgetModuleData->dragService->TermDrop();
|
||||
nsresult rv;
|
||||
PDRAGINFO pdraginfo = (PDRAGINFO)mp1;
|
||||
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("@mozilla.org/widget/dragservice;1", &rv);
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
|
||||
mDragInside = FALSE;
|
||||
switch (pdraginfo->usOperation) {
|
||||
case DO_COPY:
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_COPY);
|
||||
break;
|
||||
case DO_LINK:
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_LINK);
|
||||
break;
|
||||
default:
|
||||
dragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_MOVE);
|
||||
break;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
DispatchDragDropEvent( NS_DRAGDROP_DROP);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче