xtd 0.2.0
Loading...
Searching...
No Matches
animation.h
Go to the documentation of this file.
1
4#pragma once
6#include "control.h"
7#include "timer.h"
8#include <xtd/diagnostics/stopwatch>
9
11namespace xtd {
13 namespace forms {
26 struct data;
27
28 public:
30
35
37 animation(animation&& rhs);
38 animation(const animation&) = default;
39 animation& operator =(const animation&) = default;
41
43
47 virtual time_span elapsed() const noexcept;
48
51 virtual int64 elapsed_milliseconds() const noexcept;
52
55 virtual int64 elapsed_nanoseconds() const noexcept;
56
59 virtual int64 elapsed_ticks() const noexcept;
60
63 virtual uint32 frame_counter() const noexcept;
64
67 virtual uint32 frames_per_second() const noexcept;
71
74 virtual bool running() const noexcept;
75
78 virtual animation& running(bool value);
80
82
85 void start();
86
88 void stop();
90
92
96 static animation create();
100 static animation create(const drawing::point& location);
105 static animation create(const drawing::point& location, const drawing::size& size);
111 static animation create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
120 static animation create(uint32 frames_per_second, const drawing::point& location);
126 static animation create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size);
133 static animation create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
142 static animation create(const control& parent, const drawing::point& location);
148 static animation create(const control& parent, const drawing::point& location, const drawing::size& size);
155 static animation create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
166 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location);
173 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size);
181 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
183
185
192
193 protected:
195
197 drawing::size default_size() const noexcept override;
199
201
207 std::unique_ptr<xtd::object> clone() const override;
208
213
214 private:
215 void on_frames_timer_tick(object& timer, const xtd::event_args& e);
216
217 std::shared_ptr<data> data_;
218 };
219 }
220}
Contains xtd::forms::key_event_handler event handler.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Provides data for the animation update event.
Definition animation_update_event_args.h:20
Represents an animation control.
Definition animation.h:25
virtual time_span elapsed() const noexcept
Gets the elapsed time for the current frame, in nanoseconds.
static animation create()
A factory to create an xtd::forms::animation.
virtual int64 elapsed_milliseconds() const noexcept
Gets the elapsed time for the current frame, in milliseconds.
virtual int64 elapsed_nanoseconds() const noexcept
Gets the elapsed time for the current frame, in nanoseconds.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual int64 elapsed_ticks() const noexcept
Gets the elapsed time for the current frame, in ticks.
void start()
Starts animation of the animation control.
void stop()
Stops animation of the animation control.
animation()
Initialize a new instance of xtd::forms::animation class.
xtd::event< animation, animation_updated_event_handler > updated
Occurs when the specified interval specified by xtd::forms::animation::frames_per_second has elapsed ...
Definition animation.h:190
virtual uint32 frames_per_second() const noexcept
Gets the number of frame per second.
drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual bool running() const noexcept
Gets a valiue that indicates if the animation is running.
virtual uint32 frame_counter() const noexcept
Gets the current frame counter value.
virtual void on_updated(const xtd::forms::animation_updated_event_args &e)
Raises the updated event.
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::ustring & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition timer.h:36
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
xtd::delegate< void(xtd::object &, const xtd::forms::animation_updated_event_args &)> animation_updated_event_handler
Represents the method that will handle the update of xtd::forms::animation.
Definition animation_update_event_handler.h:22
int_least64_t int64
Represents a 64-bit signed integer.
Definition types.h:142
size_t size
Represents a size of any object in bytes.
Definition types.h:197
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Represents a time interval.
Definition time_span.h:26
Contains xtd::forms::style_sheets::control class.
Contains xtd::forms::timer component.