Added new Drag & Drop and Clipboard interfaces

This commit is contained in:
rods%netscape.com 1999-03-19 15:57:10 +00:00
Родитель f33501ef59
Коммит 071adf265e
11 изменённых файлов: 574 добавлений и 10 удалений

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

@ -2,6 +2,14 @@
# This is a list of local files which get copied to the mozilla:dist:widget directory
#
nsIClipboard.h
nsIDragTarget.h
nsIDragSource.h
nsITextDataFlavor.h
nsIDataFlavor.h
nsITransferable.h
nsIDragService.h
nsIDraggedObject.h
nsui.h
nsIWidget.h
nsIButton.h

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

@ -25,6 +25,14 @@ include $(DEPTH)/config/autoconf.mk
DEFINES += -D_IMPL_NS_UI
EXPORTS = \
nsIClipboard.h \
nsIDragTarget.h \
nsIDragSource.h \
nsITextDataFlavor.h \
nsIDataFlavor.h \
nsITransferable.h \
nsIDragService.h \
nsIDraggedObject.h \
nsIMenuBar.h \
nsIMenu.h \
nsIMenuItem.h \

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

@ -21,16 +21,50 @@ IGNORE_MANIFEST=1
DEFINES=-D_IMPL_NS_UI
MODULE=raptor
EXPORTS=nsui.h nsIWidget.h nsIButton.h nsICheckButton.h nsIListWidget.h \
nsIComboBox.h nsITextWidget.h nsITextAreaWidget.h nsIComboBox.h \
nsIListBox.h nsIFileWidget.h nsIScrollbar.h nsGUIEvent.h \
nsIRadioButton.h nsIMouseListener.h \
nsIEventListener.h nsIMenuListener.h nsIToolkit.h nsWidgetsCID.h nsITabWidget.h \
nsITooltipWidget.h nsIAppShell.h nsStringUtil.h nsILookAndFeel.h \
nsIDialog.h nsILabel.h nsWidgetSupport.h \
nsIMenuBar.h nsIMenu.h nsIMenuItem.h nsIImageButton.h \
nsIPopUpMenu.h nsIMenuButton.h nsIImageButtonListener.h \
nsIContentConnector.h nsISelectionMgr.h
EXPORTS=nsui.h \
nsIClipboard.h \
nsIDragTarget.h \
nsIDragSource.h \
nsITextDataFlavor.h \
nsIDataFlavor.h \
nsITransferable.h \
nsIDragService.h \
nsIDraggedObject.h \
nsIWidget.h \
nsIButton.h \
nsICheckButton.h \
nsIListWidget.h \
nsIComboBox.h \
nsITextWidget.h \
nsITextAreaWidget.h \
nsIComboBox.h \
nsIListBox.h \
nsIFileWidget.h \
nsIScrollbar.h \
nsGUIEvent.h \
nsIRadioButton.h \
nsIMouseListener.h \
nsIEventListener.h \
nsIMenuListener.h \
nsIToolkit.h \
nsWidgetsCID.h \
nsITabWidget.h \
nsITooltipWidget.h \
nsIAppShell.h \
nsStringUtil.h \
nsILookAndFeel.h \
nsIDialog.h \
nsILabel.h \
nsWidgetSupport.h \
nsIMenuBar.h \
nsIMenu.h \
nsIMenuItem.h \
nsIImageButton.h \
nsIPopUpMenu.h \
nsIMenuButton.h \
nsIImageButtonListener.h \
nsIContentConnector.h \
nsISelectionMgr.h
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIClipboard_h__
#define nsIClipboard_h__
#include "nsISupports.h"
class nsITransferable;
// {8B5314BA-DB01-11d2-96CE-0060B0FB9956}
#define NS_ICLIPBOARD_IID \
{ 0x8b5314ba, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsIClipboard : public nsISupports {
public:
/**
* Gets the transferable object
*
* @param aTransferable The transferable
* @result NS_Ok if no errors
*/
NS_IMETHOD GetTransferable(nsITransferable ** aTransferable) = 0;
/**
* Sets the transferable object
*
* @param aTransferable The transferable
* @result NS_Ok if no errors
*/
NS_IMETHOD SetTransferable(nsITransferable * aTransferable) = 0;
};
#endif

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

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDataFlavor_h__
#define nsIDataFlavor_h__
#include "nsISupports.h"
#include "nsString.h"
// {8B5314BD-DB01-11d2-96CE-0060B0FB9956}
#define NS_IDATAFLAVOR_IID \
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// public static Flavor PLAIN_TEXT - A basic flavor representing plain text in UNICODE.
// public static Flavor HTML - A flavor representing HTML source in UNICODE.
class nsIDataFlavor : public nsISupports {
public:
/**
* Initializes the data flavor
*
* @param aMimeType mime string
* @param aHumanPresentableName human readable string for mime
*/
NS_IMETHOD Init(const nsString & aMimeType, const nsString & aHumanPresentableName) = 0;
/**
* Gets the Mime string
*
* @param aMimeStr string to be set
*/
NS_IMETHOD GetMimeType(nsString & aMimeStr) = 0;
/**
* Gets the Human readable version of the mime string
*
* @param aReadableStr string to be set
*/
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr) = 0;
};
#endif

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

@ -0,0 +1,53 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDragService_h__
#define nsIDragService_h__
#include "nsISupports.h"
#include "nsPoint.h"
class nsIDragSource;
class nsIImage;
// {8B5314BB-DB01-11d2-96CE-0060B0FB9956}
#define NS_IDRAGSESSION_IID \
{ 0x8b5314bb, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsIDragService : public nsISupports {
public:
/**
* Starts a modal drag session.
*
* @param aDragSrc the object being dragged
* @param aStartLocation start location of drag
* @param aImageOffset the offset the image should be from the cursor
* @param aImage image to be dragged
* @param aDoFlyback indicates image flys back
*/
NS_IMETHOD StartDragSession (nsIDragSource * aDragSrc,
nsPoint * aStartLocation,
nsPoint * aImageOffset,
nsIImage * aImage,
PRBool aDoFlyback) = 0;
};
#endif

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

@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDragSource_h__
#define nsIDragSource_h__
#include "nsISupports.h"
class nsITransferable;
class nsIDraggedObject;
// {8B5314B7-DB01-11d2-96CE-0060B0FB9956}
#define NS_IDRAGSOURCE_IID \
{ 0x8b5314b7, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsIDragSource : public nsISupports {
public:
/**
* Gets the transferable object
*
* @param aTransferable The transferable
* @result NS_Ok if no errors
*/
NS_IMETHOD GetTransferable(nsITransferable ** aTransferable) = 0;
/**
* Called when a drag session has finished with the action that occured.
*
* @param aDraggedObj the object being dragged
* @param anAction tthe action of the drag
* @result NS_Ok if no errors
*/
NS_IMETHOD DragStopped(nsIDraggedObject * aDraggedObj, PRInt32 anAction) = 0;
};
#endif

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

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDragTarget_h__
#define nsIDragTarget_h__
#include "nsISupports.h"
#include "nsPoint.h"
class nsIDraggedObject;
// {8B5314B8-DB01-11d2-96CE-0060B0FB9956}
#define NS_IDRAGTARGET_IID \
{ 0x8b5314b8, 0xdb01, 0x11d2, \
{ 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsIDragTarget : public nsISupports {
public:
/**
* Called when a draggedObject is dragged PRInt32o this destination.
*
* @param aDraggedObj the object being dragged
* @param aLocation X,Y mouse coord in destination frame
*/
NS_IMETHOD DragEnter(nsIDraggedObject * aDraggedObj, nsPoint * aLocation) = 0;
/**
* Called when a draggedObject is dragged inside this destination.
*
* @param aDraggedObj the object being dragged
* @param aLocation X,Y mouse coord in destination frame
*/
NS_IMETHOD DragOver(nsIDraggedObject * aDraggedObj, nsPoint * aLocation) = 0;
/**
* Called when a draggedObject is dragged outside this destination.
*
* @param aDraggedObj the object being dragged
* @param aLocation X,Y mouse coord in destination frame
*/
NS_IMETHOD DragExit(nsIDraggedObject * aDraggedObj, nsPoint * aLocation) = 0;
/**
* Called when a drop occurs with the current set of actions.
*
* @param aDraggedObj the object being dragged
* @param aActions action to be taken
* @result Return NS_OK is successful
*/
NS_IMETHOD DragDrop(nsIDraggedObject * aDraggedObj, PRInt32 aActions) = 0;
};
#endif

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

@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDraggedObject_h__
#define nsIDraggedObject_h__
#include "nsISupports.h"
#include "nsCoord.h"
class nsIDragSource;
class nsIDragTarget;
class nsITransferable;
class nsIFrame;
// {8B5314B9-DB01-11d2-96CE-0060B0FB9956}
#define NS_IDRAGGEDOBJECT_IID \
{ 0x8b5314b9, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsIDraggedObject : public nsISupports {
public:
/**
* Returns the image that represents the dragged data. This is uses extensively on the NeXT by drag destinations to show the
* user what things might look like if the object were dropped.
*
* @param aDraggedObj the object being dragged
* @param aX X mouse coord in destination frame
* @param aY Y mouse coord in destination frame
*/
//NS_IMETHOD GetImage(nsIImage * anImage) = 0;
/**
* Returns the x,y offset of the dragged image from the cursor.
*
* @param aDraggedObj the object being dragged
* @param aX X mouse coord in destination frame
* @param aY Y mouse coord in destination frame
*/
NS_IMETHOD GetDragOffset(nscoord * aX, nscoord * aY) = 0;
/**
* Gets the transferable object
*
* @param aTransferable The transferable
* @result NS_Ok if no errors
*/
NS_IMETHOD GetTransferable(nsITransferable ** aTransferable) = 0;
/**
* Returns the DragSource if the drag session occured in the same address space. If it source is not in the same address
* NULL is returned.
*
* @param nsIDragSource The drag source
*/
NS_IMETHOD GetSource(nsIDragSource ** aDragSrc) = 0;
/**
* Returns the destination the dragged object is currently over.
*
* @param nsIDragTarget the destination target
* @result Returns NULL if the destination is not in the same address space.
*/
NS_IMETHOD GetTarget(nsIDragTarget ** aTarget) = 0;
/**
* Returns the nsIFrame we are dragging into
*
* @param aDraggedObj the object being dragged
* @result Returns NULL if the destination is not in the same address space.
*/
NS_IMETHOD GetTargetnFrame(nsIFrame ** aFrame) = 0;
};
#endif

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

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsITransferable_h__
#define nsITransferable_h__
#include "nsISupports.h"
#include "nsString.h"
class nsIDataFlavor;
class nsISupportsArray;
// {8B5314BC-DB01-11d2-96CE-0060B0FB9956}
#define NS_ITRANSFERABLE_IID \
{ 0x8b5314bc, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
class nsITransferable : public nsISupports {
public:
/**
* Get the list of data flavors that this transferable supports.
*
* @param aDataFlavorList fills list with supported flavors
*/
NS_IMETHOD GetTransferDataFlavors(nsISupportsArray * aDataFlavorList) = 0;
/**
* See if the given flavor is supported
*
* @param aFlavor the flavor to check
* @result Returns NS_OK if supported, return NS_ERROR_FAILURE if not
*/
NS_IMETHOD IsDataFlavorSupported(nsIDataFlavor * aFlavor) = 0;
/**
* Given a flavor retrieve the data.
*
* @param aFlavor the flavor of data to retrieve
* @param aData the data
*/
NS_IMETHOD GetTransferData(nsIDataFlavor * aFlavor, nsISupports ** aData) = 0;
/**
* Sets data
*
* @param aFlavor the flavor of data to retrieve
* @param aData the data
*/
NS_IMETHOD SetTransferData(nsString & aStr) = 0;
/**
* Initializes the data flavor
*
* @param aMimeType mime string
* @param aHumanPresentableName human readable string for mime
*/
NS_IMETHOD AddDataFlavor(const nsString & aMimeType, const nsString & aHumanPresentableName) = 0;
/**
* Returns the Platform specific data object
*
* @param aData the native data to be put on the clipboard
*/
NS_IMETHOD GetNativeData(void ** aData) = 0;
/**
* Sets Native data
*
* @param aData the native data
*/
NS_IMETHOD SetNativeData(void * aData) = 0;
};
#endif

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

@ -172,4 +172,38 @@
#define NS_TREEVIEW_CID \
{ 0xfaf80a1, 0x815c, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
//-----------------------------------------------------------
//Drag & Drop & Clipboard
//-----------------------------------------------------------
// {8B5314B9-DB01-11d2-96CE-0060B0FB9956}
#define NS_DRAGGEDOBJECT_CID \
{ 0x8b5314b9, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314BB-DB01-11d2-96CE-0060B0FB9956}
#define NS_DRAGSESSION_CID \
{ 0x8b5314bb, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314BC-DB01-11d2-96CE-0060B0FB9956}
#define NS_TRANSFERABLE_CID \
{ 0x8b5314bc, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314BA-DB01-11d2-96CE-0060B0FB9956}
#define NS_CLIPBOARD_CID \
{ 0x8b5314ba, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314B7-DB01-11d2-96CE-0060B0FB9956}
#define NS_DRAGSOURCE_CID \
{ 0x8b5314b7, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314B8-DB01-11d2-96CE-0060B0FB9956}
#define NS_DRAGTARGET_CID \
{ 0x8b5314b8, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
// {8B5314BD-DB01-11d2-96CE-0060B0FB9956}
#define NS_DATAFLAVOR_CID \
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
#define NS_DATAOBJ_CID \
{ 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } }