[][src]Struct pushrod::widget::timer_widget::TimerWidget

pub struct TimerWidget { /* fields omitted */ }

This is the TimerWidget. It contains no base widget, it only contains a start and end time,

Example usage: IN PROGRESS

Methods

impl TimerWidget[src]

Implementation of the constructor for the TimerWidget. Timer widgets are not accessible on the screen, so they have an origin of 0x0 and width of 0x0.

The timer provides a simple way to call a callback function after a certain amount of time has passed. Upon instantiation, the timer is enabled.

Here are a few limitations of the timer as it currently stands:

  • Timer cannot be paused; it is enabled or disabled, and the timer resets when enabled.
  • Timer is called when the screen refreshes, so slower FPS settings will affect the timer.

pub fn new() -> Self[src]

Constructor, creates a new TimerWidget struct with an empty timeout function.

Trait Implementations

impl Widget for TimerWidget[src]

Implementation of the TimerWidget object with the Widget traits implemented.

fn is_invalidated(&mut self) -> bool[src]

Timer is always invalidated, this way, the tick function is always called on each screen refresh.

fn injects_events(&mut self) -> bool[src]

This function injects events, as a timeout event only occurs once.

fn inject_event(&mut self, widget_id: i32) -> Option<CallbackEvent>[src]

Returns an injected event where appropriate.

fn draw(&mut self, _context: Context, _graphics: &mut G2d, _clip: &DrawState)[src]

Does not draw anything - only calls the timer tick() function to increment the timer.

fn invalidate(&mut self)[src]

Indicates that a widget needs to be redrawn/refreshed.

fn clear_invalidate(&mut self)[src]

Clears the invalidation flag.

fn set_config(&mut self, config: u8, config_value: Config)[src]

fn get_config(&mut self, config: u8) -> Option<&Config>[src]

fn set_point(&mut self, config: u8, x: i32, y: i32)[src]

fn set_size(&mut self, config: u8, w: i32, h: i32)[src]

fn set_color(&mut self, config: u8, color: Color)[src]

fn set_numeric(&mut self, config: u8, value: u64)[src]

fn set_text(&mut self, config: u8, text: String)[src]

fn set_toggle(&mut self, config: u8, flag: bool)[src]

fn handle_event(&mut self, _event: CallbackEvent) -> Option<CallbackEvent>[src]

Handles an event that was sent by the event loop. It is up to the Widget to handle the event, or to ignore it. If this function is not overridden, the event will be ignored, and no event will be returned as a result. This function returns an Option<CallbackEvent>, which can be injected into the run loop. This can be things for Widget interaction that may generate an event that the application needs to respond to, like a button click, or a drag start/end event. Read more

Auto Trait Implementations

impl Send for TimerWidget

impl Sync for TimerWidget

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

impl<T> SetParameter for T

default fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> Erased for T