Struct conrod::events::global_input::GlobalInput [] [src]

pub struct GlobalInput {
    pub start_state: InputState,
    pub current_state: InputState,
    // some fields omitted
}

Global input event handler that also implements InputProvider. The Ui passes all events to it's GlobalInput instance, which aggregates and interprets the events to provide so-called 'high-level' events to widgets. This input gets reset after every update by the Ui.

Fields

start_state: InputState

The InputState as it was at the end of the last update cycle.

current_state: InputState

The most recent InputState, with updates from handling all the events this update cycle

Methods

impl GlobalInput
[src]

fn new(drag_threshold: Scalar) -> GlobalInput

Returns a fresh new GlobalInput

fn push_event(&mut self, event: UiEvent)

Adds a new event and updates the internal state.

fn reset(&mut self)

Called at the end of every update cycle in order to prepare the GlobalInput to handle events for the next one.

fn mouse_position(&self) -> Point

Returns the most up to date position of the mouse

fn starting_state(&self) -> &InputState

Returns the input state as it was after the last update

fn currently_capturing_mouse(&self) -> Option<Index>

Returns the most up to date info on which widget is capturing the mouse

fn currently_capturing_keyboard(&self) -> Option<Index>

Returns the most up to date info on which widget is capturing the keyboard

Trait Implementations

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

type Events = GlobalInputEventIterator<'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_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_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_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_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_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.