Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
hooks.hpp
Go to the documentation of this file.
1// ui::hooks — what Cadran asks of the app above it (the main screen, the
2// tabs, its identity, saving the preferences) without knowing it: the app
3// fills this in once at start-up, before any screen opens. Each hook left
4// empty does nothing (or answers nothing).
5// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
6#pragma once
7
8#include <functional>
9#include <string>
10#include <utility>
11#include <vector>
12#include <aurore.hpp>
13
15
16namespace ui::hooks
17{
18
21struct Hooks
22{
24 std::function<bool(aurore::Activity* activity)> is_main;
25 std::function<void(aurore::Activity* main, int position, const std::string& row)> open_tab;
26 std::function<void(aurore::Activity* main)> update_title;
28 std::function<void(int position, const std::string& row)> push_main;
29
32 std::function<void()> refresh_shown;
33 std::function<std::string()> shown_screen;
34 std::function<std::string()> main_screen;
35 std::function<bool(aurore::View* view)> is_tab;
36
39 std::function<int(const std::string& screen)> tab_position;
40 std::function<int()> settings_tab;
43 std::function<std::vector<std::string>()> rail_icons;
44
48 std::function<std::string()> version;
49 std::function<std::string()> commit;
50 std::function<bool()> is_release;
51 std::function<bool()> read_only;
54 std::function<void(NVGcontext* vg, float w, float h)> mark;
58 std::function<bool(cadran::PillMode& mode)> pill;
61 std::function<std::vector<std::pair<const char*, const char*>>()> screen_icons;
64 std::function<std::string(const std::string& screen)> tab_title;
69 std::function<bool(aurore::View* frame)> standalone_screen;
72 std::function<std::string()> today;
73
77 std::function<std::string()> themes_dir;
78
82 std::function<bool()> save_prefs;
84 std::function<void()> send_report;
85
91 std::function<bool(const char* name)> env_flag;
92};
93
96
97} // namespace ui::hooks
Definition activity.hpp:45
Definition view.hpp:232
Definition hooks.hpp:17
Hooks & get()
The one set, filled in at start-up.
Definition cadran_frame.hpp:61
Definition hooks.hpp:22
std::function< std::vector< std::pair< const char *, const char * > >()> screen_icons
Definition hooks.hpp:61
std::function< void(aurore::Activity *main)> update_title
Definition hooks.hpp:26
std::function< bool()> is_release
Definition hooks.hpp:50
std::function< std::string()> shown_screen
Definition hooks.hpp:33
std::function< std::string()> main_screen
Definition hooks.hpp:34
std::function< void(aurore::Activity *main, int position, const std::string &row)> open_tab
Definition hooks.hpp:25
std::function< void()> send_report
Send a report, offered by a failure's dialog. Unset: not offered.
Definition hooks.hpp:84
std::function< bool(aurore::View *view)> is_tab
Definition hooks.hpp:35
std::function< int()> settings_tab
Definition hooks.hpp:40
std::function< void(NVGcontext *vg, float w, float h)> mark
Definition hooks.hpp:54
std::function< std::string()> commit
Definition hooks.hpp:49
std::function< void(int position, const std::string &row)> push_main
A new main screen, pushed, on tab position, the focus on row.
Definition hooks.hpp:28
std::function< bool(const char *name)> env_flag
Definition hooks.hpp:91
std::function< bool()> save_prefs
Definition hooks.hpp:82
std::function< std::string()> version
Definition hooks.hpp:48
std::function< std::string()> today
Definition hooks.hpp:72
std::function< std::vector< std::string >()> rail_icons
Definition hooks.hpp:43
std::function< bool(aurore::View *frame)> standalone_screen
Definition hooks.hpp:69
std::function< bool(cadran::PillMode &mode)> pill
Definition hooks.hpp:58
std::function< bool()> read_only
Definition hooks.hpp:51
std::function< int(const std::string &screen)> tab_position
Definition hooks.hpp:39
std::function< std::string(const std::string &screen)> tab_title
Definition hooks.hpp:64
std::function< std::string()> themes_dir
Definition hooks.hpp:77
std::function< bool(aurore::Activity *activity)> is_main
The main screen.
Definition hooks.hpp:24
std::function< void()> refresh_shown
Definition hooks.hpp:32