#include <Malena/Graphics/Controls/TabbedPanel.h>
Public Types | |
| using | Flag = TabbedPanelManifest::Flag |
| using | manifest_type |
The manifest type, used by GatherFlags and GatherStates to locate this class's flag and state declarations. | |
| using | State = TabbedPanelManifest::State |
| using | TabPosition = TabbedPanelSettings::TabPosition |
Public Member Functions | |
| int | activeTab () const |
| Return the currently active tab index, or -1 if no tabs. | |
| template<typename T> | |
| T & | addTab (const std::string &label, std::unique_ptr< T > content, const sf::Texture *icon=nullptr, bool closeable=false) |
| Add a tab with owned content. | |
| TabbedPanelTheme & | 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) |
| sf::Vector2f | contentSize () const |
| Return the content area size. | |
| 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 | getMutedColor () const |
| sf::Color | getOutlineColor () const |
| float | getOutlineThickness () const |
| float | getPadding () const |
| sf::Vector2f | getPosition () const override |
| float | getRadius () const |
| sf::Vector2f | getSize () const |
| std::enable_if_t<!std::is_void_v< T >, T > | getState () const |
| Return the current state value. | |
| sf::Color | getTextColor () const |
| bool | isSettingsLocked () const |
Return true if applySettings() is currently blocked. | |
| std::enable_if_t<!std::is_void_v< T >, bool > | isState (T state) const |
Return true if currently in state. | |
| 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. | |
| std::enable_if_t<!std::is_void_v< T > > | onStateEnter (std::function< void(T)> callback) |
| Register a callback invoked after each state transition. | |
| std::enable_if_t<!std::is_void_v< T > > | onStateExit (std::function< void(T)> callback) |
| Register a callback invoked before each state transition. | |
| void | onTabChanged (std::function< void(std::size_t, const std::string &)> cb) |
| Fired when the active tab changes. | |
| void | onTabClosed (std::function< void(std::size_t, const std::string &)> cb) |
| Fired when a tab is closed via the × button. | |
| void | removeTab (std::size_t index) |
| Remove a tab by index. | |
| void | selectTab (std::size_t index) |
| Programmatically select a tab by index. | |
| void | setCloseable (bool b) |
| void | setDisabledColor (const sf::Color &c) |
| void | setDisabledTextColor (const sf::Color &c) |
| 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 | setIconSize (float s) |
| 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) |
| std::enable_if_t<!std::is_void_v< T > > | setState (T newState) |
| Transition to a new state. | |
| void | setTabHeight (float h) |
| void | setTabMaxWidth (float w) |
| void | setTabMinWidth (float w) |
| void | setTabPosition (TabPosition p) |
| void | setTextColor (const sf::Color &c) |
| TabbedPanel (const sf::Font &font=FontManager<>::getDefault()) | |
| TabbedPanel (const TabbedPanel &)=delete | |
| std::size_t | tabCount () const |
| Return the number of tabs. | |
| void | unlockSettings () |
Allow applySettings() to take effect again. | |
| void | unlockTheme () |
| Resume reacting to global theme changes. | |
Public Attributes | |
| bool | closeable = false |
| show × on all tabs by default | |
| sf::Color | closeColor = sf::Color(180, 80, 80) |
| float | closeSize = 14.f |
| × hit area | |
| sf::Color | contentBg = sf::Color(35, 35, 48) |
| sf::Color | contentBorder = sf::Color(60, 60, 80) |
| sf::Color | disabledColor = sf::Color(60, 60, 60) |
| sf::Color | disabledTextColor = sf::Color(120, 120, 120) |
| 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 | iconSize = 16.f |
| icon square size | |
| 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 |
| sf::Color | tabActiveBar = sf::Color(70, 130, 230) |
| accent line | |
| sf::Color | tabActiveBg = sf::Color(35, 35, 48) |
| sf::Color | tabActiveText = sf::Color(230, 230, 255) |
| sf::Color | tabBarBg = sf::Color(25, 25, 32) |
| float | tabBarThickness = 1.f |
| divider between bar and content | |
| float | tabHeight = 36.f |
| thickness of the tab strip | |
| sf::Color | tabHoverBg = sf::Color(255, 255, 255, 15) |
| sf::Color | tabIdleBg = sf::Color::Transparent |
| sf::Color | tabIdleText = sf::Color(160, 160, 180) |
| float | tabMaxWidth = 200.f |
| maximum tab label width | |
| float | tabMinWidth = 80.f |
| minimum tab label width | |
| TabPosition | tabPosition = TabPosition::TOP |
| 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. | |
Definition at line 266 of file TabbedPanel.h.
|
inherited |
Definition at line 84 of file TabbedPanel.h.
|
inherited |
The manifest type, used by GatherFlags and GatherStates to locate this class's flag and state declarations.
Definition at line 65 of file Customizable.h.
|
inherited |
Definition at line 85 of file TabbedPanel.h.
|
inherited |
Definition at line 86 of file TabbedPanel.h.
|
inlinenodiscardinherited |
Return the currently active tab index, or -1 if no tabs.
Definition at line 228 of file TabbedPanel.h.
|
inlineinherited |
Add a tab with owned content.
The panel takes ownership of content. It is responsible for drawing, resizing, and destroying it. If T has a setSize() method, the panel will call it automatically whenever the content area changes.
| T | Any ml::Core-derived type. |
| label | Tab label text. |
| content | Owned content component. |
| icon | Optional icon texture. Pass nullptr for none. |
| closeable | Whether this tab has a close button. |
Definition at line 187 of file TabbedPanel.h.
|
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::ControlTheme.
Definition at line 24 of file TabbedPanelTheme.h.
|
inlineinherited |
Definition at line 142 of file TabbedPanel.h.
|
inlineinherited |
Definition at line 159 of file TabbedPanel.h.
|
inlineinherited |
Definition at line 151 of file TabbedPanel.h.
|
nodiscardinherited |
Return the content area size.
Components with a setSize() method are resized automatically whenever the content area changes. Call this when you need to query the current bounds before constructing content:
|
overrideprotectedinherited |
|
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.
|
overrideinherited |
|
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.
|
overrideinherited |
|
inlinenodiscardinherited |
Definition at line 70 of file GraphicTheme.h.
|
inlinenodiscardinherited |
Definition at line 258 of file TabbedPanel.h.
|
inherited |
Return the current state value.
StateEnum value.
|
inlinenodiscardinherited |
Definition at line 77 of file ControlTheme.h.
|
inlinenodiscardinherited |
Return true if applySettings() is currently blocked.
Definition at line 115 of file Themeable.h.
|
inherited |
Return true if currently in state.
| state | The state value to compare against. |
true if the current state equals state.
|
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.
|
inherited |
Register a callback invoked after each state transition.
The callback receives the newly entered state. Only one enter callback is active at a time; calling this again replaces it.
| callback | Function called with the new state after each transition. |
|
inherited |
Register a callback invoked before each state transition.
The callback receives the state being left. Only one exit callback is active at a time; calling this again replaces it.
| callback | Function called with the old state before each transition. |
|
inherited |
Fired when the active tab changes.
|
inherited |
Fired when a tab is closed via the × button.
|
overrideprotectedvirtualinherited |
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.
|
inherited |
Remove a tab by index.
The content component is destroyed on the next update frame (deferred to avoid use-after-free during event dispatch). If the active tab is removed, the panel selects the nearest remaining tab.
|
inherited |
Programmatically select a tab by index.
|
inlineinherited |
Definition at line 32 of file TabbedPanelSettings.h.
|
inlineinherited |
Definition at line 87 of file ControlTheme.h.
|
inlineinherited |
Definition at line 88 of file ControlTheme.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 31 of file TabbedPanelSettings.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.
|
overrideinherited |
|
inlineinherited |
Definition at line 75 of file GraphicTheme.h.
|
inherited |
|
inherited |
Transition to a new state.
Fires the exit callback with the current state, updates the stored state to newState, then fires the enter callback with the new state. Either callback may be unset (nullptr), in which case it is skipped.
| newState | The state to transition into. |
|
inlineinherited |
Definition at line 28 of file TabbedPanelSettings.h.
|
inlineinherited |
Definition at line 30 of file TabbedPanelSettings.h.
|
inlineinherited |
Definition at line 29 of file TabbedPanelSettings.h.
|
inlineinherited |
Definition at line 27 of file TabbedPanelSettings.h.
|
inlineinherited |
Definition at line 89 of file ControlTheme.h.
|
explicit |
|
delete |
|
inlinenodiscardinherited |
Return the number of tabs.
Definition at line 231 of file TabbedPanel.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.
|
inherited |
show × on all tabs by default
Definition at line 19 of file TabbedPanelSettings.h.
Definition at line 21 of file TabbedPanelTheme.h.
|
inherited |
× hit area
Definition at line 20 of file TabbedPanelSettings.h.
Definition at line 19 of file TabbedPanelTheme.h.
Definition at line 20 of file TabbedPanelTheme.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.
|
inherited |
icon square size
Definition at line 18 of file TabbedPanelSettings.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.
accent line
Definition at line 16 of file TabbedPanelTheme.h.
Definition at line 15 of file TabbedPanelTheme.h.
Definition at line 18 of file TabbedPanelTheme.h.
Definition at line 12 of file TabbedPanelTheme.h.
|
inherited |
divider between bar and content
Definition at line 22 of file TabbedPanelTheme.h.
|
inherited |
thickness of the tab strip
Definition at line 15 of file TabbedPanelSettings.h.
Definition at line 14 of file TabbedPanelTheme.h.
|
inherited |
Definition at line 13 of file TabbedPanelTheme.h.
Definition at line 17 of file TabbedPanelTheme.h.
|
inherited |
maximum tab label width
Definition at line 17 of file TabbedPanelSettings.h.
|
inherited |
minimum tab label width
Definition at line 16 of file TabbedPanelSettings.h.
|
inherited |
Definition at line 14 of file TabbedPanelSettings.h.
|
inherited |
Definition at line 35 of file ControlTheme.h.