Skip to content

Modal

Overlays · interactive

A modal dialog, with a backdrop and a header you can drag it by.

Import

cpp
#include "gbui/widgets/modal.hpp"

Example

modal · Overlays · interactive

Nothing is downloaded until you press it.

cpp
Modal modal(Ui& ui, const Interaction& input, std::string_view id, std::string_view title, Vec2 position, const ModalOptions& options = {});

The caller supplies the position so dragging survives the tree being rebuilt, and gets it back updated.

ModalActions

modalActions · Overlays · container

Nothing is downloaded until you press it.

cpp
Ui::Scope modalActions(Ui& ui);

The row of buttons at the foot of a dialog, pushed to the right.

API

ModalOptions

OptionTypeDefaultWhat it does
widthfloat420.0f
heightfloatkAuto
backdropbooltrueDims what is behind it. A modal without one is a floating panel.
draggablebooltrueLets the user drag it by its header, kept inside the window.
icon optionalstd::optional<Icon>Beside the title. A dialog that asks something usually wants one; one that reports something usually does not.
dangerboolfalseThe destructive kind. Recolours the title, and takes AlertDialog in the accessibility tree — which is what tells a reader they were interrupted rather than that they asked.

Released under the LGPL-3.0-or-later licence.