xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <timer.h>
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in Windows Forms applications and must be used in a window.
Inherits xtd::forms::component.
Public Attributes | |
event< timer, event_handler > | tick |
Occurs when the specified timer interval has elapsed and the timer is enabled. More... | |
Public Member Functions | |
timer ()=default | |
Initializes a new instance of the timer class. More... | |
bool | enabled () const |
Gets whether the timer is running. More... | |
void | enabled (bool enabled) |
Sets whether the timer is running. More... | |
std::chrono::milliseconds | interval () const |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. More... | |
template<typename rep_t , typename period_t = std::ratio<1>> | |
void | interval (const std::chrono::duration< rep_t, period_t > &interval) |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. More... | |
int32_t | interval_milliseconds () const |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. More... | |
void | interval_milliseconds (int32_t interval) |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. More... | |
void | start () |
Stops the timer. More... | |
void | stop () |
Starts the timer. More... | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. More... | |
Protected Member Functions | |
void | on_tick (const event_args &e) |
Raises the xtd::forms::timer::tick event. More... | |
Protected Member Functions inherited from xtd::forms::component | |
component ()=default | |
Initialises a new instance of the component class. More... | |
virtual bool | can_raise_events () const |
Gets a value indicating whether the component can raise an event. More... | |
bool | design_mode () const |
Gets a value that indicates whether the component is currently in design mode. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
|
default |
Initializes a new instance of the timer class.
|
inline |
Gets whether the timer is running.
void xtd::forms::timer::enabled | ( | bool | enabled | ) |
Sets whether the timer is running.
enabled | true if the timer is currently enabled; otherwise, false. The default is false. |
|
inline |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
|
inline |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
interval | An int32_t specifying the number of milliseconds before the tick event is raised relative to the last occurrence of the tick event. The value cannot be less than one. |
|
inline |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
void xtd::forms::timer::interval_milliseconds | ( | int32_t | interval | ) |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
interval | An int32_t specifying the number of milliseconds before the tick event is raised relative to the last occurrence of the tick event. The value cannot be less than one. |
|
protected |
Raises the xtd::forms::timer::tick event.
e | An event_args that contains the event data. This is always xtd::event_args::empty. |
|
inline |
Stops the timer.
|
inline |
Starts the timer.