[−][src]Struct pushrod_render::render::callbacks::CallbackRegistry
This is a registry that contains a series of FnMut
definitions for actions that can be applied
to a Widget
. These can vary from a screen refresh (tick
), to a mouse move event, etc.
Fields
on_tick: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>)>>
This is the function that is set when a screen refresh cycle occurs. This function is always guaranteed to be called, but there is no guarantee it will call it consistently because of the screen refresh rate. If there is a lot of activity on the screen, this callback will be called less often.
on_mouse_entered: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>)>>
This function is called when a mouse enters the scope of a Widget
.
on_mouse_exited: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>)>>
This function is called when a mouse exits the scope of a Widget
.
on_mouse_moved: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>)>>
This function is called when a mouse moves inside the scope of a Widget
. It contains
the points as a Vec<i32>
containing the X and Y coordinates of the position of the mouse
inside the Widget
.
on_mouse_scrolled: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>)>>
This function is called when a mouse scroll occurs inside the scope of a Widget
. It
contains the points as a Vec<u8>
indicating the amount of movement either horizontally or
vertically.
on_mouse_clicked: Option<Box<dyn FnMut(&mut dyn Widget, &Vec<WidgetContainer>, u8, u8, bool)>>
This function is called when a mouse button is pressed or released. It contains the mouse
button number, the number of clicks registered, and a boolean flag indicating whether or not
the mouse button was pressed (true
) or released (false
).
Implementations
impl CallbackRegistry
[src]
Implementation of the CallbackRegistry
.
pub fn new() -> Self
[src]
Creates a new instance of this object.
pub fn on_tick<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
Assigns an FnMut
that will be called when a screen tick
refresh is performed. If this
is not set, this function will be bypassed.
pub fn on_mouse_entered<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
Assigns an FnMut
that will be called when the mouse enters the scope of a Widget
. If this
is not set, this function will be bypassed.
pub fn on_mouse_exited<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>) + 'static,
Assigns an FnMut
that will be called when the mouse exits the scope of a Widget
. If this
is not set, this function will be bypassed.
pub fn on_mouse_moved<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>) + 'static,
Assigns an FnMut
that will be called when the mouse moves within the scope of a Widget
. If this
is not set, this function will be bypassed.
pub fn on_mouse_scrolled<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, Vec<i32>) + 'static,
Assigns an FnMut
that will be called when the mouse scroll occurs within the scope of a
Widget
. If this is not set, this function will be bypassed.
pub fn on_mouse_clicked<F>(&mut self, callback: F) where
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, u8, u8, bool) + 'static,
[src]
F: FnMut(&mut dyn Widget, &Vec<WidgetContainer>, u8, u8, bool) + 'static,
Assigns an FnMut
that will be called when the mouse click occurs within the scope of a
Widget
. If this is not set, this function will be bypassed.
pub fn has_on_tick(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_tick
callback has been set.
pub fn has_on_mouse_entered(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_mouse_entered
callback has been set.
pub fn has_on_mouse_exited(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_mouse_exited
callback has been set.
pub fn has_on_mouse_moved(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_mouse_moved
callback has been set.
pub fn has_on_mouse_scrolled(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_mouse_scrolled
callback has been set.
pub fn has_on_mouse_clicked(&mut self) -> bool
[src]
Tells the Widget
whether or not an on_mouse_clicked
callback has been set.
Auto Trait Implementations
impl !RefUnwindSafe for CallbackRegistry
impl !Send for CallbackRegistry
impl !Sync for CallbackRegistry
impl Unpin for CallbackRegistry
impl !UnwindSafe for CallbackRegistry
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,