A vertically stacked list of rows with optional dividers and background. More...
#include <Malena/Graphics/Controls/List.h>
Public Types | |
| using | Flag = ListManifest::Flag |
| using | State = ListManifest::State |
Public Member Functions | |
| List (const List &)=delete | |
| List (const sf::Font &font=FontManager<>::getDefault()) | |
| void | add (ml::Core &component) |
Add any ml::Core component as a row. | |
| ListItem & | addItem (const std::string &label, const std::string &description="", std::function< void()> onClick=nullptr) |
Create and own a ListItem with a label. | |
| ListItem & | addPinnedBottom (const std::string &label, std::function< void()> onClick=nullptr) |
Create a ListItem pinned to the bottom of the list. | |
| ListTheme & | applyFrom (const Theme &t) override |
Populate all fields from the global Theme token set. | |
| template<typename S> | |
| void | applySettings (const S &s) |
| template<typename St> | |
| void | applyStyle (const St &s) |
| template<typename T> | |
| void | applyTheme (const T &t) |
| ListItem * | back () |
Return a pointer to the last added owned ListItem, or nullptr if the list is empty or the last row is an external component (added via add()). | |
| void | clear () |
Remove all rows. Owned ListItem objects are destroyed. | |
| sf::Color | getBgColor () const |
| sf::Color | getDisabledColor () const |
| sf::Color | getDisabledTextColor () const |
| sf::Color | getDividerColor () const |
| float | getDividerThickness () const |
| sf::Color | getErrorColor () const |
| sf::Color | getFillColor () const |
| sf::Color | getFocusColor () const |
| const sf::Font * | getFont () const |
| unsigned int | getFontSize () const |
| unsigned int | getFontSizeSmall () const |
| sf::FloatRect | getGlobalBounds () const override |
| sf::Color | getHoverColor () const |
| float | getIndent () const |
| sf::Color | getMutedColor () const |
| sf::Color | getOutlineColor () const |
| float | getOutlineThickness () const |
| float | getPadding () const |
| sf::Vector2f | getPosition () const override |
| float | getRadius () const |
| bool | getShowBackground () const |
| bool | getShowDividers () const |
| sf::Color | getTextColor () const |
| float | getTotalHeight () const |
| float | getWidth () const |
| bool | isSettingsLocked () const |
Return true if applySettings() is currently blocked. | |
| bool | isThemeLocked () const |
Return true if this component ignores theme changes. | |
| void | lockSettings () |
Prevent applySettings() from taking effect. | |
| void | lockTheme () |
| Prevent automatic re-styling when the global theme changes. | |
| List & | operator= (const List &)=delete |
| bool | remove (const ml::Core *component) |
| Remove a row by component pointer. | |
| bool | removeAt (std::size_t index) |
| Remove a row by index. | |
| std::size_t | rowCount () const |
| Return the number of rows. | |
| void | setBgColor (const sf::Color &c) |
| void | setDisabledColor (const sf::Color &c) |
| void | setDisabledTextColor (const sf::Color &c) |
| void | setDividerColor (const sf::Color &c) |
| void | setDividerThickness (float t) |
| void | setErrorColor (const sf::Color &c) |
| void | setFillColor (const sf::Color &c) |
| void | setFocusColor (const sf::Color &c) |
| void | setFont (const sf::Font &&)=delete |
| void | setFont (const sf::Font &f) |
| void | setFontSize (unsigned int s) |
| void | setFontSizeSmall (unsigned int s) |
| void | setHoverColor (const sf::Color &c) |
| void | setIndent (float i) |
| void | setIndentOffset (float offset) |
Set the current indentation offset in pixels. Called automatically by a parent List when nesting. | |
| void | setMutedColor (const sf::Color &c) |
| void | setOutlineColor (const sf::Color &c) |
| void | setOutlineThickness (float t) |
| void | setPadding (float p) |
| void | setPosition (const sf::Vector2f &position) override |
| void | setRadius (float r) |
| void | setShowBackground (bool b) |
| void | setShowDividers (bool b) |
| void | setSize (const sf::Vector2f &size) |
| void | setTextColor (const sf::Color &c) |
| void | setWidth (float width) |
| Set the total width of the list. | |
| void | unlockSettings () |
Allow applySettings() to take effect again. | |
| void | unlockTheme () |
| Resume reacting to global theme changes. | |
Public Attributes | |
| sf::Color | bgColor = sf::Color(30, 30, 30) |
| sf::Color | disabledColor = sf::Color(60, 60, 60) |
| sf::Color | disabledTextColor = sf::Color(120, 120, 120) |
| sf::Color | dividerColor = sf::Color(80, 80, 80) |
| float | dividerThickness = 1.f |
| sf::Color | errorColor = sf::Color(220, 70, 70) |
| sf::Color | fillColor = sf::Color(40, 40, 40) |
| sf::Color | focusColor = sf::Color(100, 60, 200) |
| const sf::Font * | font = &FontManager<>::getDefault() |
| unsigned int | fontSize = 14 |
| unsigned int | fontSizeSmall = 11 |
| sf::Color | hoverColor = sf::Color(70, 130, 230) |
| float | indent = 20.f |
| Indentation added to nested Lists. | |
| sf::Color | mutedColor = sf::Color(120, 120, 120) |
| sf::Color | outlineColor = sf::Color(100, 100, 100) |
| float | outlineThickness = 1.5f |
| float | padding = 8.f |
| float | radius = 8.f |
| bool | showBackground = false |
| bool | showDividers = true |
| sf::Color | textColor = sf::Color::White |
Protected Member Functions | |
| void | draw (sf::RenderTarget &target, sf::RenderStates states) const override |
| void | onThemeApplied (const Theme &theme) override |
Called by ThemeManager when the active theme changes. | |
A vertically stacked list of rows with optional dividers and background.
List is a layout container that stacks rows vertically and optionally separates them with dividers. Each row is either:
ListItem created internally via addItem() — owned and styled by the list. This is the typical path for standard rows.ml::Core component passed to add() — not owned, not resized. Use this for custom rows, section headers, separators, etc.Style changes via applySettings(), applyTheme() or applyStyle() automatically propagate to all internally owned ListItem rows.
| using ml::List::Flag = ListManifest::Flag |
| using ml::List::State = ListManifest::State |
|
explicit |
|
delete |
| void ml::List::add | ( | ml::Core & | component | ) |
| ListItem & ml::List::addItem | ( | const std::string & | label, |
| const std::string & | description = "", | ||
| std::function< void()> | onClick = nullptr ) |
Create and own a ListItem with a label.
Returns a reference to the created item so the caller can configure slots (setStart, setEnd, onClick etc.) immediately after.
| label | Primary label text. |
| description | Optional secondary description line. Pass "" to omit. |
| onClick | Optional callback fired when the row is clicked. |
ListItem. | ListItem & ml::List::addPinnedBottom | ( | const std::string & | label, |
| std::function< void()> | onClick = nullptr ) |
Create a ListItem pinned to the bottom of the list.
All items added via addItem after this call appear above it. Only one pinned item is supported — calling this again replaces it.
Populate all fields from the global Theme token set.
Subclasses call GraphicTheme::applyFrom(t) first, then apply their own token mappings.
Reimplemented from ml::ControlTheme.
Definition at line 30 of file ListTheme.h.
|
inline |
|
inline |
|
inline |
|
inlinenodiscard |
Return a pointer to the last added owned ListItem, or nullptr if the list is empty or the last row is an external component (added via add()).
Prefer capturing the return value of addItem() directly when possible — this method is a convenience for call sites that cannot easily chain the return value.
| void ml::List::clear | ( | ) |
Remove all rows. Owned ListItem objects are destroyed.
|
overrideprotected |
|
inlinenodiscardinherited |
Definition at line 48 of file ListTheme.h.
|
inlinenodiscardinherited |
Definition at line 75 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 76 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 49 of file ListTheme.h.
|
inlinenodiscardinherited |
Definition at line 42 of file ListSettings.h.
|
inlinenodiscardinherited |
Definition at line 74 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 67 of file GraphicTheme.h.
|
inlinenodiscardinherited |
Definition at line 73 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 80 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 81 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 82 of file ControlTheme.h.
|
override |
|
inlinenodiscardinherited |
Definition at line 72 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 43 of file ListSettings.h.
|
inlinenodiscardinherited |
Definition at line 78 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 68 of file GraphicTheme.h.
|
inlinenodiscardinherited |
Definition at line 69 of file GraphicTheme.h.
|
inlinenodiscardinherited |
Definition at line 79 of file ControlTheme.h.
|
override |
|
inlinenodiscardinherited |
Definition at line 70 of file GraphicTheme.h.
|
inlinenodiscardinherited |
Definition at line 41 of file ListSettings.h.
|
inlinenodiscardinherited |
Definition at line 40 of file ListSettings.h.
|
inlinenodiscardinherited |
Definition at line 77 of file ControlTheme.h.
|
nodiscard |
|
inlinenodiscardinherited |
Return true if applySettings() is currently blocked.
Definition at line 115 of file Themeable.h.
|
inlinenodiscardinherited |
Return true if this component ignores theme changes.
Definition at line 97 of file Themeable.h.
|
inlineinherited |
Prevent applySettings() from taking effect.
Explicit individual setter calls still work normally. Only blocks the batch applySettings() path.
Definition at line 107 of file Themeable.h.
|
inlineinherited |
Prevent automatic re-styling when the global theme changes.
The component keeps its current visual state. Explicit individual setter calls still work normally.
Definition at line 85 of file Themeable.h.
|
overrideprotectedvirtual |
Called by ThemeManager when the active theme changes.
Override in your component to re-style from the new theme. Always check isThemeLocked() first:
| theme | The newly active theme. |
Implements ml::Themeable.
| bool ml::List::remove | ( | const ml::Core * | component | ) |
Remove a row by component pointer.
If the row contains an owned ListItem, it is destroyed. External components are simply unlinked but not deleted.
| component | Pointer to the component to remove. |
true if found and removed; false otherwise. | bool ml::List::removeAt | ( | std::size_t | index | ) |
Remove a row by index.
If the row contains an owned ListItem, it is destroyed. External components are simply unlinked but not deleted.
| index | Row index (0-based). |
true if removed; false if index is out of bounds.
|
inlinenodiscard |
|
inlineinherited |
Definition at line 51 of file ListTheme.h.
|
inlineinherited |
Definition at line 87 of file ControlTheme.h.
|
inlineinherited |
Definition at line 88 of file ControlTheme.h.
|
inlineinherited |
Definition at line 52 of file ListTheme.h.
|
inlineinherited |
Definition at line 47 of file ListSettings.h.
|
inlineinherited |
Definition at line 86 of file ControlTheme.h.
|
inlineinherited |
Definition at line 72 of file GraphicTheme.h.
|
inlineinherited |
Definition at line 85 of file ControlTheme.h.
|
deleteinherited |
|
inlineinherited |
Definition at line 92 of file ControlTheme.h.
|
inlineinherited |
Definition at line 94 of file ControlTheme.h.
|
inlineinherited |
Definition at line 95 of file ControlTheme.h.
|
inlineinherited |
Definition at line 84 of file ControlTheme.h.
|
inlineinherited |
Definition at line 48 of file ListSettings.h.
|
inline |
|
inlineinherited |
Definition at line 90 of file ControlTheme.h.
|
inlineinherited |
Definition at line 73 of file GraphicTheme.h.
|
inlineinherited |
Definition at line 74 of file GraphicTheme.h.
|
inlineinherited |
Definition at line 91 of file ControlTheme.h.
|
override |
|
inlineinherited |
Definition at line 75 of file GraphicTheme.h.
|
inlineinherited |
Definition at line 46 of file ListSettings.h.
|
inlineinherited |
Definition at line 45 of file ListSettings.h.
|
inline |
|
inlineinherited |
Definition at line 89 of file ControlTheme.h.
| void ml::List::setWidth | ( | float | width | ) |
|
inlineinherited |
Allow applySettings() to take effect again.
Definition at line 112 of file Themeable.h.
|
inlineinherited |
Resume reacting to global theme changes.
Does NOT immediately re-apply the current theme — call ThemeManager::get() and pass it to onThemeApplied() manually if you want to re-sync immediately after unlocking.
Definition at line 94 of file Themeable.h.
Definition at line 25 of file ListTheme.h.
Definition at line 33 of file ControlTheme.h.
Definition at line 34 of file ControlTheme.h.
Definition at line 26 of file ListTheme.h.
|
inherited |
Definition at line 27 of file ListSettings.h.
Definition at line 32 of file ControlTheme.h.
Definition at line 43 of file GraphicTheme.h.
Definition at line 31 of file ControlTheme.h.
|
inherited |
Definition at line 39 of file ControlTheme.h.
|
inherited |
Definition at line 40 of file ControlTheme.h.
|
inherited |
Definition at line 41 of file ControlTheme.h.
Definition at line 30 of file ControlTheme.h.
|
inherited |
Indentation added to nested Lists.
Definition at line 28 of file ListSettings.h.
Definition at line 36 of file ControlTheme.h.
Definition at line 44 of file GraphicTheme.h.
|
inherited |
Definition at line 45 of file GraphicTheme.h.
|
inherited |
Definition at line 37 of file ControlTheme.h.
|
inherited |
Definition at line 46 of file GraphicTheme.h.
|
inherited |
Definition at line 26 of file ListSettings.h.
|
inherited |
Definition at line 25 of file ListSettings.h.
|
inherited |
Definition at line 35 of file ControlTheme.h.