Trait cosmic::iced_core::clipboard::Clipboard

source ·
pub trait Clipboard {
    // Required methods
    fn read(&self, kind: Kind) -> Option<String>;
    fn write(&mut self, kind: Kind, contents: String);

    // Provided methods
    fn read_data(
        &self,
        _kind: Kind,
        _mimes: Vec<String>,
    ) -> Option<(Vec<u8>, String)> { ... }
    fn write_data(
        &mut self,
        _kind: Kind,
        _contents: ClipboardStoreData<Box<dyn AsMimeTypes + Sync + Send>>,
    ) { ... }
    fn register_dnd_destination(
        &self,
        _surface: DndSurface,
        _rectangles: Vec<DndDestinationRectangle>,
    ) { ... }
    fn set_action(&self, _action: DndAction) { ... }
    fn start_dnd(
        &mut self,
        _internal: bool,
        _source_surface: Option<DndSource>,
        _icon_surface: Option<Box<dyn Any>>,
        _content: Box<dyn AsMimeTypes + Send>,
        _actions: DndAction,
    ) { ... }
    fn end_dnd(&self) { ... }
    fn peek_dnd(&self, _mime: String) -> Option<(Vec<u8>, String)> { ... }
    fn request_logical_window_size(&self, _width: f32, _height: f32) { ... }
}
Expand description

A buffer for short-term storage and transfer within and between applications.

Required Methods§

source

fn read(&self, kind: Kind) -> Option<String>

Reads the current content of the Clipboard as text.

source

fn write(&mut self, kind: Kind, contents: String)

Writes the given text contents to the Clipboard.

Provided Methods§

source

fn read_data( &self, _kind: Kind, _mimes: Vec<String>, ) -> Option<(Vec<u8>, String)>

Consider using read_data instead Reads the current content of the Clipboard as text.

source

fn write_data( &mut self, _kind: Kind, _contents: ClipboardStoreData<Box<dyn AsMimeTypes + Sync + Send>>, )

Writes the given contents to the Clipboard.

source

fn register_dnd_destination( &self, _surface: DndSurface, _rectangles: Vec<DndDestinationRectangle>, )

Starts a DnD operation.

source

fn set_action(&self, _action: DndAction)

Set the final action for the DnD operation. Only should be done if it is requested.

source

fn start_dnd( &mut self, _internal: bool, _source_surface: Option<DndSource>, _icon_surface: Option<Box<dyn Any>>, _content: Box<dyn AsMimeTypes + Send>, _actions: DndAction, )

Registers Dnd destinations

source

fn end_dnd(&self)

Ends a DnD operation.

source

fn peek_dnd(&self, _mime: String) -> Option<(Vec<u8>, String)>

Consider using peek_dnd instead Peeks the data on the DnD with a specific mime type. Will return an error if there is no ongoing DnD operation.

source

fn request_logical_window_size(&self, _width: f32, _height: f32)

Request window size

Implementors§