|
CPGen
C++ project generator
|
A container widget that groups and lays out child Component objects. More...
#include <ComponentGroup.hpp>


Public Member Functions | |
| ComponentGroup (std::string title, std::string icon="") | |
| Construct a ComponentGroup with a title and an optional icon. | |
| void | addChild (std::unique_ptr< Component > child) |
| Append a child component to the bottom of the group. | |
| std::string | render () const override |
| Render the group and all its children as a multi-line ANSI string. | |
| bool | handleInput (Defs::Key key) override |
| Handle a key event, routing it to the focused child or managing focus. | |
| void | setFocused (bool focused) override |
| Propagate focus state changes to the currently focused child. | |
Public Member Functions inherited from Component | |
| Component ()=default | |
| virtual | ~Component ()=default |
| Virtual destructor — components are always owned via base-class pointer. | |
| Component (const Component &)=delete | |
| Non-copyable (unique ownership). | |
| Component & | operator= (const Component &)=delete |
| Non-copyable (unique ownership). | |
| Component (Component &&)=delete | |
| Non-movable. | |
| Component & | operator= (Component &&)=delete |
| Non-movable. | |
| bool | isFocused () const |
| Return whether this component currently has keyboard focus. | |
Additional Inherited Members | |
Protected Attributes inherited from Component | |
| bool | m_is_focused |
| Current focus state, managed by setFocused. | |
A container widget that groups and lays out child Component objects.
Renders itself as a fixed-width bordered box with a title (and optional icon) in the top border. Child components are stacked vertically inside the box. The group tracks an internal focus index and routes Defs::Special::Up / Defs::Special::Down to cycle focus between children; all other keys are forwarded to the currently focused child.
|
explicit |
Construct a ComponentGroup with a title and an optional icon.
| title | Displayed in the top border of the group box. |
| icon | Optional Nerd Font / Unicode glyph prepended to the title. Defaults to an empty string (no icon). |
| void ComponentGroup::addChild | ( | std::unique_ptr< Component > | child | ) |
Append a child component to the bottom of the group.
Ownership is transferred to the group. The first child added automatically receives focus when the group itself gains focus.
| child | The component to add. |
|
overridevirtual |
Handle a key event, routing it to the focused child or managing focus.
handleInput.| key | The key to process. |
true if the key was consumed (either by focus movement or by a child). Implements Component.
|
overridevirtual |
Render the group and all its children as a multi-line ANSI string.
Implements Component.

|
overridevirtual |
Propagate focus state changes to the currently focused child.
When the group gains focus, the child at m_focused_index is also focused. When focus is removed from the group, all children are unfocused.
| focused | true to grant focus, false to remove it. |
Reimplemented from Component.