Struct conrod::events::widget_input::WidgetInput [] [src]

pub struct WidgetInput<'a> {
    // some fields omitted
}

Holds any events meant to be given to a Widget. This is what widgets will interface with when handling events in their update method. All events returned from methods on WidgetInput will be relative to the widget's own (0,0) origin. Additionally, WidgetInput will not provide mouse or keyboard events that do not directly pertain to the widget.

Methods

impl<'a> WidgetInput<'a>
[src]

fn for_widget<'g>(widget: Index, widget_area: Rect, global_input: &'g GlobalInput) -> WidgetInput<'g>

Returns a WidgetInput with events specifically for the given widget. Filters out only the events that directly pertain to the widget. All events will also be made relative to the widget's own (0,0) origin.

fn mouse_is_over_widget(&self) -> bool

Returns true if the mouse is currently over the widget, otherwise false

fn maybe_mouse_position(&self) -> Option<Point>

If the mouse is over the widget and no other widget is capturing the mouse, then this will return the position of the mouse relative to the widget. Otherwise, it will return None

Trait Implementations

impl<'a> InputProvider<'a> for WidgetInput<'a>
[src]

type Events = WidgetInputEventIterator<'a>

An iterator yielding references to the InputProvider's UiEvents.

fn all_events(&'a self) -> Self::Events

This is the only method that needs to be implemented. Just provided a reference to a Vec<UiEvent> that contains all the events for this update cycle. Read more

fn current_state(&'a self) -> &'a InputState

Returns the current input state. The returned state is assumed to be up to date with all of the events so far. Read more

fn mouse_click(&'a self, button: MouseButton) -> Option<MouseClick>

Returns a MouseClick if one has occured with the given mouse button. A click is determined to have occured if a mouse button was pressed and subsequently released while the mouse was in roughly the same place. Read more

fn mouse_drag(&'a self, button: MouseButton) -> Option<MouseDrag>

Returns a MouseDrag if one has occured involving the given mouse button. If multiple raw mouse movement events have occured since the last update (which will happen if the user moves the mouse quickly), then the returned MouseDrag will be only the most recent one, which will contain the most recent mouse position. Read more

fn mouse_button_down(&self, button: MouseButton) -> Option<Point>

If the given mouse button is currently pressed, returns the current position of the mouse. Otherwise, returns None Read more

fn text_just_entered(&'a self) -> TextJustEntered<'a, Self::Events>

Returns a reference to each slice of Text that was entered since the last update.

fn keys_just_released(&'a self) -> KeysJustReleased<'a, Self::Events>

Returns all of the Keys that were released since the last update.

fn keys_just_pressed(&'a self) -> KeysJustPressed<'a, Self::Events>

Returns all of the keyboard Keys that were pressed since the last update.

fn mouse_buttons_just_pressed(&'a self) -> MouseButtonsJustPressed<'a, Self::Events>

Returns all of the MouseButtons that were pressed since the last update.

fn mouse_buttons_just_released(&'a self) -> MouseButtonsJustReleased<'a, Self::Events>

Returns all of the MouseButtons that were released since the last update.

fn scroll(&'a self) -> Option<Scroll>

Returns a Scroll struct if any scrolling was done since the last update. If multiple raw scroll events occured since the last update (which could very well happen if the user is scrolling quickly), then the Scroll returned will represent an aggregate total of all the scrolling. Read more

fn mouse_left_drag(&'a self) -> Option<MouseDrag>

Convenience method to call mouse_drag, passing in MouseButton::Left. Saves widgets from having to use input::mouse::MouseButton if all they care about is the left mouse button. Read more

fn mouse_left_click(&'a self) -> Option<MouseClick>

Convenience method to call mouse_click, passing in passing in MouseButton::Left. Saves widgets from having to use input::mouse::MouseButton if all they care about is the left mouse button. Read more

fn mouse_right_click(&'a self) -> Option<MouseClick>

Convenience method to call mouse_click, passing in passing in MouseButton::Right. Saves widgets from having to use input::mouse::MouseButton if all they care about is the left mouse button. Read more

fn mouse_left_button_down(&'a self) -> Option<Point>

Convenience method for checking if the Left mouse button is down. Returns mouse position if the Left mouse button is currently pressed, otherwise None. Read more

fn mouse_right_button_down(&'a self) -> Option<Point>

Convenience method for checking if the Right mouse button is down. Returns mouse position if the Right mouse button is currently pressed, otherwise None. Read more

fn mouse_position(&'a self) -> Point

Convenience method for returning the current mouse position.