Skip to main content

ClickController

Struct ClickController 

Source
pub struct ClickController { /* private fields */ }
Expand description

Reports clicks: press, track in and out of the Widget, release.

The press is “captured” by the engine, so the release arrives even when the pointer is outside. Reports ControllerEvent::ClickPressed, ControllerEvent::ClickArmed as the pointer leaves and re-enters, then ControllerEvent::Clicked if released while armed, otherwise ControllerEvent::ClickCancelled. Only events addressed to the owning Widget count, so a press that bubbles up from a child is not a click on the parent.

Implementations§

Source§

impl ClickController

Source

pub fn new() -> Self

Creates a controller for the left mouse button.

§Returns

The controller.

Source

pub fn for_button(button: MouseButton) -> Self

Creates a controller for a given mouse button.

§Arguments
  • button - The button to watch.
§Returns

The controller.

Trait Implementations§

Source§

impl Controller for ClickController

Source§

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

Examines one event and reports any result.

§Arguments
  • widget - The ID of the owning Widget.
  • event - The event the Widget received.
  • out - Where results are pushed.
Source§

fn event_mask(&self) -> EventMask

Returns the event classes this controller needs.

§Returns

The mask added to the Widget’s event mask.

Source§

impl Default for ClickController

Source§

fn default() -> Self

Creates the controller with its defaults.

§Returns

The controller.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.