Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cadran_modal.hpp
Go to the documentation of this file.
1// cadran — the Cadran look of Aurore's dialogs and pickers: a rounded card
2// on a navy backdrop, the buttons as pills (a confirmation in teal, or coral
3// when it deletes or stops something), the picker floating above the hints
4// with its current row in teal. The toasts and the backdrop are theme values
5// (cadran::install_theme).
6// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
7#pragma once
8
9#include <cstdint>
10#include <functional>
11#include <string>
12#include <vector>
13#include <aurore.hpp>
15
17
18namespace cadran
19{
22constexpr float DIALOG_BUTTONS = 80;
23constexpr float DIALOG_MARGIN = 24;
25constexpr float PICKER_CORNER = 24;
26
27enum class Emphasis
28{
29 NONE,
30 PRIMARY,
31 DANGER,
32 FAILURE,
34};
35
40void add_note(const std::string& key, const char* icon, bool warn = false);
41
46aurore::Box* dialog_body(const std::string& text);
47
49aurore::Label* dialog_title(const std::string& text);
51aurore::Box* dialog_badge(const char* icon, const char* color_key, const char* soft_key);
52
58
62
67
70aurore::Box* wait_body(const std::string& text);
71
78{
79 aurore::Box* box = nullptr;
80 aurore::Image* image = nullptr;
82 aurore::Label* title = nullptr;
83 kit::Bar* bar = nullptr;
86
88 void show(float fraction, const std::string& detail);
89};
90Progress progress_body(const std::string& heading, const std::string& title, const std::string& note = "");
91
99{
100 std::string label;
101 std::function<void()> action;
102};
103void prompt_time(const std::string& header, std::vector<int> times, int initial, TimeButton off, TimeButton other,
104 std::function<void(int)> on_value);
105
109
110} // namespace cadran
Generic FlexBox layout.
Definition box.hpp:74
Definition button.hpp:146
Definition dialog.hpp:44
Definition edit_text_dialog.hpp:9
Definition image.hpp:67
Definition label.hpp:65
Definition view.hpp:232
Definition cadran_kit.hpp:106
Definition cadran.hpp:31
aurore::Box * wait_body(const std::string &text)
void style_dialog(aurore::Dialog *dialog, Emphasis emphasis=Emphasis::NONE)
constexpr float DIALOG_BUTTONS
Definition cadran_modal.hpp:22
aurore::Box * dialog_body(const std::string &text)
Progress progress_body(const std::string &heading, const std::string &title, const std::string &note="")
void add_note(const std::string &key, const char *icon, bool warn=false)
constexpr float DIALOG_MARGIN
Definition cadran_modal.hpp:23
constexpr float PICKER_CORNER
A picker's card: the radius of its corners.
Definition cadran_modal.hpp:25
void style_button(aurore::Button *button, Emphasis emphasis=Emphasis::NONE)
aurore::View * toast_icon(bool done)
void style_edit_text_dialog(aurore::EditTextDialog *dialog)
Emphasis
Definition cadran_modal.hpp:28
@ PRIMARY
the last button is the confirmation: teal
@ NONE
OK in teal, any other button plain.
void prompt_time(const std::string &header, std::vector< int > times, int initial, TimeButton off, TimeButton other, std::function< void(int)> on_value)
aurore::Box * dialog_badge(const char *icon, const char *color_key, const char *soft_key)
A round badge before a title: icon in color_key on soft_key.
aurore::Label * dialog_title(const std::string &text)
A dialog's title as dialog_body sets it (the display face, 23 px).
Definition text.hpp:13
Definition cadran_modal.hpp:78
aurore::Label * title
Definition cadran_modal.hpp:82
aurore::Image * image
Definition cadran_modal.hpp:80
aurore::Label * heading
Definition cadran_modal.hpp:81
void show(float fraction, const std::string &detail)
fraction (0..1) on the bar and as "43 %", detail at the end.
aurore::Label * percent
Definition cadran_modal.hpp:84
aurore::Label * detail
Definition cadran_modal.hpp:85
kit::Bar * bar
Definition cadran_modal.hpp:83
aurore::Box * box
Definition cadran_modal.hpp:79
Definition cadran_modal.hpp:99
std::function< void()> action
Definition cadran_modal.hpp:101
std::string label
Definition cadran_modal.hpp:100