stmm-games-doc  0.32.0
Public Member Functions | Protected Member Functions | List of all members
stmg::Layout Class Reference

Public Member Functions

 Layout (const shared_ptr< GameWidget > &refRootGW, const shared_ptr< LevelShowWidget > &refReferenceLevelShow, bool bAllTeamsInOneLevel, bool bSubshows, const shared_ptr< AppPreferences > &refPrefs) noexcept
 Layout constructor. More...
 
const shared_ptr< GameWidget > & getRoot () const noexcept
 Get the root widget. More...
 
const shared_ptr< LevelShowWidget > & getReferenceShow () const noexcept
 The reference (sub)show used for layout calculations. More...
 
bool isAllTeamsInOneLevel () const noexcept
 
bool isSubshows () const noexcept
 Tells whether subshows or shows of the stage are shown. More...
 
bool isValid () const noexcept
 Tells whether the layout is valid. More...
 
const std::string & getErrorString () const noexcept
 The error string for an invalid layout. More...
 
const shared_ptr< GameWidget > & getWidgetNamed (const std::string &sName, int32_t nTeam, int32_t nMate) const noexcept
 Find a named widget. More...
 
const shared_ptr< AppPreferences > & getPrefs () noexcept
 The preferences. More...
 
void dump (int32_t nIndentSpaces) const noexcept
 
void dump () const noexcept
 

Protected Member Functions

void reInit (const shared_ptr< GameWidget > &refRootGW, const shared_ptr< LevelShowWidget > &refReferenceLevelShow, bool bAllTeamsInOneLevel, bool bSubshows, const shared_ptr< AppPreferences > &refPrefs) noexcept
 Initialization. More...
 

Constructor & Destructor Documentation

◆ Layout()

stmg::Layout::Layout ( const shared_ptr< GameWidget > &  refRootGW,
const shared_ptr< LevelShowWidget > &  refReferenceLevelShow,
bool  bAllTeamsInOneLevel,
bool  bSubshows,
const shared_ptr< AppPreferences > &  refPrefs 
)
noexcept

Layout constructor.

If parameter refReferenceLevelShow is null, the first LevelShowWidget found in the refRootGW tree is used. If it is not null it must be in the refRootGW tree.

If bSubshows is false then the stage(s) is shown.

Parameters
refRootGWThe root widget. Cannot be null.
refReferenceLevelShowThe reference level show. Can be null.
bAllTeamsInOneLevelWhether all teams play on same stage.
bSubshowsWhether player's subshow is shown.
refPrefsThe app preferences. Cannot be null.

Member Function Documentation

◆ dump() [1/2]

void stmg::Layout::dump ( int32_t  nIndentSpaces) const
noexcept

◆ dump() [2/2]

void stmg::Layout::dump ( ) const
inlinenoexcept

◆ getErrorString()

const std::string& stmg::Layout::getErrorString ( ) const
inlinenoexcept

The error string for an invalid layout.

Returns
The error string. Empty if valid layout.

◆ getPrefs()

const shared_ptr<AppPreferences>& stmg::Layout::getPrefs ( )
inlinenoexcept

The preferences.

Returns
The preferences. Cannot be null;

◆ getReferenceShow()

const shared_ptr<LevelShowWidget>& stmg::Layout::getReferenceShow ( ) const
inlinenoexcept

The reference (sub)show used for layout calculations.

All sizes of widgets in the layout are factors of the size of this widget.

Returns
Cannot be null.

◆ getRoot()

const shared_ptr<GameWidget>& stmg::Layout::getRoot ( ) const
inlinenoexcept

Get the root widget.

Returns
The root widget. Cannot be null.

◆ getWidgetNamed()

const shared_ptr<GameWidget>& stmg::Layout::getWidgetNamed ( const std::string &  sName,
int32_t  nTeam,
int32_t  nMate 
) const
noexcept

Find a named widget.

Parameters
sNameThe name of the widget.
nTeamThe team of the widget. Is -1 if game widget.
nMateThe mate of the widget. Is -1 if game or team widget.
Returns
The widget. Null if none defined with given name.

◆ isAllTeamsInOneLevel()

bool stmg::Layout::isAllTeamsInOneLevel ( ) const
inlinenoexcept

◆ isSubshows()

bool stmg::Layout::isSubshows ( ) const
inlinenoexcept

Tells whether subshows or shows of the stage are shown.

Returns
Whether LevelShowWidgets in layout are all subshows.

◆ isValid()

bool stmg::Layout::isValid ( ) const
inlinenoexcept

Tells whether the layout is valid.

◆ reInit()

void stmg::Layout::reInit ( const shared_ptr< GameWidget > &  refRootGW,
const shared_ptr< LevelShowWidget > &  refReferenceLevelShow,
bool  bAllTeamsInOneLevel,
bool  bSubshows,
const shared_ptr< AppPreferences > &  refPrefs 
)
protectednoexcept

Initialization.

Subclass this class and make this public for recycling of objects.

Parameters
refRootGWThe root widget. Cannot be null.
refReferenceLevelShowThe reference level show. Can be null.
bAllTeamsInOneLevelWhether all teams play on same stage.
bSubshowsWhether player's subshow is shown.
refPrefsThe app preferences. Cannot be null.