31#include <utility/graphic/color.hpp>
32#include <utility/graphic/pose.hpp>
34#include "guillaume/ecs/component_registry.hpp"
35#include "guillaume/ecs/entity_builder.hpp"
37#include "guillaume/components/app_bar.hpp"
38#include "guillaume/components/elevation.hpp"
39#include "guillaume/entities/icon.hpp"
40#include "guillaume/entities/icon_button.hpp"
41#include "guillaume/entities/builder_base.hpp"
42#include "guillaume/entities/surface.hpp"
43#include "guillaume/entities/text.hpp"
91 class AppBar:
public SurfaceBase<components::Elevation, components::AppBar>
110 Variant _variant { Variant::Small };
111 std::string _title {};
113 std::vector<Action> _actions {};
114 bool _elevated {
false };
131 std::shared_ptr<AppBar>
buildEntity(
void)
override;
139 void reset(
void)
override;
196 std::function<
void(
void)> onPress,
197 const std::string &accessibilityLabel =
"");
211 std::function<
void(
void)> onPress,
212 const std::string &accessibilityLabel =
"Navigate up");
240 std::shared_ptr<AppBar>
241 makeAppBar(std::shared_ptr<ecs::Entity> parent,
261 template<
typename... Arguments>
262 static std::shared_ptr<AppBar>
create(Arguments &&...arguments)
264 std::shared_ptr<AppBar> entity(
265 new AppBar(std::forward<Arguments>(arguments)...));
337 std::shared_ptr<Text>
getTitle(
void)
const;
354 std::shared_ptr<IconButton> buildAction(
const Action &action);
363 void buildContent(
void);
381 Variant variant,
const std::string &title,
382 const std::string &navigationIcon,
383 const std::vector<std::string> &actions);
400 Variant variant,
const std::string &title,
401 const Action &navigation,
const std::vector<Action> &actions,
Variant
Shape of the bar. It sets the height and the title size.
static constexpr float HorizontalPadding
Padding on each side of the bar and gap between its children, in dp.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
Owns entities and gives the systems the list of entities to visit.
Builder & withPose(const utility::graphic::PoseF &pose)
Set where the app bar is placed.
Builder & withFixedWidth(float width)
Set the width of the app bar.
Builder & withElevated(bool elevated)
Choose the elevated look (Paper elevated).
Builder & addAction(const std::string &iconGlyphName)
Append a trailing action button without press handler.
std::shared_ptr< AppBar > makeAppBar(std::shared_ptr< ecs::Entity > parent, Variant variant)
Build an app bar, register it under parent and reset the builder.
Builder & withOnNavigation(std::function< void(void)> onPress, const std::string &accessibilityLabel="Navigate up")
Set the press handler of the navigation button (Paper Appbar.BackAction).
Builder & withNavigationIcon(const std::string &iconGlyphName)
Set the icon of the leading navigation button.
Builder & withTitle(const std::string &title)
Set the title text.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Create a builder set to the defaults of reset().
Builder & withVariant(Variant variant)
Set the variant.
void reset(void) override
Restore the defaults.
std::shared_ptr< AppBar > buildEntity(void) override
Build an app bar and its children from the current configuration, without registering it or setting i...
A horizontal bar with a leading navigation icon button, a title and trailing action icon buttons.
std::shared_ptr< Text > getTitle(void) const
Get the title child.
AppBar & setVariant(Variant variant)
Change the variant.
static std::shared_ptr< AppBar > create(Arguments &&...arguments)
Create an app bar and its children, without registering it in an entity registry.
std::shared_ptr< IconButton > getActionButton(std::size_t index) const
Get a trailing action button.
static constexpr float HorizontalPadding
Padding around the children and spacing between them, in dp (Paper: 4 dp).
bool isElevated(void) const
Whether the app bar uses the elevated look.
Variant getVariant(void) const
Get the variant.
components::AppBar::Action Action
AppBar & setElevated(bool elevated)
Choose the elevated look (Paper elevated). Restyles at once.
~AppBar(void) override
Default destructor.
std::shared_ptr< IconButton > getNavigationButton(void) const
Get the leading navigation button.
AppBar & setTitle(const std::string &title)
Change the title text.
components::AppBar::Variant Variant
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
Widgets: the classes used to create entities with the right components and children.
One pressable icon of the bar: the leading navigation icon or a trailing action.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...