Struct kiss_ui::timer::Timer [] [src]

pub struct Timer(_);

A timer that can invoke a callback on a configurable interval.

Note: Not a Renderable Widget

While this type can be dereferenced and converted to BaseWidget, it is not a renderable widget and adding it to a container will have no visual effect.

Note: Resource Usage

This struct should be freed by calling .destroy() on it when it is no longer in use to free any resources it has allocated. Otherwise, it will be freed when kiss_ui::show_gui() returns.

Methods

impl Timer

fn new() -> Timer

Create a new timer with a default interval.

TODO: Document default interval.

fn set_interval(self, time: u32) -> Self

Set the timer interval in milliseconds.

fn set_on_interval<Cb>(self, on_interval: Cb) -> Self where Cb: Callback<Self>

Set a callback to be invoked when the timer interval elapses. The callback will be invoked on every interval until .stop() is called.

fn start(self) -> Self

Start the timer. The callback will be invoked when the next interval elapses.

fn stop(self) -> Self

Stop the timer. The callback will not be invoked until the timer is restarted.

Trait Implementations

impl Widget for Timer

fn show(self) -> Self

fn hide(self) -> Self

fn set_visible(self, visible: bool) -> Self

fn set_enabled(self, enabled: bool) -> Self

fn set_position(self, x: i32, y: i32) -> Self

fn get_position(self) -> (i32, i32)

fn set_name(self, name: &str) -> Self

fn get_name(&self) -> Option<WidgetStr>

fn get_sibling(self) -> Option<BaseWidget>

fn get_parent(self) -> Option<BaseWidget>

fn get_dialog(self) -> Option<Dialog>

fn get_size_pixels(self) -> (u32, u32)

fn store<N: Into<String>>(self, name: N) -> Option<BaseWidget>

fn to_base(self) -> BaseWidget

impl Copy for Timer

impl Clone for Timer

fn clone(&self) -> Self

fn clone_from(&mut self, source: &Self)

impl Downcast for Timer

fn can_downcast(base: &BaseWidget) -> bool

fn try_downcast(base: BaseWidget) -> Result<Self, BaseWidget>

impl Destroy for Timer

fn destroy(self)