UINotices.h file
Notices and file dialogs: things triggered from handlers rather than declared in the build.
A handler has no ui, so it captures a handle taken during the build:
auto notices = ui.Notices(); auto files = ui.Files(); ui.Button("Save", [=] { Save(); notices.Show("Scene saved"); }); ui.Button("Open", [=] { files.Open({ .Title = "Open Scene", .Filters = { { "Scene", "tnxscene" } } }, [=](std::span<const std::string_view> paths) { Load(paths); }); });
A notice is a line of text shown in a corner of the window for a few seconds. The file dialog is the platform's native one.
Both are services owned by the host and shared by every document, so non-UI code can use them too, from any thread:
host.Notices().Show("Build finished", { .Kind = GGNotice::Success });
A document with no services set keeps its own notices and has no file dialog.
Namespaces
- namespace GGUI
Classes
- struct GGUI::NoticeProps
- How a notice is shown.
- class GGUI::GGNotices
- GGNotices: the notices currently showing. Thread-safe.
- struct GGUI::GGNotices::Entry
- A notice showing.
- struct GGUI::FileFilter
- A file type offered by a dialog. Extensions are separated by
;("png;jpg"). - struct GGUI::FileDialogProps
- What a file dialog asks for.
- struct GGUI::FileRequest
- A dialog request as handed to the platform backend.
- class GGUI::GGFiles
- GGFiles: the platform file dialog, requested now and answered later. Thread-safe.
- class GGUI::GGNoticeHandle
- What ui.Notices() returns. Capture it in handlers.
- class GGUI::GGFileHandle
- What ui.Files() returns. Capture it in handlers.