|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Configures a Snackbar, then builds it and registers it in the entity registry given at construction. More...
#include <headers/guillaume/entities/snackbar.hpp>


Public Member Functions | |
| Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Create a builder set to the defaults of reset(). | |
| std::shared_ptr< Snackbar > | buildEntity (void) override |
| Build a snackbar and its children from the current configuration, without registering it or setting its parent. | |
| void | reset (void) override |
| Restore the defaults: SingleLine variant, no message, no action label, shown, DurationMedium (7 seconds), no handler, a default pose and a 344 dp wide bar. | |
| Builder & | withPose (const utility::graphic::PoseF &pose) |
| Set the pose the snackbar is created with. | |
| Builder & | withVariant (Variant variant) |
| Set the snackbar variant. | |
| Builder & | withMessage (const std::string &message) |
| Set the message. | |
| Builder & | withAction (const std::string &action) |
| Set the label of the action. | |
| Builder & | withVisible (bool visible) |
| Choose whether the snackbar is shown once built. | |
| Builder & | withDuration (float seconds) |
| Set how long the snackbar stays shown (Paper duration). | |
| Builder & | withOnDismiss (std::function< void(void)> onDismiss) |
| Set the handler called when the snackbar dismisses itself (see Snackbar::setOnDismiss()). | |
| Builder & | withOnAction (std::function< void(void)> onAction) |
| Set the handler called when the action is pressed (Paper action.onPress). | |
| std::shared_ptr< Snackbar > | makeSnackbar (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &message, const std::string &action="") |
Build a snackbar, register it under parent and reset the builder. | |
| Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Snackbar > | |
| EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder bound to two registries. | |
| ~EntityBuilderBase (void) override=default | |
| Default destructor. | |
| std::shared_ptr< Snackbar > | registerEntity (std::shared_ptr< ecs::Entity > parent) |
| Build the widget, attach it to its parent, hand it to the entity registry, then reset the builder to its defaults. | |
| Public Member Functions inherited from guillaume::ecs::EntityBuilder | |
| EntityBuilder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Create a builder working on a pair of registries, normally those of one scene. | |
| virtual | ~EntityBuilder (void)=default |
| Virtual destructor. | |
Additional Inherited Members | |
| Protected Member Functions inherited from guillaume::ecs::EntityBuilder | |
| ComponentRegistry & | getComponentRegistry (void) |
| Get the registry in which the builder creates components. | |
| EntityRegistry & | getEntityRegistry (void) |
| Get the registry in which the builder registers the entities it creates. | |
Configures a Snackbar, then builds it and registers it in the entity registry given at construction.
Definition at line 131 of file snackbar.hpp.
| guillaume::entities::Snackbar::Builder::Builder | ( | ecs::ComponentRegistry & | componentRegistry, |
| ecs::EntityRegistry & | entityRegistry ) |
Create a builder set to the defaults of reset().
| componentRegistry | The registry the snackbar's components are created in. |
| entityRegistry | The registry the built snackbars are added to. |
Definition at line 37 of file snackbar.cpp.

|
overridevirtual |
Build a snackbar and its children from the current configuration, without registering it or setting its parent.
| std::invalid_argument | If the duration given to withDuration() is negative. |
Implements guillaume::entities::EntityBuilderBase< Snackbar >.
Definition at line 44 of file snackbar.cpp.

| std::shared_ptr< Snackbar > guillaume::entities::Snackbar::Builder::makeSnackbar | ( | std::shared_ptr< ecs::Entity > | parent, |
| Variant | variant, | ||
| const std::string & | message, | ||
| const std::string & | action = "" ) |
Build a snackbar, register it under parent and reset the builder.
The arguments replace the variant, message and action label set before; the other settings are kept.
| parent | The entity the snackbar is attached to. |
| variant | The snackbar variant. |
| message | The message text. |
| action | The action label, used by the WithAction variant only. |
| std::invalid_argument | If the duration given to withDuration() is negative. |
Definition at line 128 of file snackbar.cpp.

|
overridevirtual |
Restore the defaults: SingleLine variant, no message, no action label, shown, DurationMedium (7 seconds), no handler, a default pose and a 344 dp wide bar.
Implements guillaume::ecs::EntityBuilder.
Definition at line 55 of file snackbar.cpp.

| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withAction | ( | const std::string & | action | ) |
Set the label of the action.
| action | The label. Used by the WithAction variant only; an empty label builds no action. Default: empty. |
Definition at line 96 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withDuration | ( | float | seconds | ) |
Set how long the snackbar stays shown (Paper duration).
| seconds | The display time, in seconds; 0 never dismisses. Default: DurationMedium. A negative value makes the build throw. |
Definition at line 108 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withMessage | ( | const std::string & | message | ) |
Set the message.
| message | The message text. Default: empty, which builds no message child. |
Definition at line 90 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withOnAction | ( | std::function< void(void)> | onAction | ) |
Set the handler called when the action is pressed (Paper action.onPress).
| onAction | The handler. Default: none. |
Definition at line 122 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withOnDismiss | ( | std::function< void(void)> | onDismiss | ) |
Set the handler called when the snackbar dismisses itself (see Snackbar::setOnDismiss()).
| onDismiss | The handler. Default: none. |
Definition at line 115 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withPose | ( | const utility::graphic::PoseF & | pose | ) |
Set the pose the snackbar is created with.
| pose | The position and orientation of the bar. Default: a default-constructed pose. |
Definition at line 77 of file snackbar.cpp.
| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withVariant | ( | Variant | variant | ) |
Set the snackbar variant.
| variant | The variant. Default: Variant::SingleLine. |
Definition at line 83 of file snackbar.cpp.

| Snackbar::Builder & guillaume::entities::Snackbar::Builder::withVisible | ( | bool | visible | ) |
Choose whether the snackbar is shown once built.
| visible | True to show it at once, false to build it hidden. Default: true. |
Definition at line 102 of file snackbar.cpp.