A vertically stacked set of collapsible sections. More...
#include <Malena/Graphics/Controls/Accordion.h>
Classes | |
| struct | SectionRef |
Public Types | |
| using | Flag = AccordionManifest::Flag |
| using | State = AccordionManifest::State |
Public Member Functions | |
| Accordion (const Accordion &)=delete | |
| Accordion (const sf::Font &font=FontManager<>::getDefault()) | |
| SectionRef | addSection (const std::string &label, float contentHeight=120.f) |
Add a section, creating its ListItem header and List content. | |
| AccordionTheme & | 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) |
| void | collapse (std::size_t index) |
| Collapse a section by index. | |
| void | expand (std::size_t index) |
| Expand a section by index. Collapses others if exclusive. | |
| sf::Color | getChevronColor () const |
| float | getChevronSize () const |
| sf::Color | getContentBg () const |
| sf::Color | getDisabledColor () const |
| sf::Color | getDisabledTextColor () const |
| sf::Color | getDividerColor () const |
| sf::Color | getErrorColor () const |
| bool | getExclusive () 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 | getHeaderBg () const |
| float | getHeaderHeight () const |
| sf::Color | getHeaderHovered () const |
| sf::Color | getHoverColor () const |
| sf::Color | getMutedColor () const |
| sf::Color | getOutlineColor () const |
| float | getOutlineThickness () const |
| float | getPadding () const |
| sf::Vector2f | getPosition () const override |
| float | getRadius () const |
| sf::Color | getTextColor () const |
| float | getTotalHeight () const |
| float | getWidth () const |
| bool | isExpanded (std::size_t index) const |
| Return whether a section is expanded. | |
| 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. | |
| void | onSectionChanged (std::function< void(std::size_t index, bool expanded)> cb) |
| Fired when a section is expanded or collapsed. | |
| Accordion & | operator= (const Accordion &)=delete |
| void | removeSection (std::size_t index) |
| Remove a section by index. | |
| std::size_t | sectionCount () const |
| Return the number of sections. | |
| void | setChevronColor (const sf::Color &c) |
| void | setChevronSize (float s) |
| void | setContentBg (const sf::Color &c) |
| void | setDisabledColor (const sf::Color &c) |
| void | setDisabledTextColor (const sf::Color &c) |
| void | setDividerColor (const sf::Color &c) |
| void | setErrorColor (const sf::Color &c) |
| void | setExclusive (bool e) |
| 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 | setHeaderBg (const sf::Color &c) |
| void | setHeaderHeight (float h) |
| void | setHeaderHovered (const sf::Color &c) |
| void | setHoverColor (const sf::Color &c) |
| 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 | setSize (const sf::Vector2f &size) |
| void | setTextColor (const sf::Color &c) |
| void | setWidth (float width) |
| void | toggle (std::size_t index) |
| Toggle a section's expanded state. | |
| void | unlockSettings () |
Allow applySettings() to take effect again. | |
| void | unlockTheme () |
| Resume reacting to global theme changes. | |
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 set of collapsible sections.
Each section has a ListItem header and an owned List that is shown or hidden when the header is clicked. By default only one section can be open at a time (exclusive = true).
The accordion creates and owns both the header and list — addSection returns references to both so the caller can configure them freely.
Definition at line 61 of file Accordion.h.
Definition at line 67 of file Accordion.h.
Definition at line 68 of file Accordion.h.
|
explicit |
|
delete |
| SectionRef ml::Accordion::addSection | ( | const std::string & | label, |
| float | contentHeight = 120.f ) |
Add a section, creating its ListItem header and List content.
| label | Header label text. |
| contentHeight | Height of the list area when the section is expanded. |
|
inlineoverridevirtualinherited |
Populate all fields from the global Theme token set.
Subclasses call GraphicTheme::applyFrom(t) first, then apply their own token mappings.
Reimplemented from ml::GraphicTheme.
Definition at line 20 of file AccordionTheme.h.
|
inline |
Definition at line 109 of file Accordion.h.
|
inline |
Definition at line 126 of file Accordion.h.
|
inline |
Definition at line 118 of file Accordion.h.
| void ml::Accordion::collapse | ( | std::size_t | index | ) |
Collapse a section by index.
|
overrideprotected |
| void ml::Accordion::expand | ( | std::size_t | index | ) |
Expand a section by index. Collapses others if exclusive.
|
inlinenodiscardinherited |
Definition at line 40 of file AccordionTheme.h.
|
inlinenodiscardinherited |
Definition at line 26 of file AccordionSettings.h.
|
inlinenodiscardinherited |
Definition at line 39 of file AccordionTheme.h.
|
inlinenodiscardinherited |
Definition at line 75 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 76 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 41 of file AccordionTheme.h.
|
inlinenodiscardinherited |
Definition at line 74 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 27 of file AccordionSettings.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 37 of file AccordionTheme.h.
|
inlinenodiscardinherited |
Definition at line 25 of file AccordionSettings.h.
|
inlinenodiscardinherited |
Definition at line 38 of file AccordionTheme.h.
|
inlinenodiscardinherited |
Definition at line 72 of file ControlTheme.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 77 of file ControlTheme.h.
|
nodiscard |
|
inlinenodiscard |
Definition at line 178 of file Accordion.h.
|
nodiscard |
Return whether a section is expanded.
|
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.
| void ml::Accordion::onSectionChanged | ( | std::function< void(std::size_t index, bool expanded)> | cb | ) |
Fired when a section is expanded or collapsed.
|
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.
| void ml::Accordion::removeSection | ( | std::size_t | index | ) |
Remove a section by index.
|
inlinenodiscard |
Return the number of sections.
Definition at line 169 of file Accordion.h.
|
inlineinherited |
Definition at line 46 of file AccordionTheme.h.
|
inlineinherited |
Definition at line 30 of file AccordionSettings.h.
|
inlineinherited |
Definition at line 45 of file AccordionTheme.h.
|
inlineinherited |
Definition at line 87 of file ControlTheme.h.
|
inlineinherited |
Definition at line 88 of file ControlTheme.h.
|
inlineinherited |
Definition at line 47 of file AccordionTheme.h.
|
inlineinherited |
Definition at line 86 of file ControlTheme.h.
|
inlineinherited |
Definition at line 31 of file AccordionSettings.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 43 of file AccordionTheme.h.
|
inlineinherited |
Definition at line 29 of file AccordionSettings.h.
|
inlineinherited |
Definition at line 44 of file AccordionTheme.h.
|
inlineinherited |
Definition at line 84 of file ControlTheme.h.
|
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.
|
inline |
Definition at line 177 of file Accordion.h.
|
inlineinherited |
Definition at line 89 of file ControlTheme.h.
| void ml::Accordion::setWidth | ( | float | width | ) |
| void ml::Accordion::toggle | ( | std::size_t | index | ) |
Toggle a section's expanded state.
|
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 17 of file AccordionTheme.h.
|
inherited |
Right margin for the chevron.
Definition at line 16 of file AccordionSettings.h.
|
inherited |
Definition at line 15 of file AccordionSettings.h.
Definition at line 16 of file AccordionTheme.h.
Definition at line 33 of file ControlTheme.h.
Definition at line 34 of file ControlTheme.h.
Definition at line 18 of file AccordionTheme.h.
Definition at line 32 of file ControlTheme.h.
|
inherited |
Only one section open at a time.
Definition at line 17 of file AccordionSettings.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 14 of file AccordionTheme.h.
|
inherited |
Definition at line 14 of file AccordionSettings.h.
Definition at line 15 of file AccordionTheme.h.
Definition at line 30 of file ControlTheme.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 35 of file ControlTheme.h.