guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
search.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 <string>
26
27#include "guillaume/ecs/system_filler.hpp"
28
29#include "guillaume/components/search.hpp"
30
31namespace guillaume::systems
32{
71 class Search: public ecs::SystemFiller<components::Search>
72 {
73 public:
77 Search(void);
78
82 ~Search(void) override = default;
83
101 static void install(ecs::ComponentRegistry &componentRegistry,
102 const ecs::Entity::Identifier &entityIdentifier);
103
115 static void
116 installIcon(ecs::ComponentRegistry &componentRegistry,
117 const ecs::Entity::Identifier &entityIdentifier);
118
130 static void
131 installClearIcon(ecs::ComponentRegistry &componentRegistry,
132 const ecs::Entity::Identifier &entityIdentifier);
133
146 static void installTrailingIcon(
147 ecs::ComponentRegistry &componentRegistry,
148 const ecs::Entity::Identifier &entityIdentifier);
149
166 static void apply(ecs::ComponentRegistry &componentRegistry,
167 const ecs::Entity::Identifier &entityIdentifier);
168
177 static std::string
178 text(const ecs::ComponentRegistry &componentRegistry,
179 const ecs::Entity::Identifier &entityIdentifier);
180
192 static void setText(ecs::ComponentRegistry &componentRegistry,
193 const ecs::Entity::Identifier &entityIdentifier,
194 const std::string &text);
195
204 static void clear(ecs::ComponentRegistry &componentRegistry,
205 const ecs::Entity::Identifier &entityIdentifier);
206
215 static void pressIcon(ecs::ComponentRegistry &componentRegistry,
216 const ecs::Entity::Identifier &entityIdentifier);
217
226 static void
227 pressTrailingIcon(ecs::ComponentRegistry &componentRegistry,
228 const ecs::Entity::Identifier &entityIdentifier);
229
238 static void show(ecs::ComponentRegistry &componentRegistry,
239 const ecs::Entity::Identifier &entityIdentifier);
240
249 static void hide(ecs::ComponentRegistry &componentRegistry,
250 const ecs::Entity::Identifier &entityIdentifier);
251
258 static bool isVisible(const ecs::ComponentRegistry &componentRegistry,
259 const ecs::Entity::Identifier &entityIdentifier);
260
268 void update(const ecs::Entity::Identifier &entityIdentifier) override;
269 };
270
271} // namespace guillaume::systems
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...
static void clear(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Empty the query as a press on the clear icon would.
Definition search.cpp:269
static bool isVisible(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Whether the search field is shown.
Definition search.cpp:322
~Search(void) override=default
Default destructor.
static void pressIcon(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Activate the leading icon as a press on it would.
Definition search.cpp:283
static void hide(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Hide the search field.
Definition search.cpp:315
static void installClearIcon(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Make the clear icon a button that calls clear().
Definition search.cpp:204
Search(void)
Create the system in the Layout phase.
Definition search.cpp:168
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Style one search field and lay out its children.
Definition search.cpp:330
static void installIcon(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Make the leading icon a button that calls pressIcon().
Definition search.cpp:189
void update(const ecs::Entity::Identifier &entityIdentifier) override
Run apply() on one search field; called by the frame loop.
Definition search.cpp:424
static void setText(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const std::string &text)
Replace the query and restyle the field.
Definition search.cpp:252
static std::string text(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Get the query the field holds.
Definition search.cpp:237
static void install(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Give a search field its accessibility role and make its icons pressable.
Definition search.cpp:173
static void pressTrailingIcon(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Activate the trailing icon as a press on it would.
Definition search.cpp:295
static void show(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Show the search field.
Definition search.cpp:308
static void installTrailingIcon(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Make the trailing icon a button that calls pressTrailingIcon().
Definition search.cpp:220
Rules. Every class here runs each frame on the entities that have the components it declares.