guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::entities::Tooltip::Builder Class Reference

Configures a Tooltip, then builds it and registers it in the entity registry given at construction. More...

#include <headers/guillaume/entities/tooltip.hpp>

Inheritance diagram for guillaume::entities::Tooltip::Builder:
Collaboration diagram for guillaume::entities::Tooltip::Builder:

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< Tooltip > buildEntity (void) override
 Build a tooltip and its children from the current configuration, without registering it or setting its parent.
void reset (void) override
 Restore the defaults: Plain variant, no text, no title, a default pose and a width that follows the content.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set the pose the tooltip is created with.
Builder & withVariant (Variant variant)
 Set the tooltip variant.
Builder & withText (const std::string &text)
 Set the body text.
Builder & withTitle (const std::string &title)
 Set the title shown above the text.
Builder & withFixedWidth (float width)
 Give the tooltip a fixed width.
std::shared_ptr< Tooltip > makeTooltip (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &text, const std::string &title="")
 Build a tooltip, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Tooltip >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Tooltip > 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.

Detailed Description

Configures a Tooltip, then builds it and registers it in the entity registry given at construction.

Definition at line 132 of file tooltip.hpp.

Constructor & Destructor Documentation

◆ Builder()

guillaume::entities::Tooltip::Builder::Builder ( ecs::ComponentRegistry & componentRegistry,
ecs::EntityRegistry & entityRegistry )

Create a builder set to the defaults of reset().

Parameters
componentRegistryThe registry the tooltip's components are created in.
entityRegistryThe registry the built tooltips are added to.

Definition at line 37 of file tooltip.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ buildEntity()

std::shared_ptr< Tooltip > guillaume::entities::Tooltip::Builder::buildEntity ( void )
overridevirtual

Build a tooltip and its children from the current configuration, without registering it or setting its parent.

Returns
The new tooltip, hidden and without anchor.

Implements guillaume::entities::EntityBuilderBase< Tooltip >.

Definition at line 44 of file tooltip.cpp.

Here is the call graph for this function:

◆ makeTooltip()

std::shared_ptr< Tooltip > guillaume::entities::Tooltip::Builder::makeTooltip ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::string & text,
const std::string & title = "" )

Build a tooltip, register it under parent and reset the builder.

The arguments replace the variant, text and title set before; the pose and fixed width are kept.

Parameters
parentThe entity the tooltip is attached to. It is not the anchor: call Tooltip::setAnchor() for that.
variantThe tooltip variant.
textThe body text.
titleThe title, used by the Rich variant only.
Returns
The registered tooltip, hidden and without anchor.

Definition at line 100 of file tooltip.cpp.

Here is the call graph for this function:

◆ reset()

void guillaume::entities::Tooltip::Builder::reset ( void )
overridevirtual

Restore the defaults: Plain variant, no text, no title, a default pose and a width that follows the content.

Implements guillaume::ecs::EntityBuilder.

Definition at line 51 of file tooltip.cpp.

Here is the caller graph for this function:

◆ withFixedWidth()

Tooltip::Builder & guillaume::entities::Tooltip::Builder::withFixedWidth ( float width)

Give the tooltip a fixed width.

Parameters
widthThe width, in dp. Default: none, the width follows the content.
Returns
This builder, for chaining.

Definition at line 92 of file tooltip.cpp.

◆ withPose()

Tooltip::Builder & guillaume::entities::Tooltip::Builder::withPose ( const utility::graphic::PoseF & pose)

Set the pose the tooltip is created with.

Parameters
poseThe position and orientation of the label. Default: a default-constructed pose. Showing an anchored tooltip replaces it.
Returns
This builder, for chaining.

Definition at line 68 of file tooltip.cpp.

◆ withText()

Tooltip::Builder & guillaume::entities::Tooltip::Builder::withText ( const std::string & text)

Set the body text.

Parameters
textThe text. Default: empty, which builds no text child.
Returns
This builder, for chaining.

Definition at line 80 of file tooltip.cpp.

◆ withTitle()

Tooltip::Builder & guillaume::entities::Tooltip::Builder::withTitle ( const std::string & title)

Set the title shown above the text.

Parameters
titleThe title. Used by the Rich variant only; an empty title builds no title child. Default: empty.
Returns
This builder, for chaining.

Definition at line 86 of file tooltip.cpp.

◆ withVariant()

Tooltip::Builder & guillaume::entities::Tooltip::Builder::withVariant ( Variant variant)

Set the tooltip variant.

Parameters
variantThe variant. Default: Variant::Plain.
Returns
This builder, for chaining.

Definition at line 74 of file tooltip.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: