1 #ifndef TERMOX_SYSTEM_SYSTEM_HPP
2 #define TERMOX_SYSTEM_SYSTEM_HPP
7 #include <signals_light/signal.hpp>
9 #include <termox/system/animation_engine.hpp>
10 #include <termox/system/detail/user_input_event_loop.hpp>
11 #include <termox/system/event_fwd.hpp>
12 #include <termox/terminal/key_mode.hpp>
13 #include <termox/terminal/mouse_mode.hpp>
14 #include <termox/terminal/signals.hpp>
15 #include <termox/widget/cursor.hpp>
29 static sl::Slot<void()> quit;
57 System(Mouse_mode mouse_mode = Mouse_mode::Basic,
58 Key_mode key_mode = Key_mode::Normal,
59 Signals signals = Signals::On);
99 template <
typename Widget_t,
typename... Args>
100 auto run(Args&&... args) ->
int
102 auto head = Widget_t(std::forward<Args>(args)...);
115 static auto run() -> int;
140 [[noreturn]]
static void exit();
145 Animation_engine::Duration_t interval);
163 inline static std::atomic<Widget*> head_ =
nullptr;
166 static std::reference_wrapper<Event_queue> current_queue_;
Registers Widgets with intervals to send timer events.
Definition: animation_engine.hpp:15
Holds and provides access to all data relevant to a Widget's cursor.
Definition: cursor.hpp:10
Definition: event_queue.hpp:63
Organizes the highest level of the TUI framework.
Definition: system.hpp:27
static void enable_tab_focus()
Enable Tab/Back_tab keys to change the focus Widget.
Definition: system.cpp:43
static void exit()
Sets the exit flag for the user input event loop.
Definition: system.cpp:114
static void clear_focus()
Removes focus from the currently in focus Widget.
Definition: system.cpp:41
static void set_focus(Widget &w)
Give program focus to w.
Definition: system.cpp:39
static auto focus_widget() -> Widget *
Return a pointer to the currently focused Widget.
Definition: system.cpp:37
auto run(Args &&... args) -> int
Create a Widget_t object, set it as head widget and call System::run().
Definition: system.hpp:100
static void enable_animation(Widget &w, Animation_engine::Duration_t interval)
Enable animation for the given Widget w at interval.
Definition: system.cpp:121
static void post_event(Event e)
Append the event to the Event_queue for the thread it was called on.
Definition: system.cpp:112
System(Mouse_mode mouse_mode=Mouse_mode::Basic, Key_mode key_mode=Key_mode::Normal, Signals signals=Signals::On)
Initializes the terminal screen into curses mode.
Definition: system.cpp:30
static auto send_event(Event e) -> bool
Immediately send the event filters and then to the intended receiver.
Definition: system.cpp:79
static void disable_tab_focus()
Disable Tab/Back_tab keys from changing focus Widget.
Definition: system.cpp:45
static void set_current_queue(Event_queue &queue)
Set the Event_queue that will be used by post_event.
Definition: system.cpp:151
static auto run() -> int
Launch the main Event_loop and start processing Events.
Definition: system.cpp:67
static auto head() -> Widget *
Return a pointer to the head Widget.
Definition: system.cpp:59
static void disable_animation(Widget &w)
Disable animation for the given Widget w.
Definition: system.cpp:135
static void set_cursor(Cursor cursor, Point offset)
Set the terminal cursor via cursor parameters and offset applied.
Definition: system.cpp:140
static void set_head(Widget *new_head)
Set a new head Widget for the entire system.
Definition: system.cpp:47
Frames Per Second.
Definition: fps.hpp:8