Configures Card widgets and registers them in the scene's entity registry.
More...
#include <headers/guillaume/entities/card.hpp>
|
| | Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) |
| | Construct a builder holding the defaults of reset().
|
| std::shared_ptr< Card > | buildEntity (void) override |
| | Build an empty card from the current configuration, without registering it or giving it a parent.
|
| void | reset (void) override |
| | Restore the defaults: default pose, the Elevated variant, no press handler, enabled, the Medium shape radius of the active theme, a fixed width of 240 dp, no fixed height, and a vertical layout with 16 dp of padding and 8 dp between sections.
|
| Builder & | withPose (const utility::graphic::PoseF &pose) |
| | Set where the card is.
|
| Builder & | withVariant (Variant variant) |
| | Choose the look of the card.
|
| Builder & | withWidth (float width) |
| | Set the width of the card.
|
| Builder & | withHeight (float height) |
| | Force the height of the card.
|
| Builder & | withBorderRadius (float radius) |
| | Set the corner radius.
|
| Builder & | withOnPress (std::function< void(void)> onPress) |
| | Make the built card pressable.
|
| Builder & | withDisabled (bool disabled) |
| | Build the card disabled or enabled.
|
| std::shared_ptr< Card > | makeCard (std::shared_ptr< ecs::Entity > parent, Variant variant) |
| | Build an empty card, register it under parent and reset the builder.
|
| | EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) |
| | Construct a builder bound to two registries.
|
|
| ~EntityBuilderBase (void) override=default |
| | Default destructor.
|
| std::shared_ptr< Card > | 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.
|
| | 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.
|
Configures Card widgets and registers them in the scene's entity registry.
Definition at line 127 of file card.hpp.
◆ Builder()
Construct a builder holding the defaults of reset().
- Parameters
-
| componentRegistry | The registry the components of the built cards are stored in. |
| entityRegistry | The registry that owns the cards built by makeCard. |
Definition at line 70 of file card.cpp.
◆ buildEntity()
| std::shared_ptr< Card > guillaume::entities::Card::Builder::buildEntity |
( |
void | | ) |
|
|
overridevirtual |
◆ makeCard()
| std::shared_ptr< Card > guillaume::entities::Card::Builder::makeCard |
( |
std::shared_ptr< ecs::Entity > | parent, |
|
|
Variant | variant ) |
Build an empty card, register it under parent and reset the builder.
The pose, size, radius, press handler and disabled state set with the with... methods apply. Compose the content on the returned card with setCover(), setTitle(), setContent() and addAction().
- Parameters
-
| parent | The entity the card is attached to, or nullptr for a root entity. |
| variant | The look: Elevated, Filled or Outlined. |
- Returns
- The registered card.
Definition at line 146 of file card.cpp.
◆ reset()
| void guillaume::entities::Card::Builder::reset |
( |
void | | ) |
|
|
overridevirtual |
Restore the defaults: default pose, the Elevated variant, no press handler, enabled, the Medium shape radius of the active theme, a fixed width of 240 dp, no fixed height, and a vertical layout with 16 dp of padding and 8 dp between sections.
Implements guillaume::ecs::EntityBuilder.
Definition at line 88 of file card.cpp.
◆ withBorderRadius()
| Card::Builder & guillaume::entities::Card::Builder::withBorderRadius |
( |
float | radius | ) |
|
Set the corner radius.
- Parameters
-
| radius | The radius of the four corners, in dp. By default the Medium shape radius the active theme had when the builder was last reset. |
- Returns
- Reference to this builder for chaining.
Definition at line 127 of file card.cpp.
◆ withDisabled()
| Card::Builder & guillaume::entities::Card::Builder::withDisabled |
( |
bool | disabled | ) |
|
Build the card disabled or enabled.
- Parameters
-
| disabled | True for a card that ignores presses. False by default. |
- Returns
- Reference to this builder for chaining.
Definition at line 139 of file card.cpp.
◆ withHeight()
| Card::Builder & guillaume::entities::Card::Builder::withHeight |
( |
float | height | ) |
|
Force the height of the card.
- Parameters
-
| height | The fixed height, in dp. By default the height follows the sections. |
- Returns
- Reference to this builder for chaining.
Definition at line 120 of file card.cpp.
◆ withOnPress()
| Card::Builder & guillaume::entities::Card::Builder::withOnPress |
( |
std::function< void(void)> | onPress | ) |
|
Make the built card pressable.
- Parameters
-
| onPress | The function called when the user presses the card. An empty function, the default, builds a passive card. |
- Returns
- Reference to this builder for chaining.
Definition at line 133 of file card.cpp.
◆ withPose()
| Card::Builder & guillaume::entities::Card::Builder::withPose |
( |
const utility::graphic::PoseF & | pose | ) |
|
Set where the card is.
- Parameters
-
| pose | The pose of the top-left corner of the card. A default-constructed pose by default. |
- Returns
- Reference to this builder for chaining.
Definition at line 101 of file card.cpp.
◆ withVariant()
Choose the look of the card.
- Parameters
-
| variant | Elevated, Filled or Outlined. Elevated by default. |
- Returns
- Reference to this builder for chaining.
Definition at line 107 of file card.cpp.
◆ withWidth()
| Card::Builder & guillaume::entities::Card::Builder::withWidth |
( |
float | width | ) |
|
Set the width of the card.
- Parameters
-
| width | The fixed width, in dp. 240 by default. The sections are sized from it. |
- Returns
- Reference to this builder for chaining.
Definition at line 113 of file card.cpp.
The documentation for this class was generated from the following files: