1 #ifndef TERMOX_WIDGET_WIDGETS_SLIDER_HPP
2 #define TERMOX_WIDGET_WIDGETS_SLIDER_HPP
5 #include <signals_light/signal.hpp>
7 #include <termox/painter/painter.hpp>
8 #include <termox/system/key.hpp>
9 #include <termox/system/mouse.hpp>
10 #include <termox/widget/area.hpp>
11 #include <termox/widget/layouts/horizontal.hpp>
12 #include <termox/widget/layouts/vertical.hpp>
13 #include <termox/widget/point.hpp>
14 #include <termox/widget/widget.hpp>
20 template <
template <
typename>
typename Layout_t,
bool Inverted>
59 [[nodiscard]]
auto range() const noexcept ->
Range;
66 auto
value() const noexcept ->
int;
80 void increment(
int amount = 1);
82 void decrement(
int amount = 1);
85 [[nodiscard]] auto value_from_point(Point p) const ->
int;
88 [[nodiscard]] auto extra() const ->
int;
91 static auto constexpr is_vertical = layout::is_vertical_v<Layout_t<
Widget>>;
98 [[nodiscard]] static auto length(
Range range) ->
int;
100 [[nodiscard]] static auto make_point(
int length,
int breadth) -> Point;
102 [[nodiscard]] static auto make_area(
int length_dim,
int breadth_dim)
107 template <template <typename> typename Layout_t,
bool Inverted>
110 -> std::unique_ptr<
Slider<Layout_t, Inverted>>;
113 template <template <typename> typename Layout_t,
bool Inverted>
114 [[nodiscard]] auto slider(
116 -> std::unique_ptr<
Slider<Layout_t, Inverted>>;
Contains functions to paint Glyphs to a Widget's screen area.
Definition: painter.hpp:21
Fixed range sliding display fixed at one end of the Widget.
Definition: slider.hpp:21
auto range() const noexcept -> Range
Return the currently set Range. Emits range_changed Signal.
Definition: slider.cpp:55
auto key_press_event(Key k) -> bool override
Handles Key_press_event objects.
Definition: slider.cpp:119
Slider(Range range, int initial)
Create new Slider.
Definition: slider.cpp:26
sl::Signal< void(int)> value_changed
Emitted on user input and passes along the new current value set.
Definition: slider.hpp:39
auto paint_event(Painter &p) -> bool override
Handles Paint_event objects.
Definition: slider.cpp:189
auto value() const noexcept -> int
Return the currently set value.
Definition: slider.cpp:71
void set_range(Range x)
Set a new Range for this Slider.
Definition: slider.cpp:43
auto mouse_wheel_event(Mouse const &m) -> bool override
Handles Mouse_wheel_event objects.
Definition: slider.cpp:93
sl::Signal< void(Range)> range_changed
Emitted when the [low, high] range is modified.
Definition: slider.hpp:36
auto mouse_move_event(Mouse const &m) -> bool override
Handles Mouse_move_event objects.
Definition: slider.cpp:85
auto mouse_press_event(Mouse const &m) -> bool override
Handles Mouse_press_event objects.
Definition: slider.cpp:77
void set_value(int x)
Set the current value of the Slider. Emits value_changed Signal.
Definition: slider.cpp:61
Definition: slider.hpp:29
[low, high] inclusive range of values.
Definition: slider.hpp:24