Gamedev Framework (gf)  0.12.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::WidgetContainer Class Reference

A collection of widgets. More...

#include <gf/WidgetContainer.h>

Public Member Functions

 WidgetContainer ()
 Construct a widget wontainer with a given view. More...
 
void render (RenderTarget &target, const RenderStates &states=RenderStates())
 Render the widgets on the target. More...
 
void pointTo (Vector2f coords)
 Check if the given coords are hover a widget and set it selected if so. More...
 
void addWidget (Widget &widget)
 Add a widget to the list of widgets. More...
 
WidgetremoveWidget (Widget *widget)
 Remove a widget from the list. More...
 
void triggerAction ()
 Trigger the callback of the current selected widget. More...
 
void selectNextWidget ()
 Select the next widget in the list as the current selected widget. More...
 
void selectPreviousWidget ()
 Select the previous widget in the list as the current selected widget. More...
 

Detailed Description

A collection of widgets.

See also
gf::Widget

Constructor & Destructor Documentation

◆ WidgetContainer()

gf::WidgetContainer::WidgetContainer ( )

Construct a widget wontainer with a given view.

Member Function Documentation

◆ addWidget()

void gf::WidgetContainer::addWidget ( Widget widget)

Add a widget to the list of widgets.

Parameters
widgetA widget to add to the list

◆ pointTo()

void gf::WidgetContainer::pointTo ( Vector2f  coords)

Check if the given coords are hover a widget and set it selected if so.

Parameters
coordsThe coords to check

◆ removeWidget()

Widget* gf::WidgetContainer::removeWidget ( Widget widget)

Remove a widget from the list.

Parameters
widgetThe widget to remove
Returns
The removed widget or nullptr if the widget was not present
See also
addWidget()

◆ render()

void gf::WidgetContainer::render ( RenderTarget target,
const RenderStates states = RenderStates() 
)

Render the widgets on the target.

Widgets are rendered by the order they appears on the list.

Parameters
targetThe render target
statesThe render states to use for drawing
See also
gf::Entity::render()

◆ selectNextWidget()

void gf::WidgetContainer::selectNextWidget ( )

Select the next widget in the list as the current selected widget.

◆ selectPreviousWidget()

void gf::WidgetContainer::selectPreviousWidget ( )

Select the previous widget in the list as the current selected widget.

◆ triggerAction()

void gf::WidgetContainer::triggerAction ( )

Trigger the callback of the current selected widget.