TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_notification_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <gui_core/style/gui_style_text.h> // IconID
4
5#include <cstdint>
6#include <functional>
7#include <optional>
8#include <string>
9#include <string_view>
10#include <vector>
11
12// Telling the user something without a dialog: toasts in a window's corner, banners at the
13// top of a panel.
14
15namespace tachyon
16{
19
21 enum class Severity : uint8_t { Info, Success, Warning, Error };
22
24 struct ToastAction {
25 std::string label;
26 std::function<void()> onClick;
27 };
28
30 struct ToastDesc {
32 std::string title;
33 std::string body;
34 bool monospaceBody = false;
35 std::optional<float> progress;
36 std::vector<ToastAction> actions;
37 float age = 0.0f;
38 };
39
41 using ToastID = uint32_t;
42
44 enum class BannerActionKind : uint8_t { Primary, Secondary, Link };
45
47 struct BannerAction {
48 std::string_view label;
49 std::function<void()> onClick;
51 };
52
54}
@ Primary
Definition gui_application.h:106
@ Secondary
Definition gui_application.h:106
Severity
How serious a notification is: its icon and color.
Definition gui_notification_types.h:21
uint32_t ToastID
A toast shown by ShowToast; 0 is none.
Definition gui_notification_types.h:41
BannerActionKind
How a banner's action is drawn.
Definition gui_notification_types.h:44
@ Info
Definition gui_notification_types.h:21
@ Secondary
Definition gui_notification_types.h:44
@ Link
Definition gui_notification_types.h:44
@ Success
Definition gui_element_storage.h:44
Definition gui_logging.h:24
A banner's button or link, right-aligned after its message.
Definition gui_notification_types.h:47
std::function< void()> onClick
Definition gui_notification_types.h:49
std::string_view label
Definition gui_notification_types.h:48
BannerActionKind kind
Definition gui_notification_types.h:50
A failure: its category and a human-readable message.
Definition gui_result.h:26
A text button on a toast; the first is drawn in the link color.
Definition gui_notification_types.h:24
std::function< void()> onClick
then the toast goes
Definition gui_notification_types.h:26
std::string label
Definition gui_notification_types.h:25
What a toast says (ShowToast). Change it later through FindToast.
Definition gui_notification_types.h:30
std::vector< ToastAction > actions
Definition gui_notification_types.h:36
Severity severity
Definition gui_notification_types.h:31
float age
seconds since it happened, when it's shown: its time says so
Definition gui_notification_types.h:37
std::optional< float > progress
0..1: a progress bar under the body
Definition gui_notification_types.h:35
std::string body
Definition gui_notification_types.h:33
bool monospaceBody
code or file locations
Definition gui_notification_types.h:34
std::string title
Definition gui_notification_types.h:32