A dropdown select control with rich per-item content. More...
#include <Malena/Graphics/Controls/Select.h>
Public Types | |
| using | Flag = SelectManifest::Flag |
| using | State = SelectManifest::State |
Public Member Functions | |
| Select (const sf::Font &font=FontManager<>::getDefault()) | |
| void | add (ml::Core &component, const std::string &value="") |
| void | addOption (const std::string &label, const std::string &value="", const SelectOptionStyle &style={}) |
| SelectTheme & | 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 | clearOptions () |
| void | clearSelection () |
| void | close () |
| sf::Color | getArrowColor () const |
| sf::Color | getBgDisabled () const |
| sf::Color | getBgFocused () const |
| sf::Color | getBgHovered () const |
| sf::Color | getBgIdle () const |
| sf::Color | getBgOpen () const |
| sf::Color | getBorderDisabled () const |
| sf::Color | getBorderError () const |
| sf::Color | getBorderFocused () const |
| sf::Color | getBorderIdle () const |
| sf::Color | getBorderOpen () const |
| float | getBorderThickness () const |
| unsigned int | getCharacterSize () const |
| unsigned int | getDescCharSize () const |
| sf::Color | getDisabledColor () const |
| sf::Color | getDisabledTextColor () 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 |
| sf::Color | getItemDescColor () const |
| sf::Color | getItemDisabledColor () const |
| float | getItemHeight () const |
| sf::Color | getItemHoverBg () const |
| sf::Color | getItemLabelColor () const |
| sf::Color | getItemSelectedBg () const |
| sf::Color | getLabelColor () const |
| sf::Color | getLabelDisabled () const |
| std::size_t | getMaxLength () const |
| float | getMaxVisibleItems () const |
| sf::Color | getMutedColor () const |
| sf::Color | getOutlineColor () const |
| float | getOutlineThickness () const |
| float | getPadding () const |
| sf::Color | getPanelBg () const |
| sf::Color | getPanelBorder () const |
| float | getPanelBorderThick () const |
| char32_t | getPasswordChar () const |
| std::string | getPlaceholder () const |
| sf::Color | getPlaceholderColor () const |
| sf::Vector2f | getPosition () const override |
| float | getRadius () const |
| int | getSelectedIndex () const |
| std::string | getSelectedLabel () const |
| std::string | getSelectedValue () const |
| sf::Vector2f | getSize () const |
| sf::Color | getTextColor () const |
| bool | isEnabled () const |
| bool | isOpen () const |
| bool | isPasswordMode () 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. | |
| void | onSelectionChanged (std::function< void(const std::string &, std::size_t)> callback) |
| void | open () |
| std::size_t | optionCount () const |
| void | selectIndex (std::size_t index) |
| void | selectValue (const std::string &value) |
| void | setArrowColor (const sf::Color &c) |
| void | setBgDisabled (const sf::Color &c) |
| void | setBgFocused (const sf::Color &c) |
| void | setBgHovered (const sf::Color &c) |
| void | setBgIdle (const sf::Color &c) |
| void | setBgOpen (const sf::Color &c) |
| void | setBorderDisabled (const sf::Color &c) |
| void | setBorderError (const sf::Color &c) |
| void | setBorderFocused (const sf::Color &c) |
| void | setBorderIdle (const sf::Color &c) |
| void | setBorderOpen (const sf::Color &c) |
| void | setBorderThickness (float t) |
| void | setDescCharSize (unsigned int s) |
| void | setDisabledColor (const sf::Color &c) |
| void | setDisabledTextColor (const sf::Color &c) |
| void | setEnabled (bool enabled) |
| 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 | setItemDescColor (const sf::Color &c) |
| void | setItemDisabledColor (const sf::Color &c) |
| void | setItemHeight (float h) |
| void | setItemHoverBg (const sf::Color &c) |
| void | setItemLabelColor (const sf::Color &c) |
| void | setItemSelectedBg (const sf::Color &c) |
| void | setLabelColor (const sf::Color &c) |
| void | setLabelDisabled (const sf::Color &c) |
| void | setMaxLength (std::size_t n) |
| void | setMaxVisibleItems (float n) |
| void | setMutedColor (const sf::Color &c) |
| void | setOptionEnabled (std::size_t index, bool enabled) |
| void | setOutlineColor (const sf::Color &c) |
| void | setOutlineThickness (float t) |
| void | setPadding (float p) |
| void | setPanelBg (const sf::Color &c) |
| void | setPanelBorder (const sf::Color &c) |
| void | setPanelBorderThick (float t) |
| void | setPasswordChar (char32_t c) |
| void | setPasswordMode (bool b) |
| void | setPlaceholder (const std::string &text) |
| void | setPlaceholderColor (const sf::Color &c) |
| void | setPosition (const sf::Vector2f &position) override |
| void | setRadius (float r) |
| void | setSize (const sf::Vector2f &s) |
| void | setTextColor (const sf::Color &c) |
| 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 dropdown select control with rich per-item content.
Inherits SelectSettings (geometry/behaviour) and SelectTheme (colors/font) as first-class members.
| using ml::Select::Flag = SelectManifest::Flag |
|
explicit |
| void ml::Select::add | ( | ml::Core & | component, |
| const std::string & | value = "" ) |
| void ml::Select::addOption | ( | const std::string & | label, |
| const std::string & | value = "", | ||
| const SelectOptionStyle & | style = {} ) |
|
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::InputTheme.
Definition at line 46 of file SelectTheme.h.
|
inline |
|
inline |
|
inline |
| void ml::Select::clearOptions | ( | ) |
| void ml::Select::clearSelection | ( | ) |
| void ml::Select::close | ( | ) |
|
overrideprotected |
|
inlinenodiscardinherited |
Definition at line 92 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 68 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 67 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 87 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 66 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 88 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 72 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 71 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 70 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 69 of file InputTheme.h.
|
inlinenodiscardinherited |
Definition at line 89 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 74 of file InputTheme.h.
|
nodiscard |
|
inlinenodiscardinherited |
Definition at line 45 of file SelectSettings.h.
|
inlinenodiscardinherited |
Definition at line 75 of file ControlTheme.h.
|
inlinenodiscardinherited |
Definition at line 76 of file ControlTheme.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 108 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 109 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 43 of file SelectSettings.h.
|
inlinenodiscardinherited |
Definition at line 105 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 107 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 106 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 90 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 91 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 44 of file InputSettings.h.
|
inlinenodiscardinherited |
Definition at line 44 of file SelectSettings.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.
|
inlinenodiscardinherited |
Definition at line 103 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 104 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 110 of file SelectTheme.h.
|
inlinenodiscardinherited |
Definition at line 46 of file InputSettings.h.
|
nodiscard |
|
inlinenodiscardinherited |
Definition at line 73 of file InputTheme.h.
|
override |
|
inlinenodiscardinherited |
Definition at line 70 of file GraphicTheme.h.
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
inlinenodiscardinherited |
Definition at line 43 of file InputSettings.h.
|
inlinenodiscardinherited |
Definition at line 77 of file ControlTheme.h.
|
nodiscard |
|
nodiscard |
|
inlinenodiscardinherited |
Definition at line 45 of file InputSettings.h.
|
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::Select::onSelectionChanged | ( | std::function< void(const std::string &, std::size_t)> | callback | ) |
|
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::Select::open | ( | ) |
|
nodiscard |
| void ml::Select::selectIndex | ( | std::size_t | index | ) |
| void ml::Select::selectValue | ( | const std::string & | value | ) |
|
inlineinherited |
Definition at line 99 of file SelectTheme.h.
|
inlineinherited |
Definition at line 78 of file InputTheme.h.
|
inlineinherited |
Definition at line 77 of file InputTheme.h.
|
inlineinherited |
Definition at line 94 of file SelectTheme.h.
|
inlineinherited |
Definition at line 76 of file InputTheme.h.
|
inlineinherited |
Definition at line 95 of file SelectTheme.h.
|
inlineinherited |
Definition at line 82 of file InputTheme.h.
|
inlineinherited |
Definition at line 81 of file InputTheme.h.
|
inlineinherited |
Definition at line 80 of file InputTheme.h.
|
inlineinherited |
Definition at line 79 of file InputTheme.h.
|
inlineinherited |
Definition at line 96 of file SelectTheme.h.
|
inlineinherited |
Definition at line 84 of file InputTheme.h.
|
inlineinherited |
Definition at line 49 of file SelectSettings.h.
|
inlineinherited |
Definition at line 87 of file ControlTheme.h.
|
inlineinherited |
Definition at line 88 of file ControlTheme.h.
| void ml::Select::setEnabled | ( | bool | enabled | ) |
|
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.
|
delete |
| void ml::Select::setFont | ( | const sf::Font & | f | ) |
|
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 117 of file SelectTheme.h.
|
inlineinherited |
Definition at line 118 of file SelectTheme.h.
|
inlineinherited |
Definition at line 47 of file SelectSettings.h.
|
inlineinherited |
Definition at line 114 of file SelectTheme.h.
|
inlineinherited |
Definition at line 116 of file SelectTheme.h.
|
inlineinherited |
Definition at line 115 of file SelectTheme.h.
|
inlineinherited |
Definition at line 97 of file SelectTheme.h.
|
inlineinherited |
Definition at line 98 of file SelectTheme.h.
|
inlineinherited |
Definition at line 49 of file InputSettings.h.
|
inlineinherited |
Definition at line 48 of file SelectSettings.h.
|
inlineinherited |
Definition at line 90 of file ControlTheme.h.
| void ml::Select::setOptionEnabled | ( | std::size_t | index, |
| bool | enabled ) |
|
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.
|
inlineinherited |
Definition at line 112 of file SelectTheme.h.
|
inlineinherited |
Definition at line 113 of file SelectTheme.h.
|
inlineinherited |
Definition at line 119 of file SelectTheme.h.
|
inlineinherited |
Definition at line 51 of file InputSettings.h.
|
inlineinherited |
Definition at line 50 of file InputSettings.h.
| void ml::Select::setPlaceholder | ( | const std::string & | text | ) |
|
inlineinherited |
Definition at line 83 of file InputTheme.h.
|
override |
|
inlineinherited |
Definition at line 75 of file GraphicTheme.h.
|
inlineinherited |
Definition at line 48 of file InputSettings.h.
|
inlineinherited |
Definition at line 89 of file ControlTheme.h.
|
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 32 of file SelectTheme.h.
Definition at line 28 of file InputTheme.h.
Definition at line 27 of file InputTheme.h.
Definition at line 27 of file SelectTheme.h.
Definition at line 26 of file InputTheme.h.
Definition at line 28 of file SelectTheme.h.
Definition at line 32 of file InputTheme.h.
Definition at line 31 of file InputTheme.h.
Definition at line 30 of file InputTheme.h.
Definition at line 29 of file InputTheme.h.
Definition at line 29 of file SelectTheme.h.
|
inherited |
Definition at line 34 of file InputTheme.h.
|
inherited |
Definition at line 28 of file SelectSettings.h.
Definition at line 33 of file ControlTheme.h.
Definition at line 34 of file ControlTheme.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.
Definition at line 40 of file SelectTheme.h.
Definition at line 41 of file SelectTheme.h.
|
inherited |
Definition at line 26 of file SelectSettings.h.
Definition at line 37 of file SelectTheme.h.
|
inherited |
Definition at line 39 of file SelectTheme.h.
Definition at line 38 of file SelectTheme.h.
|
inherited |
Definition at line 30 of file SelectTheme.h.
Definition at line 31 of file SelectTheme.h.
|
inherited |
0 = unlimited
Definition at line 29 of file InputSettings.h.
|
inherited |
Definition at line 27 of file SelectSettings.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.
Definition at line 35 of file SelectTheme.h.
Definition at line 36 of file SelectTheme.h.
|
inherited |
Definition at line 42 of file SelectTheme.h.
|
inherited |
Bullet •
Definition at line 31 of file InputSettings.h.
|
inherited |
Definition at line 30 of file InputSettings.h.
Definition at line 33 of file InputTheme.h.
|
inherited |
Definition at line 46 of file GraphicTheme.h.
|
inherited |
Definition at line 28 of file InputSettings.h.
|
inherited |
Definition at line 35 of file ControlTheme.h.