nsIDragSession 编辑

widget/public/nsIDragSession.idlScriptable Provides support for interacting with an ongoing drag session during a drag and drop operation. Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

void getData( in nsITransferable aTransferable, in unsigned long aItemIndex );
boolean isDataFlavorSupported( in string aDataFlavor );

Attributes

AttributeTypeDescription
canDropbooleanSet the current state of the drag, whether it can be dropped or not. Usually the target "frame" sets this so the native system can render the correct feedback.
dataTransfernsIDOMDataTransferThe data transfer object for the current drag operation.
dragActionunsigned longSets the action (copy, move, link and so on) for the current drag. (See nsIDragService)
numDropItemsunsigned longGet the number of items that were dropped. Read only.
onlyChromeDropbooleanIndicates if the drop event should be dispatched only to chrome. This allows chrome to handle a drag that was refused by content.
sourceDocumentnsIDOMDocumentThe document where the drag was started, which will be null if the drag originated outside the application. Useful for determining if a drop originated in the same document. Read only.
sourceNodensIDOMNodeThe DOM node that was originally dragged to start the session, which will be null if the drag originated outside the application. Read only.
targetSizensSizeSets the current width and height of the drag target area. It will contain the current size of the Frame that the drag is currently in. Native code only!

Methods

getData()

Gets data from a drag and drop operation. Can be called while the drag is in process or after the drop has completed.

void getData(
  in nsITransferable aTransferable,
  in unsigned long aItemIndex
);
Parameters
aTransferable
The transferable for the data to be put into.
aItemIndex
Which of multiple drag items, zero-based. Must be less than numDropItems.

isDataFlavorSupported()

Checks to see if any of the native data on the clipboard matches a given data flavor. If numDropItems is greater than one, there is no indication as to which of the items matches the data flavor.

boolean isDataFlavorSupported(
  in string aDataFlavor
);
Parameters
aDataFlavor
A string representing the MIME type of the data to be matched, such as "text/unicode".
Return value

true if the specified flavor matches any of the native data on the clipboard, otherwise false.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:98 次

字数:5260

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文