xtd 1.0.0
Loading...
Searching...
No Matches
animation.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "control.hpp"
7#include "timer.hpp"
8#include <xtd/diagnostics/stopwatch>
9
11namespace xtd {
13 namespace forms {
28 struct data;
29
30 public:
32
37
39
43 [[nodiscard]] virtual auto elapsed() const noexcept -> xtd::time_span;
44
47 [[nodiscard]] virtual auto elapsed_milliseconds() const noexcept -> xtd::int64;
48
51 [[nodiscard]] virtual auto elapsed_nanoseconds() const noexcept -> xtd::int64;
52
55 [[nodiscard]] virtual auto elapsed_ticks() const noexcept -> xtd::int64;
56
59 [[nodiscard]] virtual auto frame_counter() const noexcept -> xtd::uint32;
60
63 [[nodiscard]] virtual auto frames_per_second() const noexcept -> xtd::uint32;
66 virtual auto frames_per_second(uint32 value) -> animation&;
67
70 [[nodiscard]] virtual auto running() const noexcept -> bool;
73 virtual auto running(bool value) -> animation&;
75
77
80 auto start() -> void;
81
83 auto stop() -> void;
85
87
91 [[nodiscard]] static auto create() -> animation;
95 [[nodiscard]] static auto create(const drawing::point& location) -> animation;
100 [[nodiscard]] static auto create(const drawing::point& location, const drawing::size& size) -> animation;
106 [[nodiscard]] static auto create(const drawing::point& location, const drawing::size& size, const xtd::string& name) -> animation;
110 [[nodiscard]] static auto create(uint32 frames_per_second) -> animation;
115 [[nodiscard]] static auto create(uint32 frames_per_second, const drawing::point& location) -> animation;
121 [[nodiscard]] static auto create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size) -> animation;
128 [[nodiscard]] static auto create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::string& name) -> animation;
132 [[nodiscard]] static auto create(const control& parent) -> animation;
137 [[nodiscard]] static auto create(const control& parent, const drawing::point& location) -> animation;
143 [[nodiscard]] static auto create(const control& parent, const drawing::point& location, const drawing::size& size) -> animation;
150 [[nodiscard]] static auto create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name) -> animation;
155 [[nodiscard]] static auto create(const control& parent, uint32 frames_per_second) -> animation;
161 [[nodiscard]] static auto create(const control& parent, uint32 frames_per_second, const drawing::point& location) -> animation;
168 [[nodiscard]] static auto create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size) -> animation;
176 [[nodiscard]] static auto create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::string& name) -> animation;
178
180
187
188 protected:
190
192 [[nodiscard]] auto default_size() const noexcept -> xtd::drawing::size override;
194
196
200 virtual auto on_updated(const xtd::forms::animation_updated_event_args& e) -> void;
202
203 xtd::sptr<data> data_;
204 };
205 }
206}
Contains xtd::forms::animation_updated_event_handler event handler.
Represents an event.
Definition event.hpp:23
Provides data for the animation update event.
Definition animation_update_event_args.hpp:22
virtual auto frames_per_second() const noexcept -> xtd::uint32
Gets the number of frame per second.
virtual auto on_updated(const xtd::forms::animation_updated_event_args &e) -> void
Raises the updated event.
auto start() -> void
Starts animation of the animation control.
virtual auto frame_counter() const noexcept -> xtd::uint32
Gets the current frame counter value.
virtual auto elapsed_nanoseconds() const noexcept -> xtd::int64
Gets the elapsed time for the current frame, in nanoseconds.
virtual auto running() const noexcept -> bool
Gets a valiue that indicates if the animation is running.
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.hpp:185
static auto create() -> animation
A factory to create an xtd::forms::animation.
virtual auto elapsed_ticks() const noexcept -> xtd::int64
Gets the elapsed time for the current frame, in ticks.
auto stop() -> void
Stops animation of the animation control.
virtual auto elapsed_milliseconds() const noexcept -> xtd::int64
Gets the elapsed time for the current frame, in milliseconds.
auto default_size() const noexcept -> xtd::drawing::size override
Gets the default size of the control.
virtual auto elapsed() const noexcept -> xtd::time_span
Gets the elapsed time for the current frame, in nanoseconds.
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Represents a time interval.
Definition time_span.hpp:29
Contains xtd::forms::control control.
xtd::delegate< void(xtd::object &sender, const xtd::forms::animation_updated_event_args &e)> animation_updated_event_handler
Represents the method that will handle the update of xtd::forms::animation.
Definition animation_update_event_handler.hpp:27
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
@ e
The E key.
Definition keys.hpp:207
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::forms::timer component.