[][src]Struct pushrod::widgets::push_button_widget::PushButtonWidget

pub struct PushButtonWidget { /* fields omitted */ }

This is the storage object for the PushButtonWidget. It stores the config, properties, callback registry.

Implementations

impl PushButtonWidget[src]

This is the PushButtonWidget implementation, which displays a block of text inside a clickable box. Clicking the box will cause an on_click callback to be triggered, which will call a block of text, if the callback has been configured.

pub fn new(x: i32, y: i32, w: u32, h: u32, text: String, font_size: i32) -> Self[src]

Creates a new PushButtonWidget, given x, y, w, h coordinates, some text to display, and the font_size to use.

pub fn on_click<F>(&mut self, callback: F) where
    F: FnMut(&mut PushButtonWidget, &[WidgetContainer]) + 'static, 
[src]

Assigns the callback closure that will be used when a button click is triggered.

Trait Implementations

impl Widget for PushButtonWidget[src]

This is the Widget implementation of the PushButtonWidget.

fn mouse_entered(&mut self, _widgets: &[WidgetContainer])[src]

When a mouse enters the bounds of the Widget, this function is triggered. This function implementation is optional.

fn mouse_exited(&mut self, _widgets: &[WidgetContainer])[src]

When a mouse exits the bounds of the Widget, this function is triggered. This function implementation is optional.

fn button_clicked(
    &mut self,
    _widgets: &[WidgetContainer],
    _button: u8,
    _clicks: u8,
    _state: bool
)
[src]

When a mouse button is clicked within (or outside of) the bounds of the Widget, this function is called. If a mouse button is clicked, and the mouse leaves the bounds of the Widget, the mouse release event will still be triggered for the last Widget which received the mouse down state. This prevents Widgets from becoming confused. This behavior is tracked by the main loop, not by the Widget code. Therefore, when a mouse button is released outside of the bounds of this Widget, you must adjust your state accordingly, if you pay attention to the button_clicked function. This function implementation is optional.

fn get_config(&mut self) -> &mut WidgetConfig[src]

This function is a macro-created getter function that returns the Widget's configuration object as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

fn get_system_properties(&mut self) -> &mut HashMap<i32, String>[src]

This function is a macro-created getter function that returns the Widget's system properties as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

fn get_callbacks(&mut self) -> &mut CallbackRegistry[src]

This function is a macro-created getter function that returns the Widget's CallbackRegistry object as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

fn tick_callback(&mut self, _widgets: &[WidgetContainer])[src]

This function is a macro-created tick callback override, created by the default_widget_callbacks!() macro.

fn mouse_entered_callback(&mut self, _widgets: &[WidgetContainer])[src]

This function is a macro-created mouse entered callback override, created by the default_widget_callbacks!() macro.

fn mouse_exited_callback(&mut self, _widgets: &[WidgetContainer])[src]

This function is a macro-created mouse exited callback override, created by the default_widget_callbacks!() macro.

fn mouse_moved_callback(
    &mut self,
    _widgets: &[WidgetContainer],
    _points: Points
)
[src]

This function is a macro-created mouse moved callback override, created by the default_widget_callbacks!() macro.

fn mouse_scrolled_callback(
    &mut self,
    _widgets: &[WidgetContainer],
    _points: Points
)
[src]

This function is a macro-created mouse scrolled callback override, created by the default_widget_callbacks!() macro.

fn button_clicked_callback(
    &mut self,
    _widgets: &[WidgetContainer],
    _button: u8,
    _clicks: u8,
    _state: bool
)
[src]

This function is a macro-created mouse scrolled callback override, created by the default_widget_callbacks!() macro.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.