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

pub struct TimerWidget { /* fields omitted */ }

Creates a timer that can be used to generate callbacks based on a timeout. When a timeout has been reached, a TimerTriggered event is generated. Set the timer timeout in milliseconds by setting CONFIG_TIMER_TIMEOUT values.

Timer timeouts are triggered on a per-refresh basis, so if the FPS of the screen for the main window is set to 30 FPS, the timer will only receive a tick every 1/30th of a second. If you need higher resolution timers, consider using threads.

Methods

impl TimerWidget[src]

pub fn new() -> Self[src]

Constructor.

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

Assigns the callback closure that will be used when a timer tick is triggered.

Trait Implementations

impl Drawable for TimerWidget[src]

fn draw(&mut self, _c: Context, _g: &mut GlGraphics, _clip: &DrawState)[src]

Draws the Widget's contents. Only gets called if the Widget is in invalidated state. Provides a modified Context object that has an origin of 0x0 in drawing space for the draw routine. Also provides a mut G2d object against which to draw, and a clip, which is automatically set to provide a clipping area for the Widget. If the Widget draws outside of the clipped bounds, that will not be drawn on the screen. Read more

fn draw_with_offset(
    &mut self,
    c: Context,
    g: &mut GlGraphics,
    clip: &DrawState,
    point_offset: Point
)
[src]

Draws an object at an offset on the screen. This is a convenience method that is used by other Widgets that contain multiple widgets. Draw with offset always uses 0x0 as the starting drawing coordinates, as this is what will be drawn within the bounds of the Widget. (See CheckboxWidget and ImageButtonWidget for good examples of this use.) Read more

impl InjectableSystemEvents for TimerWidget[src]

fn inject_system_event(&mut self) -> Option<CallbackEvent>[src]

Part of the main loop that queries the Widget for any system-level events that should be injected into the PushrodCallbackEvents trait, and not handled by the top-level run loop. This sends out messages that are bypassed from being used by the Run Loop, so be very careful. Use this for sending things like custom messages (such as a Widget move or Widget resize message, which is irrelevant to the run loop.) Read more

impl InjectableCustomEvents for TimerWidget[src]

impl Widget for TimerWidget[src]

fn invalidate(&mut self)[src]

Indicates that a Widget object needs to be repainted.

fn clear_invalidate(&mut self)[src]

Clears the invalidation flag. Set this when the draw function completes. Otherwise, this Widget object may be continuously repainted. Read more

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

Master config setter - use convenience methods.

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

Master config getter - use convenience methods.

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

Sets a point value for a configuration key.

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

Sets a size value for a configuration key.

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

Sets a color for a configuration key.

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

Sets a numeric value for a configuration key.

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

Sets a text value for a configuration key.

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

Sets a toggle value for a configuration key.

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

Indicates to the run loop whether or not a Widget injects system-level events.

Auto Trait Implementations

Blanket Implementations

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.

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

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

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

impl<T> SetParameter for T

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

Sets value as a parameter of self.