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

Widget sized relative to a reference widget of the same layout. More...

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

Classes

struct  Init
 
struct  LocalInit
 The data to initialize a RelSizedGameWidget. More...
 

Public Member Functions

double getReferenceWFactor () const noexcept
 The width size factor to the reference widget. More...
 
double getReferenceHFactor () const noexcept
 The height size factor to the reference widget. More...
 
double getWHRatio () const noexcept
 The width to height ratio. More...
 
void dump (int32_t nIndentSpaces, bool bHeader) const noexcept override
 Writes object contents to std::cout. More...
 
- 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

 RelSizedGameWidget (Init &&oInit) noexcept
 Constructor. More...
 
void reInit (Init &&oInit) 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...
 
virtual void onAddedToGame () noexcept
 Signals widget was added to game. More...
 

Detailed Description

Widget sized relative to a reference widget of the same layout.

Constructor & Destructor Documentation

◆ RelSizedGameWidget()

stmg::RelSizedGameWidget::RelSizedGameWidget ( Init &&  oInit)
inlineexplicitprotectednoexcept

Constructor.

Parameters
oInitThe initialization data.

Member Function Documentation

◆ dump()

void stmg::RelSizedGameWidget::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::GameWidget.

Reimplemented in stmg::VarWidget, stmg::ProgressWidget, stmg::PreviewWidget, stmg::ActionWidget, and stmg::TransparentWidget.

◆ getReferenceHFactor()

double stmg::RelSizedGameWidget::getReferenceHFactor ( ) const
inlinenoexcept

The height size factor to the reference widget.

Returns
The reference height factor or -1.0 if not defined.

◆ getReferenceWFactor()

double stmg::RelSizedGameWidget::getReferenceWFactor ( ) const
inlinenoexcept

The width size factor to the reference widget.

Example: if it is 0.5 this widget will have (if not expanded) about half the width of the reference widget.

Returns
The reference width factor or -1.0 if not defined.

◆ getWHRatio()

double stmg::RelSizedGameWidget::getWHRatio ( ) const
inlinenoexcept

The width to height ratio.

If this value is > 0.0 then either width or height factor are undefined.

Returns
The width to height ratio or -1.0 if not defined.

◆ reInit()

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

Reinitialization.

Parameters
oInitThe initialization data.