guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
card.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include "guillaume/ecs/system_filler.hpp"
26
27#include "guillaume/components/card.hpp"
28
29namespace guillaume::systems
30{
60 class Card: public ecs::SystemFiller<components::Card>
61 {
62 public:
66 Card(void);
67
71 ~Card(void) override = default;
72
88 static void install(ecs::ComponentRegistry &componentRegistry,
89 const ecs::Entity::Identifier &entityIdentifier);
90
109 static void apply(ecs::ComponentRegistry &componentRegistry,
110 const ecs::Entity::Identifier &entityIdentifier);
111
128 static void setOnPress(ecs::ComponentRegistry &componentRegistry,
129 const ecs::Entity::Identifier &entityIdentifier,
131
141 static void press(ecs::ComponentRegistry &componentRegistry,
142 const ecs::Entity::Identifier &entityIdentifier);
143
156 static void
158 const ecs::Entity::Identifier &entityIdentifier);
159
170 static void setDisabled(ecs::ComponentRegistry &componentRegistry,
171 const ecs::Entity::Identifier &entityIdentifier,
172 bool disabled);
173
180 static bool isDisabled(const ecs::ComponentRegistry &componentRegistry,
181 const ecs::Entity::Identifier &entityIdentifier);
182
193 static float
194 contentWidth(const ecs::ComponentRegistry &componentRegistry,
195 const ecs::Entity::Identifier &entityIdentifier);
196
204 void update(const ecs::Entity::Identifier &entityIdentifier) override;
205 };
206
207} // namespace guillaume::systems
std::function< void(void)> Handler
Callback run when the card is pressed.
Definition card.hpp:88
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
Definition entity.hpp:86
The base class to derive a system from: a System whose signature is the list of component types given...
void update(const ecs::Entity::Identifier &entityIdentifier) override
Run apply() on one card; called by the frame loop.
Definition card.cpp:396
static void press(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Activate the card as a click or a key press would.
Definition card.cpp:276
Card(void)
Create the system in the Layout phase.
Definition card.cpp:226
static void install(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Prepare the press-elevation motion of a card.
Definition card.cpp:231
static void setDisabled(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, bool disabled)
Enable or disable the card and restyle it.
Definition card.cpp:310
~Card(void) override=default
Default destructor.
static float contentWidth(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Get the width a section of the card can use, in dp.
Definition card.cpp:330
static void interactionChanged(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
React to a change of the hover or press state of the card.
Definition card.cpp:292
static bool isDisabled(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Whether the card ignores input.
Definition card.cpp:324
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Style one card and arrange its sections.
Definition card.cpp:341
static void setOnPress(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, components::Card::Handler handler)
Set the press handler and make the card pressable.
Definition card.cpp:251
Rules. Every class here runs each frame on the entities that have the components it declares.