[][src]Struct stdweb::web::event::DataTransfer

pub struct DataTransfer(_);

The DataTransfer object is used to hold the data that is being dragged during a drag and drop operation.

It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API.

(JavaScript docs)

Methods

impl DataTransfer[src]

pub fn drop_effect(&self) -> DropEffect[src]

Gets the type of drag-and-drop operation currently selected type. The value must be none, copy, link or move.

(JavaScript docs)

pub fn set_drop_effect(&self, value: DropEffect)[src]

Sets the type of drag-and-drop operation currently selected. The value must be none, copy, link or move.

(Javascript docs)

pub fn effect_allowed(&self) -> EffectAllowed[src]

Provides all of the types of operations that are possible. Must be one of none, copy, copyLink, copyMove, link, linkMove, move, all or uninitialized.

(JavaScript docs)

pub fn set_effect_allowed(&self, value: EffectAllowed)[src]

Sets the effect that is allowed for a drag operation. Must be one of none, copy, copyLink, copyMove, link, linkMove, move, all or uninitialized.

(Javascript docs)

pub fn items(&self) -> DataTransferItemList[src]

Gives a DataTransferItemList object which is a list of all of the drag data.

(Javascript docs)

pub fn files(&self) -> FileList[src]

Contains a list of all the local files available on the data transfer. If the drag operation doesn't involve dragging files, this property is an empty list.

(Javascript docs)

pub fn types(&self) -> Vec<String>[src]

An array of strings giving the formats that were set in the dragstart event.

(Javascript docs)

pub fn clear_data(&self, format: Option<&str>)[src]

Remove the data associated with a given type. The type argument is optional. If the type is empty or not specified, the data associated with all types is removed. If data for the specified type does not exist, or the data transfer contains no data, this method will have no effect.

(Javascript docs)

pub fn get_data(&self, format: &str) -> String[src]

Retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer contains no data.

(Javascript docs)

pub fn set_data(&self, format: &str, data: &str)[src]

Set the data for a given type. If data for the type does not exist, it is added at the end, such that the last item in the types list will be the new format. If data for the type already exists, the existing data is replaced in the same position.

(Javascript docs)

pub fn set_drag_image(&self, img: &ImageElement, x_offset: i32, y_offset: i32)[src]

Set the image to be used for dragging if a custom one is desired.

(Javascript docs)

Trait Implementations

impl JsSerialize for DataTransfer[src]

impl TryFrom<DataTransfer> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for DataTransfer[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Reference> for DataTransfer[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for DataTransfer[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Value> for DataTransfer[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for DataTransfer[src]

impl ReferenceType for DataTransfer[src]

impl AsRef<Reference> for DataTransfer[src]

impl From<DataTransfer> for Reference[src]

impl Clone for DataTransfer[src]

impl Eq for DataTransfer[src]

impl PartialEq<DataTransfer> for DataTransfer[src]

impl Debug for DataTransfer[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]