Skip to main content

EventContext

Trait EventContext 

Source
pub trait EventContext<Message> {
    // Required methods
    fn invalidate_render(&mut self);
    fn invalidate_layout(&mut self);
    fn emit_message(&mut self, message: Message);
    fn clipboard(&self) -> &dyn Clipboard;
    fn clipboard_mut(&mut self) -> &mut dyn Clipboard;
    fn cursor_position(&self) -> Position;
    fn set_cursor_position(&mut self, value: Position);
    fn keyboard_focus(&self) -> bool;
    fn set_keyboard_focus(&mut self, value: bool);
    fn mouse_focus(&self) -> bool;
    fn set_mouse_focus(&mut self, value: bool);
}

Required Methods§

Source

fn invalidate_render(&mut self)

Forces the widget to be rerendered.

Source

fn invalidate_layout(&mut self)

Forces the widget’s layout to be recalculated and so the widget to be rerendered.

Source

fn emit_message(&mut self, message: Message)

Emits the message for application to handle.

Source

fn clipboard(&self) -> &dyn Clipboard

Returns reference to the clipboard.

Source

fn clipboard_mut(&mut self) -> &mut dyn Clipboard

Returns mutable reference to the clipboard.

Source

fn cursor_position(&self) -> Position

Gets position of the cursor in global cooridnates.

Source

fn set_cursor_position(&mut self, value: Position)

Sets position of the cursor in global coordinates.

There is only one cursor per terminal, but any widget in the tree can move it, so be careful.

Source

fn keyboard_focus(&self) -> bool

Returns keyboard focus state of this widget.

When a widget has keyboard focus all key event routed to it.

Source

fn set_keyboard_focus(&mut self, value: bool)

Sets the keyboard focus.

Source

fn mouse_focus(&self) -> bool

Gets value indicating whether this widget captures mouse or not.

When widget has mouse focus all mouse events roted to it.

Source

fn set_mouse_focus(&mut self, value: bool)

Sets the mouse focus.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, Message, E> EventContext<Message> for WrappedEventContext<'a, Message, E>
where E: EventContext<Message> + ?Sized,