nsIDragSession 编辑
widget/public/nsIDragSession.idl
Scriptable 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
Attribute | Type | Description |
canDrop | boolean | Set 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. |
dataTransfer |
| The data transfer object for the current drag operation. |
dragAction | unsigned long | Sets the action (copy, move, link and so on) for the current drag. (See nsIDragService) |
numDropItems | unsigned long | Get the number of items that were dropped. Read only. |
onlyChromeDrop | boolean | Indicates if the drop event should be dispatched only to chrome. This allows chrome to handle a drag that was refused by content. |
sourceDocument |
| The 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. |
sourceNode |
| The DOM node that was originally dragged to start the session, which will be null if the drag originated outside the application. Read only. |
targetSize | nsSize | Sets 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论