pub enum DataSourceEvent {
    Send {
        mime_type: String,
        pipe: WritePipe,
    },
    Target {
        mime_type: Option<String>,
    },
    Action {
        action: DndAction,
    },
    Cancelled,
    Dropped,
    Finished,
}
Expand description

Possible events a data source needs to react to

Variants

Send

Fields

mime_type: String

Requested mime type

pipe: WritePipe

Pipe to write into

Write the offered data for selected mime type

This can happen several times during a dnd setup, and does not mean the action is finished.

Target

Fields

mime_type: Option<String>

The type accepted by the target

Target mime type

Notifies that the target accepted a given mime type. You can use it to provide feedback (changing the icon of the drag’n’drop for example).

Can be None if the current target does not accept any of the proposed mime types.

This event can be emitted several times during the process

Action

Fields

action: DndAction

The action chosen by the target

Notifies of the current selected action for the drag’n’drop

Can only happen for data sources used during a drag’n’drop.

This can change several times, the last received defines which action should actually be taken.

Cancelled

The action using this data source was cancelled.

Once this event is received, the DataSource can not be used any more, and you should drop it for cleanup.

Happens if the user cancels the current drag’n’drop, or replaces the selection buffer.

Dropped

The user performed the “drop” during a drag’n’drop

This does not mean the operation is finished (the operation can still be cancelled afterwards).

You are not guaranteed to receive this event at some point, as the compositor may cancel the action before the user drops.

This event can only be generated on sources used for drag’n’drop, not selection sources.

Finished

The action is finished, this data source will not be used any more

If the selected drag’n’drop action was “move”, you can now delete the underlying resource.

This event can only be generated on sources used for drag’n’drop, not selection sources.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.