gecko/widget/nsBaseDragService.h
Mason Chang 45545e98e0 Bug 1085696. Part 1 Move widget/xpwidget to /widget. r=roc
--HG--
rename : widget/xpwidgets/ContentHelper.cpp => widget/ContentHelper.cpp
rename : widget/xpwidgets/ContentHelper.h => widget/ContentHelper.h
rename : widget/xpwidgets/GfxDriverInfo.cpp => widget/GfxDriverInfo.cpp
rename : widget/xpwidgets/GfxDriverInfo.h => widget/GfxDriverInfo.h
rename : widget/xpwidgets/GfxInfoBase.cpp => widget/GfxInfoBase.cpp
rename : widget/xpwidgets/GfxInfoBase.h => widget/GfxInfoBase.h
rename : widget/xpwidgets/GfxInfoCollector.cpp => widget/GfxInfoCollector.cpp
rename : widget/xpwidgets/GfxInfoCollector.h => widget/GfxInfoCollector.h
rename : widget/xpwidgets/GfxInfoWebGL.cpp => widget/GfxInfoWebGL.cpp
rename : widget/xpwidgets/GfxInfoWebGL.h => widget/GfxInfoWebGL.h
rename : widget/xpwidgets/GfxInfoX11.cpp => widget/GfxInfoX11.cpp
rename : widget/xpwidgets/GfxInfoX11.h => widget/GfxInfoX11.h
rename : widget/xpwidgets/InputData.cpp => widget/InputData.cpp
rename : widget/xpwidgets/PuppetWidget.cpp => widget/PuppetWidget.cpp
rename : widget/xpwidgets/PuppetWidget.h => widget/PuppetWidget.h
rename : widget/xpwidgets/ScreenProxy.cpp => widget/ScreenProxy.cpp
rename : widget/xpwidgets/ScreenProxy.h => widget/ScreenProxy.h
rename : widget/shared/SharedWidgetUtils.cpp => widget/SharedWidgetUtils.cpp
rename : widget/xpwidgets/WidgetUtils.cpp => widget/WidgetUtils.cpp
rename : widget/xpwidgets/nsAppShellSingleton.h => widget/nsAppShellSingleton.h
rename : widget/xpwidgets/nsBaseAppShell.cpp => widget/nsBaseAppShell.cpp
rename : widget/xpwidgets/nsBaseAppShell.h => widget/nsBaseAppShell.h
rename : widget/xpwidgets/nsBaseClipboard.cpp => widget/nsBaseClipboard.cpp
rename : widget/xpwidgets/nsBaseClipboard.h => widget/nsBaseClipboard.h
rename : widget/xpwidgets/nsBaseDragService.cpp => widget/nsBaseDragService.cpp
rename : widget/xpwidgets/nsBaseDragService.h => widget/nsBaseDragService.h
rename : widget/xpwidgets/nsBaseFilePicker.cpp => widget/nsBaseFilePicker.cpp
rename : widget/xpwidgets/nsBaseFilePicker.h => widget/nsBaseFilePicker.h
rename : widget/xpwidgets/nsBaseScreen.cpp => widget/nsBaseScreen.cpp
rename : widget/xpwidgets/nsBaseScreen.h => widget/nsBaseScreen.h
rename : widget/xpwidgets/nsBaseWidget.cpp => widget/nsBaseWidget.cpp
rename : widget/xpwidgets/nsBaseWidget.h => widget/nsBaseWidget.h
rename : widget/xpwidgets/nsClipboardHelper.cpp => widget/nsClipboardHelper.cpp
rename : widget/xpwidgets/nsClipboardHelper.h => widget/nsClipboardHelper.h
rename : widget/xpwidgets/nsClipboardProxy.cpp => widget/nsClipboardProxy.cpp
rename : widget/xpwidgets/nsClipboardProxy.h => widget/nsClipboardProxy.h
rename : widget/xpwidgets/nsColorPickerProxy.cpp => widget/nsColorPickerProxy.cpp
rename : widget/xpwidgets/nsColorPickerProxy.h => widget/nsColorPickerProxy.h
rename : widget/xpwidgets/nsContentProcessWidgetFactory.cpp => widget/nsContentProcessWidgetFactory.cpp
rename : widget/xpwidgets/nsFilePickerProxy.cpp => widget/nsFilePickerProxy.cpp
rename : widget/xpwidgets/nsFilePickerProxy.h => widget/nsFilePickerProxy.h
rename : widget/xpwidgets/nsHTMLFormatConverter.cpp => widget/nsHTMLFormatConverter.cpp
rename : widget/xpwidgets/nsHTMLFormatConverter.h => widget/nsHTMLFormatConverter.h
rename : widget/xpwidgets/nsIWidgetListener.cpp => widget/nsIWidgetListener.cpp
rename : widget/xpwidgets/nsIdleService.cpp => widget/nsIdleService.cpp
rename : widget/xpwidgets/nsIdleService.h => widget/nsIdleService.h
rename : widget/xpwidgets/nsNativeTheme.cpp => widget/nsNativeTheme.cpp
rename : widget/xpwidgets/nsNativeTheme.h => widget/nsNativeTheme.h
rename : widget/xpwidgets/nsPrimitiveHelpers.cpp => widget/nsPrimitiveHelpers.cpp
rename : widget/xpwidgets/nsPrimitiveHelpers.h => widget/nsPrimitiveHelpers.h
rename : widget/xpwidgets/nsPrintOptionsImpl.cpp => widget/nsPrintOptionsImpl.cpp
rename : widget/xpwidgets/nsPrintOptionsImpl.h => widget/nsPrintOptionsImpl.h
rename : widget/xpwidgets/nsPrintSession.cpp => widget/nsPrintSession.cpp
rename : widget/xpwidgets/nsPrintSession.h => widget/nsPrintSession.h
rename : widget/xpwidgets/nsPrintSettingsImpl.cpp => widget/nsPrintSettingsImpl.cpp
rename : widget/xpwidgets/nsPrintSettingsImpl.h => widget/nsPrintSettingsImpl.h
rename : widget/xpwidgets/nsScreenManagerProxy.cpp => widget/nsScreenManagerProxy.cpp
rename : widget/xpwidgets/nsScreenManagerProxy.h => widget/nsScreenManagerProxy.h
rename : widget/xpwidgets/nsTransferable.cpp => widget/nsTransferable.cpp
rename : widget/xpwidgets/nsTransferable.h => widget/nsTransferable.h
rename : widget/xpwidgets/nsXPLookAndFeel.cpp => widget/nsXPLookAndFeel.cpp
rename : widget/xpwidgets/nsXPLookAndFeel.h => widget/nsXPLookAndFeel.h
2014-10-23 10:16:45 -07:00

159 lines
5.0 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsBaseDragService_h__
#define nsBaseDragService_h__
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsITransferable.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDataTransfer.h"
#include "nsCOMPtr.h"
#include "nsRect.h"
#include "nsPoint.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/HTMLCanvasElement.h"
// translucency level for drag images
#define DRAG_TRANSLUCENCY 0.65
class nsIContent;
class nsIDOMNode;
class nsIFrame;
class nsPresContext;
class nsIImageLoadingContent;
class nsICanvasElementExternal;
namespace mozilla {
namespace gfx {
class SourceSurface;
}
}
/**
* XP DragService wrapper base class
*/
class nsBaseDragService : public nsIDragService,
public nsIDragSession
{
public:
typedef mozilla::gfx::SourceSurface SourceSurface;
nsBaseDragService();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDragSession and nsIDragService
NS_DECL_NSIDRAGSERVICE
NS_DECL_NSIDRAGSESSION
void SetDragEndPoint(nsIntPoint aEndDragPoint) { mEndDragPoint = aEndDragPoint; }
uint16_t GetInputSource() { return mInputSource; }
protected:
virtual ~nsBaseDragService();
/**
* Draw the drag image, if any, to a surface and return it. The drag image
* is constructed from mImage if specified, or aDOMNode if mImage is null.
*
* aRegion may be used to draw only a subset of the element. This region
* should be supplied using x and y coordinates measured in css pixels
* that are relative to the upper-left corner of the window.
*
* aScreenX and aScreenY should be the screen coordinates of the mouse click
* for the drag. These are in global display pixels.
*
* On return, aScreenDragRect will contain the screen coordinates of the
* area being dragged. This is used by the platform-specific part of the
* drag service to determine the drag feedback. This rect will be in the
* device pixels of the presContext.
*
* If there is no drag image, the returned surface will be null, but
* aScreenDragRect will still be set to the drag area.
*
* aPresContext will be set to the nsPresContext used determined from
* whichever of mImage or aDOMNode is used.
*/
nsresult DrawDrag(nsIDOMNode* aDOMNode,
nsIScriptableRegion* aRegion,
int32_t aScreenX, int32_t aScreenY,
nsIntRect* aScreenDragRect,
mozilla::RefPtr<SourceSurface>* aSurface,
nsPresContext **aPresContext);
/**
* Draw a drag image for an image node specified by aImageLoader or aCanvas.
* This is called by DrawDrag.
*/
nsresult DrawDragForImage(nsPresContext* aPresContext,
nsIImageLoadingContent* aImageLoader,
mozilla::dom::HTMLCanvasElement* aCanvas,
int32_t aScreenX, int32_t aScreenY,
nsIntRect* aScreenDragRect,
mozilla::RefPtr<SourceSurface>* aSurface);
/**
* Convert aScreenX and aScreenY from CSS pixels into unscaled device pixels.
*/
void
ConvertToUnscaledDevPixels(nsPresContext* aPresContext,
int32_t* aScreenX, int32_t* aScreenY);
/**
* If the drag image is a popup, open the popup when the drag begins.
*/
void OpenDragPopup();
bool mCanDrop;
bool mOnlyChromeDrop;
bool mDoingDrag;
// true if mImage should be used to set a drag image
bool mHasImage;
// true if the user cancelled the drag operation
bool mUserCancelled;
uint32_t mDragAction;
nsSize mTargetSize;
nsCOMPtr<nsIDOMNode> mSourceNode;
nsCOMPtr<nsIDOMDocument> mSourceDocument; // the document at the drag source. will be null
// if it came from outside the app.
nsCOMPtr<nsIDOMDataTransfer> mDataTransfer;
// used to determine the image to appear on the cursor while dragging
nsCOMPtr<nsIDOMNode> mImage;
// offset of cursor within the image
int32_t mImageX;
int32_t mImageY;
// set if a selection is being dragged
nsCOMPtr<nsISelection> mSelection;
// set if the image in mImage is a popup. If this case, the popup will be opened
// and moved instead of using a drag image.
nsCOMPtr<nsIContent> mDragPopup;
// the screen position where drag gesture occurred, used for positioning the
// drag image when no image is specified. If a value is -1, no event was
// supplied so the screen position is not known
int32_t mScreenX;
int32_t mScreenY;
// the screen position where the drag ended
nsIntPoint mEndDragPoint;
uint32_t mSuppressLevel;
// The input source of the drag event. Possible values are from nsIDOMMouseEvent.
uint16_t mInputSource;
};
#endif // nsBaseDragService_h__