Loading...
Searching...
No Matches
ml::ToggleGroupWith< MANIFEST > Class Template Reference

#include <Malena/Graphics/Controls/ToggleGroup.h>

Inheritance diagram for ml::ToggleGroupWith< MANIFEST >:
[legend]

Public Types

using Flag = ToggleGroupManifest::Flag
using manifest_type
 The manifest type, used by GatherFlags and GatherStates to locate this class's flag and state declarations.
using State = ToggleGroupManifest::State

Public Member Functions

void add (ButtonToggle &toggle, const std::string &key)
void add (PillToggle &toggle, const std::string &key)
void add (SegmentToggle &toggle, const std::string &key)
ButtonToggleaddButtonToggle (const std::string &label, const std::string &key, bool on=false)
 Create and add a new ButtonToggle.
SegmentToggleaddSegmentToggle (const std::string &offLabel, const std::string &onLabel, const std::string &key, bool on=false)
 Create and add a new SegmentToggle.
PillToggleaddToggle (const std::string &label, const std::string &key, bool on=false)
 Create and add a new PillToggle with a right label.
void applySettingsToAll (const ButtonSettings &s)
void applySettingsToAll (const PillSettings &s)
void applySettingsToAll (const SegmentSettings &s)
void applyStyleToAll (const ButtonStyle &s)
void applyStyleToAll (const PillStyle &s)
void applyStyleToAll (const SegmentStyle &s)
void applyThemeToAll (const ButtonTheme &t)
void applyThemeToAll (const PillTheme &t)
void applyThemeToAll (const SegmentTheme &t)
void clearToggles ()
sf::FloatRect getGlobalBounds () const override
std::vector< std::string > getOnKeys () const
sf::Vector2f getPosition () const override
std::enable_if_t<!std::is_void_v< T >, T > getState () const
 Return the current state value.
std::enable_if_t<!std::is_void_v< T >, T > getState () const
 Return the current state value.
bool isOn (const std::string &key) const
std::enable_if_t<!std::is_void_v< T >, bool > isState (T state) const
 Return true if currently in state.
std::enable_if_t<!std::is_void_v< T >, bool > isState (T state) const
 Return true if currently in state.
void onAnyToggled (std::function< void(const std::string &, bool)> callback)
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 > > 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.
std::enable_if_t<!std::is_void_v< T > > onStateExit (std::function< void(T)> callback)
 Register a callback invoked before each state transition.
void setAllOff ()
void setAllOn ()
void setCharacterSize (unsigned int size)
 Set character size on the default pill theme and all owned pills.
void setDefaultSettings (const ButtonSettings &s)
void setDefaultSettings (const PillSettings &s)
 Set the default settings applied to new owned PillToggles.
void setDefaultSettings (const SegmentSettings &s)
void setDefaultStyle (const ButtonStyle &s)
void setDefaultStyle (const PillStyle &s)
 Set default settings and theme together.
void setDefaultStyle (const SegmentStyle &s)
void setDefaultTheme (const ButtonTheme &t)
void setDefaultTheme (const PillTheme &t)
 Set the default theme applied to new owned PillToggles.
void setDefaultTheme (const SegmentTheme &t)
void setFont (const sf::Font &&)=delete
void setFont (const sf::Font &font)
 Set font on the default pill theme and all owned pills.
void setOn (const std::string &key, bool on)
void setPosition (const sf::Vector2f &position) override
void setSpacing (float spacing)
std::enable_if_t<!std::is_void_v< T > > setState (T newState)
 Transition to a new state.
std::enable_if_t<!std::is_void_v< T > > setState (T newState)
 Transition to a new state.
 ToggleGroup ()
 ToggleGroup (const ToggleGroup &)=delete

Protected Member Functions

void draw (sf::RenderTarget &target, sf::RenderStates states) const override

Detailed Description

template<typename MANIFEST>
class ml::ToggleGroupWith< MANIFEST >

Definition at line 216 of file ToggleGroup.h.

Member Typedef Documentation

◆ Flag

Definition at line 63 of file ToggleGroup.h.

◆ manifest_type

using ml::Customizable< MANIFEST >::manifest_type
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.

◆ State

Definition at line 64 of file ToggleGroup.h.

Member Function Documentation

◆ add() [1/3]

void ml::ToggleGroup::add ( ButtonToggle & toggle,
const std::string & key )
inherited

◆ add() [2/3]

void ml::ToggleGroup::add ( PillToggle & toggle,
const std::string & key )
inherited

◆ add() [3/3]

void ml::ToggleGroup::add ( SegmentToggle & toggle,
const std::string & key )
inherited

◆ addButtonToggle()

ButtonToggle & ml::ToggleGroup::addButtonToggle ( const std::string & label,
const std::string & key,
bool on = false )
inherited

Create and add a new ButtonToggle.

Returns
Reference to the created toggle.

◆ addSegmentToggle()

SegmentToggle & ml::ToggleGroup::addSegmentToggle ( const std::string & offLabel,
const std::string & onLabel,
const std::string & key,
bool on = false )
inherited

Create and add a new SegmentToggle.

Returns
Reference to the created toggle.

◆ addToggle()

PillToggle & ml::ToggleGroup::addToggle ( const std::string & label,
const std::string & key,
bool on = false )
inherited

Create and add a new PillToggle with a right label.

Inherits the current default PillSettings and PillTheme.

Returns
Reference to the created toggle for further customisation.

◆ applySettingsToAll() [1/3]

void ml::ToggleGroup::applySettingsToAll ( const ButtonSettings & s)
inherited

◆ applySettingsToAll() [2/3]

void ml::ToggleGroup::applySettingsToAll ( const PillSettings & s)
inherited

◆ applySettingsToAll() [3/3]

void ml::ToggleGroup::applySettingsToAll ( const SegmentSettings & s)
inherited

◆ applyStyleToAll() [1/3]

void ml::ToggleGroup::applyStyleToAll ( const ButtonStyle & s)
inherited

◆ applyStyleToAll() [2/3]

void ml::ToggleGroup::applyStyleToAll ( const PillStyle & s)
inherited

◆ applyStyleToAll() [3/3]

void ml::ToggleGroup::applyStyleToAll ( const SegmentStyle & s)
inherited

◆ applyThemeToAll() [1/3]

void ml::ToggleGroup::applyThemeToAll ( const ButtonTheme & t)
inherited

◆ applyThemeToAll() [2/3]

void ml::ToggleGroup::applyThemeToAll ( const PillTheme & t)
inherited

◆ applyThemeToAll() [3/3]

void ml::ToggleGroup::applyThemeToAll ( const SegmentTheme & t)
inherited

◆ clearToggles()

void ml::ToggleGroup::clearToggles ( )
inherited

◆ draw()

void ml::ToggleGroup::draw ( sf::RenderTarget & target,
sf::RenderStates states ) const
overrideprotectedinherited

◆ getGlobalBounds()

sf::FloatRect ml::ToggleGroup::getGlobalBounds ( ) const
overrideinherited

◆ getOnKeys()

std::vector< std::string > ml::ToggleGroup::getOnKeys ( ) const
nodiscardinherited

◆ getPosition()

sf::Vector2f ml::ToggleGroup::getPosition ( ) const
overrideinherited

◆ getState() [1/2]

std::enable_if_t<!std::is_void_v< T >, T > ml::StateManager< extract_State< MANIFEST >::type >::getState ( ) const
inherited

Return the current state value.

Returns
The active StateEnum value.

◆ getState() [2/2]

std::enable_if_t<!std::is_void_v< T >, T > ml::StateManager< extract_State< MANIFEST >::type >::getState ( ) const
inherited

Return the current state value.

Returns
The active StateEnum value.

◆ isOn()

bool ml::ToggleGroup::isOn ( const std::string & key) const
nodiscardinherited

◆ isState() [1/2]

std::enable_if_t<!std::is_void_v< T >, bool > ml::StateManager< extract_State< MANIFEST >::type >::isState ( T state) const
inherited

Return true if currently in state.

Parameters
stateThe state value to compare against.
Returns
true if the current state equals state.

◆ isState() [2/2]

std::enable_if_t<!std::is_void_v< T >, bool > ml::StateManager< extract_State< MANIFEST >::type >::isState ( T state) const
inherited

Return true if currently in state.

Parameters
stateThe state value to compare against.
Returns
true if the current state equals state.

◆ onAnyToggled()

void ml::ToggleGroup::onAnyToggled ( std::function< void(const std::string &, bool)> callback)
inherited

◆ onStateEnter() [1/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::onStateEnter ( std::function< void(T)> callback)
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.

Parameters
callbackFunction called with the new state after each transition.

◆ onStateEnter() [2/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::onStateEnter ( std::function< void(T)> callback)
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.

Parameters
callbackFunction called with the new state after each transition.

◆ onStateExit() [1/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::onStateExit ( std::function< void(T)> callback)
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.

Parameters
callbackFunction called with the old state before each transition.

◆ onStateExit() [2/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::onStateExit ( std::function< void(T)> callback)
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.

Parameters
callbackFunction called with the old state before each transition.

◆ setAllOff()

void ml::ToggleGroup::setAllOff ( )
inherited

◆ setAllOn()

void ml::ToggleGroup::setAllOn ( )
inherited

◆ setCharacterSize()

void ml::ToggleGroup::setCharacterSize ( unsigned int size)
inherited

Set character size on the default pill theme and all owned pills.

◆ setDefaultSettings() [1/3]

void ml::ToggleGroup::setDefaultSettings ( const ButtonSettings & s)
inherited

◆ setDefaultSettings() [2/3]

void ml::ToggleGroup::setDefaultSettings ( const PillSettings & s)
inherited

Set the default settings applied to new owned PillToggles.

◆ setDefaultSettings() [3/3]

void ml::ToggleGroup::setDefaultSettings ( const SegmentSettings & s)
inherited

◆ setDefaultStyle() [1/3]

void ml::ToggleGroup::setDefaultStyle ( const ButtonStyle & s)
inherited

◆ setDefaultStyle() [2/3]

void ml::ToggleGroup::setDefaultStyle ( const PillStyle & s)
inherited

Set default settings and theme together.

◆ setDefaultStyle() [3/3]

void ml::ToggleGroup::setDefaultStyle ( const SegmentStyle & s)
inherited

◆ setDefaultTheme() [1/3]

void ml::ToggleGroup::setDefaultTheme ( const ButtonTheme & t)
inherited

◆ setDefaultTheme() [2/3]

void ml::ToggleGroup::setDefaultTheme ( const PillTheme & t)
inherited

Set the default theme applied to new owned PillToggles.

◆ setDefaultTheme() [3/3]

void ml::ToggleGroup::setDefaultTheme ( const SegmentTheme & t)
inherited

◆ setFont() [1/2]

void ml::ToggleGroup::setFont ( const sf::Font && )
deleteinherited

◆ setFont() [2/2]

void ml::ToggleGroup::setFont ( const sf::Font & font)
inherited

Set font on the default pill theme and all owned pills.

◆ setOn()

void ml::ToggleGroup::setOn ( const std::string & key,
bool on )
inherited

◆ setPosition()

void ml::ToggleGroup::setPosition ( const sf::Vector2f & position)
overrideinherited

◆ setSpacing()

void ml::ToggleGroup::setSpacing ( float spacing)
inherited

◆ setState() [1/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::setState ( T newState)
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.

Parameters
newStateThe state to transition into.

◆ setState() [2/2]

std::enable_if_t<!std::is_void_v< T > > ml::StateManager< extract_State< MANIFEST >::type >::setState ( T newState)
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.

Parameters
newStateThe state to transition into.

◆ ToggleGroup() [1/2]

template<typename MANIFEST>
ml::ToggleGroup::ToggleGroup ( )
explicit

◆ ToggleGroup() [2/2]

template<typename MANIFEST>
ml::ToggleGroup::ToggleGroup ( const ToggleGroup & )
delete

The documentation for this class was generated from the following file: