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

Volatile widget. More...

Inheritance diagram for stmg::VolatileWidget:
Inheritance graph
[legend]

Classes

struct  Init
 
struct  LocalInit
 
struct  ValueImg
 

Public Member Functions

int32_t getCurrentImgId () const noexcept
 The current image id according to the variable's value. More...
 
const shared_ptr< GameWidget > & getChildWidget () const noexcept
 The child widget. More...
 
bool isChanged () const noexcept
 Whether the variable's value has changed. More...
 
 VolatileWidget (Init &&oInit) noexcept
 Constructor. More...
 
void dump (int32_t nIndentSpaces, bool bHeader) const noexcept override
 Writes object contents to std::cout. More...
 
- Public Member Functions inherited from stmg::ContainerWidget
const std::vector< shared_ptr< GameWidget > > & getChildren () const noexcept
 The children widgets of the container. More...
 
virtual ~ContainerWidget () noexcept
 
- Public Member Functions inherited from stmg::GameWidget
virtual ~GameWidget () noexcept=default
 
int32_t getViewWidgetNameIdx () const noexcept
 The type (name) that might be used to choose a ThemeWidget. More...
 
const std::string & getName () const noexcept
 The name of the widget. More...
 
int32_t getTeam () const noexcept
 The team the widget is assigned to. More...
 
int32_t getMate () const noexcept
 The mate the widget is assigned to. More...
 
WidgetAxisFit getWidgetHorizAxisFit (int32_t nLayoutConfig) const noexcept
 Widget alignment and expansion for the x axis. More...
 
WidgetAxisFit getWidgetVertAxisFit (int32_t nLayoutConfig) const noexcept
 Widget alignment and expansion for the y axis. More...
 
bool isAssignedToHuman () const noexcept
 Tells whether the widget is assigned to a human. More...
 
ContainerWidgetgetContainer () const noexcept
 The container to which this widget was added to. More...
 
void dump (int32_t nIndentSpaces) const noexcept
 Writes object contents to std::cout (header included). More...
 
void dump () const noexcept
 Writes object contents to std::cout (header included). More...
 

Protected Member Functions

void reInit (Init &&oInit) noexcept
 Reinitialization. More...
 
void onAddedToGame () noexcept override
 Signals widget was added to game. More...
 
- Protected Member Functions inherited from stmg::ContainerWidget
 ContainerWidget (Init &&oData) noexcept
 Constructor. More...
 
void reInit (Init &&oData) noexcept
 Reinitialization. More...
 
- Protected Member Functions inherited from stmg::GameWidget
 GameWidget (Init &&oData) noexcept
 Constructor. More...
 
void reInit (Init &&oData) noexcept
 Reinitialization. More...
 
Layoutlayout () noexcept
 The layout the widget belongs to. More...
 
const Layoutlayout () const noexcept
 The layout the widget belongs to. More...
 
GameProxygame () noexcept
 The game the widget belongs to. More...
 
const GameProxygame () const noexcept
 The game the widget belongs to. More...
 
virtual void onAddedToLayout () noexcept
 Signals widget was added to layout. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from stmg::ContainerWidget
static bool getChildExpand (const std::vector< shared_ptr< GameWidget > > &aChildWidgets, int32_t nLayoutConfig, bool bHoriz) noexcept
 Tells whether any of a vector of game widgets expands. More...
 
static bool getChildFill (const std::vector< shared_ptr< GameWidget > > &aChildWidgets, int32_t nLayoutConfig, bool bHoriz) noexcept
 Tells whether any of a vector of game widgets fills. More...
 

Detailed Description

Volatile widget.

A container that changes appearance depending on a variable. It holds a child widget.

Constructor & Destructor Documentation

◆ VolatileWidget()

stmg::VolatileWidget::VolatileWidget ( Init &&  oInit)
inlineexplicitnoexcept

Constructor.

The single child cannot be null and cannot be added to multiple containers.

Parameters
oInitThe initialization data.

Member Function Documentation

◆ dump()

void stmg::VolatileWidget::dump ( int32_t  nIndentSpaces,
bool  bHeader 
) const
overridevirtualnoexcept

Writes object contents to std::cout.

Should only do it in debug mode. The function is also exposed in release mode because it is virtual.

If bHeader is true this function should also output the type of the object and its address.

Parameters
nIndentSpacesNumber of spaces put in front of each output line.
bHeaderWhether the header of the object should be displayed.

Reimplemented from stmg::ContainerWidget.

◆ getChildWidget()

const shared_ptr<GameWidget>& stmg::VolatileWidget::getChildWidget ( ) const
inlinenoexcept

The child widget.

Returns
The widget. Is not null.

◆ getCurrentImgId()

int32_t stmg::VolatileWidget::getCurrentImgId ( ) const
noexcept

The current image id according to the variable's value.

Returns
The image id or -1 if no image is selected by variable.

◆ isChanged()

bool stmg::VolatileWidget::isChanged ( ) const
noexcept

Whether the variable's value has changed.

If reInit() is called the change is not detected.

◆ onAddedToGame()

void stmg::VolatileWidget::onAddedToGame ( )
overrideprotectedvirtualnoexcept

Signals widget was added to game.

This happens after onAddedToLayout().

Reimplemented from stmg::GameWidget.

◆ reInit()

void stmg::VolatileWidget::reInit ( Init &&  oInit)
inlineprotectednoexcept

Reinitialization.

The single child cannot be null and cannot be added to multiple containers.

Parameters
oInitThe initialization data.