Skip to main content

Controller

Trait Controller 

Source
pub trait Controller {
    // Required methods
    fn handle(
        &mut self,
        widget: WidgetId,
        event: &Event,
        out: &mut Vec<ControllerEvent>,
    );
    fn event_mask(&self) -> EventMask;
}
Expand description

An input pattern that turns raw Events into ControllerEvents.

Implement it to add a pattern of your own; the Widget side is unchanged.

Required Methods§

Source

fn handle( &mut self, widget: WidgetId, event: &Event, out: &mut Vec<ControllerEvent>, )

Examines one event.

§Arguments
  • widget - The ID of the Widget that owns the controller.
  • event - The event the Widget received.
  • out - Where to push the results, in order.
Source

fn event_mask(&self) -> EventMask

Returns the event classes the controller needs.

§Returns

The mask WidgetCore::add_controller adds to the Widget’s event mask.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§