1 #ifndef TERMOX_WIDGET_WIDGETS_NOTIFY_LIGHT_HPP
2 #define TERMOX_WIDGET_WIDGETS_NOTIFY_LIGHT_HPP
6 #include <termox/painter/color.hpp>
7 #include <termox/painter/glyph.hpp>
8 #include <termox/widget/widget.hpp>
20 using Duration_t = std::chrono::milliseconds;
22 enum class Fade : bool { On, Off };
25 Display display = {Color::Foreground, Color::Background};
26 Duration_t duration = default_duration;
30 static auto constexpr default_duration = Duration_t{450};
33 explicit Notify_light(Display display = Display{Color::Foreground,
35 Duration_t duration = default_duration,
36 Fade fade = Fade::On);
38 explicit Notify_light(Parameters p);
60 [[nodiscard]] auto
get_fade() const -> Fade;
73 static auto constexpr initial_block = U'█';
74 static auto constexpr block_count = 4;
78 [[nodiscard]] auto notify_light(
79 Notify_light::Display display = Notify_light::Display{Color::Foreground,
81 Notify_light::Duration_t duration = Notify_light::default_duration,
82 Notify_light::Fade fade = Notify_light::Fade::On)
83 -> std::unique_ptr<Notify_light>;
86 [[nodiscard]]
auto notify_light(Notify_light::Parameters p)
87 -> std::unique_ptr<Notify_light>;
Color numbers [0 - 180] are valid.
Definition: color.hpp:16
A 'light' that can be emitted for a given duration to visually notify.
Definition: notify_light.hpp:13
auto get_fade() const -> Fade
Return the currently set Fade type.
Definition: notify_light.cpp:50
auto get_display() const -> Display
Return the on and off Colors currently used.
Definition: notify_light.cpp:42
auto timer_event() -> bool override
Handles Timer_event objects.
Definition: notify_light.cpp:52
void set_fade(Fade f)
Set the light to Fade or not.
Definition: notify_light.cpp:48
void emit()
Start emitting the on color for the set duration.
Definition: notify_light.cpp:26
auto get_duration() const -> Duration_t
Return the currently set duration.
Definition: notify_light.cpp:46
void set_display(Display d)
Set the on and off Colors of the light.
Definition: notify_light.cpp:33
void set_duration(Duration_t d)
Set the duration from the time emit is called to when the light is off.
Definition: notify_light.cpp:44
Definition: notify_light.hpp:15
Definition: notify_light.hpp:24