Trait pushrod::core::callbacks::PushrodCallbackEvents

source ·
pub trait PushrodCallbackEvents {
Show 16 methods // Provided methods fn handle_event( &mut self, event: CallbackEvent, widget_store: &mut WidgetStore, ) { ... } fn mouse_entered( &mut self, _widget_id: i32, _widget_store: &mut WidgetStore, ) { ... } fn mouse_exited(&mut self, _widget_id: i32, _widget_store: &mut WidgetStore) { ... } fn mouse_scrolled( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, ) { ... } fn mouse_moved( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, ) { ... } fn key_pressed( &mut self, _widget_id: i32, _key: Key, _state: ButtonState, _widget_store: &mut WidgetStore, ) { ... } fn window_resized(&mut self, _size: Size, _widget_store: &mut WidgetStore) { ... } fn window_focused(&mut self, _flag: bool, _widget_store: &mut WidgetStore) { ... } fn mouse_button_down( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, ) { ... } fn mouse_button_up_inside( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, ) { ... } fn mouse_button_up_outside( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, ) { ... } fn widget_clicked( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, ) { ... } fn widget_selected( &mut self, _widget_id: i32, _button: Button, _selected: bool, _widget_store: &mut WidgetStore, ) { ... } fn widget_moved( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, ) { ... } fn widget_resized( &mut self, _widget_id: i32, _size: Size, _widget_store: &mut WidgetStore, ) { ... } fn timer_triggered( &mut self, _widget_id: i32, _widget_store: &mut WidgetStore, ) { ... }
}
Expand description

This is the callback event class that is used to handle events that are produced when a widget is interacted with in the Pushrod Run Loop. This callback is triggered when an event happens either in the main GUI, or within a GUI object.

Provided Methods§

source

fn handle_event(&mut self, event: CallbackEvent, widget_store: &mut WidgetStore)

This is the main event handling function, and can be overridden if necessary. This function is called when an event is handled by the main run loop. As an event happens in real time, this function is called and the translated event is sent here. If this function is not overridden, it will call the helper methods below, which can be overridden by the main application as it sees fit for each event type. It is not necessary to implement each callback - only the ones you wish to implement.

source

fn mouse_entered(&mut self, _widget_id: i32, _widget_store: &mut WidgetStore)

Called when a mouse enters a Widget.

source

fn mouse_exited(&mut self, _widget_id: i32, _widget_store: &mut WidgetStore)

Called when a mouse exits a Widget.

source

fn mouse_scrolled( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, )

Called when a mouse scroll wheel is used inside a Widget.

source

fn mouse_moved( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, )

Called when a mouse moves inside a Widget.

source

fn key_pressed( &mut self, _widget_id: i32, _key: Key, _state: ButtonState, _widget_store: &mut WidgetStore, )

Called when a keyboard keypress is detected. The state of the key press is passed as well.

source

fn window_resized(&mut self, _size: Size, _widget_store: &mut WidgetStore)

Called when the main window is resized.

source

fn window_focused(&mut self, _flag: bool, _widget_store: &mut WidgetStore)

Called when the window gains or loses focus.

source

fn mouse_button_down( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, )

Called when a mouse button is pressed.

source

fn mouse_button_up_inside( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, )

Called when a mouse button is released within the same Widget which it was pressed.

source

fn mouse_button_up_outside( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, )

Called when a mouse button is released outside of the scope of the Widget from which it was pressed.

source

fn widget_clicked( &mut self, _widget_id: i32, _button: Button, _widget_store: &mut WidgetStore, )

Called when a full click is detected inside a Widget. A “click event” consists of a mouse button down and release within the confines of the same Widget.

source

fn widget_selected( &mut self, _widget_id: i32, _button: Button, _selected: bool, _widget_store: &mut WidgetStore, )

Called when a Widget is selected. This is a generated event by a Widget, and is not part of the main run loop. This Widget is generated by event injection.

source

fn widget_moved( &mut self, _widget_id: i32, _point: Point, _widget_store: &mut WidgetStore, )

Called when a Widget is moved. Contains the ID of the Widget, along with its new position as a Point.

source

fn widget_resized( &mut self, _widget_id: i32, _size: Size, _widget_store: &mut WidgetStore, )

Called when a Widget is resized. Contains the ID of the Widget, along with its new Size.

source

fn timer_triggered(&mut self, _widget_id: i32, _widget_store: &mut WidgetStore)

Called when a timer expires for a widget. The ID of the widget is the timer widget that generated the expiration timeout.

Implementors§