xtd 0.2.0
timer.h
Go to the documentation of this file.
1 #pragma once
5 #include "component.h"
6 #include <xtd/chrono>
7 #include <xtd/event>
8 #include <xtd/event_handler>
9 #include <xtd/time_span>
10 #include <cstdint>
11 #include <memory>
12 
14 namespace xtd {
16  namespace forms {
36  class forms_export_ timer : public component {
37  struct data;
38 
39  public:
41 
46  timer();
48 
50  timer(const timer&) = delete;
51  ~timer();
53 
55 
60  virtual bool enabled() const noexcept;
64  virtual timer& enabled(bool enabled);
65 
69  virtual time_span interval() const noexcept;
73  timer& interval(const time_span& interval);
74 
78  virtual int32 interval_milliseconds() const noexcept;
82  virtual timer& interval_milliseconds(int32 interval);
84 
86 
90  void start();
91 
94  void stop();
96 
98 
105 
106  protected:
108 
112  virtual void on_tick(const event_args& e);
114 
115  private:
116  void restart();
117 
118  std::shared_ptr<data> data_;
119  };
120  }
121 }
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition: timer.h:36
Represents an event.
Definition: event.h:21
event< timer, event_handler > tick
Occurs when the specified timer interval has elapsed and the timer is enabled.
Definition: timer.h:103
Represents a time interval.
Definition: time_span.h:26
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Contains xtd::forms::component class.
The message box contains a symbol consisting of white X in a circle with a red background.
Provides the base implementation and enables object sharing between applications. ...
Definition: component.h:23