guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
list.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 <cstddef>
26
27#include "guillaume/ecs/system_filler.hpp"
28
29#include "guillaume/components/list.hpp"
30
31namespace guillaume::systems
32{
67 class List: public ecs::SystemFiller<components::List>
68 {
69 public:
72
76 List(void);
77
81 ~List(void) override = default;
82
95 static void install(ecs::ComponentRegistry &componentRegistry,
96 const ecs::Entity::Identifier &entityIdentifier);
97
112 static void installRow(ecs::ComponentRegistry &componentRegistry,
113 const ecs::Entity::Identifier &entityIdentifier,
114 const Path &path);
115
132 static void apply(ecs::ComponentRegistry &componentRegistry,
133 const ecs::Entity::Identifier &entityIdentifier);
134
147 static void styleRow(ecs::ComponentRegistry &componentRegistry,
148 const ecs::Entity::Identifier &entityIdentifier,
149 const Path &path);
150
163 static void pressItem(ecs::ComponentRegistry &componentRegistry,
164 const ecs::Entity::Identifier &entityIdentifier,
165 const Path &path);
166
178 static void
179 setItemDisabled(ecs::ComponentRegistry &componentRegistry,
180 const ecs::Entity::Identifier &entityIdentifier,
181 std::size_t index, bool disabled);
182
196 static void setExpanded(ecs::ComponentRegistry &componentRegistry,
197 const ecs::Entity::Identifier &entityIdentifier,
198 std::size_t index, bool expanded);
199
209 static bool isExpanded(const ecs::ComponentRegistry &componentRegistry,
210 const ecs::Entity::Identifier &entityIdentifier,
211 std::size_t index);
212
220 void update(const ecs::Entity::Identifier &entityIdentifier) override;
221 };
222
223} // namespace guillaume::systems
std::vector< std::size_t > Path
Definition list.hpp:159
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...
components::List::Path Path
Index path of an entry: top-level index, then child indices.
Definition list.hpp:71
static void setItemDisabled(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index, bool disabled)
Enable or disable a top-level entry and restyle the list.
Definition list.cpp:445
static void pressItem(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const Path &path)
Activate an entry as a press on its row would.
Definition list.cpp:421
void update(const ecs::Entity::Identifier &entityIdentifier) override
Run apply() on one list; called by the frame loop.
Definition list.cpp:542
static bool isExpanded(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index)
Whether a top-level entry is expanded.
Definition list.cpp:463
static void install(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Make every row of a list pressable.
Definition list.cpp:366
List(void)
Create the system in the Layout phase.
Definition list.cpp:361
static void installRow(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const Path &path)
Make one row pressable.
Definition list.cpp:381
static void setExpanded(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index, bool expanded)
Expand or collapse a top-level accordion and arrange the list again.
Definition list.cpp:454
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Style one list, then size and place its rows.
Definition list.cpp:474
static void styleRow(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const Path &path)
Recolor one row without arranging the list again.
Definition list.cpp:406
~List(void) override=default
Default destructor.
Rules. Every class here runs each frame on the entities that have the components it declares.