|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
A Material Symbols icon, chosen by name and drawn as one glyph of the icon font. More...
#include <headers/guillaume/entities/icon.hpp>
Classes | |
| class | Builder |
| Configures Icon widgets and registers them in the scene's entity registry. More... | |
Public Member Functions | |
| ~Icon (void) | |
| Destructor. | |
| Icon & | setGlyphName (const std::string &glyphName) |
| Change the icon to draw. | |
| Icon & | setFontSize (const float &fontSize) |
| Set the size of the icon. | |
| Icon & | setColor (const utility::graphic::Color32Bit &color) |
| Set the icon color. | |
| Icon & | setStyle (const components::Glyph::Style &style) |
| Set the Material Symbols style of the glyph. | |
| Icon & | setAccessibilityLabel (const std::string &label) |
| Give the icon a meaning for assistive technologies. | |
| Public Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Glyph, components::Color > | |
| EntityFiller (ComponentRegistry &componentRegistry) | |
| Create the entity, its listed components and its components::Hierarchy. | |
| virtual | ~EntityFiller (void)=default |
| Destroy the entity object; its components stay in the registry (see EntityRegistry::removeEntity). | |
| Public Member Functions inherited from guillaume::ecs::Entity | |
| Entity (void) | |
| Create an entity with a fresh identifier, an empty signature, no parent and no component. | |
| virtual | ~Entity (void)=default |
| Destroy the entity object. | |
| Entity::Identifier | getIdentifier (void) const noexcept |
| Get the identifier of the entity. | |
| Entity::Signature | getSignature (void) const noexcept |
| Get the set of component types the entity declares. | |
| void | setSignature (const Signature &signature) |
| Replace the signature of the entity. | |
| std::int32_t | getLayer (void) const noexcept |
| Get the depth of the entity in the tree. | |
| Entity & | setParent (std::shared_ptr< Entity > parent) |
| Attach the entity under another one, or detach it. | |
| std::vector< Identifier > | releaseComponents (void) |
| Drop the entity's place in the tree and all its components. | |
| std::shared_ptr< Entity > | getParent (void) const noexcept |
| Get the parent entity. | |
Static Public Member Functions | |
| template<typename... Arguments> | |
| static std::shared_ptr< Icon > | create (Arguments &&...arguments) |
| Build an icon without registering it in an entity registry. | |
| Static Public Member Functions inherited from guillaume::ecs::Entity | |
| template<InheritFromComponent... ComponentTypes> | |
| static Signature | getSignatureFromTypes (void) |
| Build the signature that has exactly the bits of the given component types. | |
Additional Inherited Members | |
| Public Types inherited from guillaume::ecs::Entity | |
| using | Identifier = std::size_t |
| The key under which an entity's components are stored. Systems and components refer to entities by this value. | |
| using | Signature = std::bitset<128> |
| A set of component types, one bit per type (bit position given by ComponentTypeId, MaxComponentTypes bits). | |
| Static Public Attributes inherited from guillaume::ecs::Entity | |
| static constexpr Identifier | InvalidIdentifier |
| "No entity": never the identifier of a real entity | |
| Protected Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Glyph, components::Color > | |
| ComponentRegistry & | getComponentRegistry (void) |
| Get the registry that stores this entity's components. | |
| Protected Member Functions inherited from guillaume::ecs::Entity | |
| void | attachHierarchy (ComponentRegistry &componentRegistry) |
| Give the entity a components::Hierarchy in a registry and add that component to its signature. | |
| template<InheritFromComponent... ComponentTypes> | |
| void | setSignature (void) |
| Replace the signature by the one made of the given component types. | |
A Material Symbols icon, chosen by name and drawn as one glyph of the icon font.
Icon is a leaf widget: it has no children. Its state lives in components::Glyph (name, font size, style), components::Color and components::Transform. Each frame systems::MeasureGlyph writes the measured glyph size into components::Bound, in the Measure phase, and systems::GlyphRender draws the glyph, in the Render phase. The class itself holds no field.
Icon::create(registry, glyphName, fontSize, color, style) builds the same widget without registering it in an entity registry.
Watch out:
|
inlinestatic |
Build an icon without registering it in an entity registry.
The arguments are forwarded to the private constructor: (registry, glyphName, fontSize, color, style). An icon has no children to build.
| Arguments | The constructor argument types. |
| arguments | The constructor arguments, as listed above. |
Definition at line 185 of file icon.hpp.
| Icon & guillaume::entities::Icon::setAccessibilityLabel | ( | const std::string & | label | ) |
Give the icon a meaning for assistive technologies.
An icon has no components::Accessibility until this is called with a non-empty label, which adds the component with the Image role. A later empty label sets the role back to None and clears the label; the component stays.
| label | The text announced for the icon, or an empty string to make the icon decorative. |
Definition at line 135 of file icon.cpp.
| Icon & guillaume::entities::Icon::setColor | ( | const utility::graphic::Color32Bit & | color | ) |
Set the icon color.
| color | The new color (RGBA), written to components::Color. |
Definition at line 126 of file icon.cpp.
| Icon & guillaume::entities::Icon::setFontSize | ( | const float & | fontSize | ) |
| Icon & guillaume::entities::Icon::setGlyphName | ( | const std::string & | glyphName | ) |
Change the icon to draw.
| glyphName | The Material Symbols name of the new icon, written to components::Glyph. |
Definition at line 108 of file icon.cpp.
| Icon & guillaume::entities::Icon::setStyle | ( | const components::Glyph::Style & | style | ) |
Set the Material Symbols style of the glyph.
| style | The new style, written to components::Glyph. |
Definition at line 152 of file icon.cpp.