libsuit  0.1.1
SFML User Interface Toolkit
Public Types | Public Member Functions | List of all members
ui::Container Class Reference

A widget that contains several other widgets. More...

#include <ui/Container.h>

Inheritance diagram for ui::Container:
Inheritance graph
[legend]

Public Types

typedef std::vector< Widget * >
::size_type 
size_type
 
typedef std::vector< Widget * >
::iterator 
iterator
 

Public Member Functions

virtual ~Container ()
 Destroy the container. More...
 
bool hasChildren () const
 Tell whether the container has children. More...
 
void addChild (Widget *widget)
 Add a child to the container. More...
 
size_type getChildrenCount () const
 Get the number of children of the container. More...
 
WidgetithChild (size_type i)
 Return the ith child of the container. More...
 
iterator begin ()
 Get the beginning of the container. More...
 
iterator end ()
 Get the end of the container. More...
 
virtual void onClick (sf::Mouse::Button button, const sf::Vector2f &mouse) override
 Do something when the widget is clicked. More...
 
- Public Member Functions inherited from ui::Widget
 Widget ()
 Construct a widget. More...
 
 Widget (const Widget &)=delete
 
Widgetoperator= (const Widget &)=delete
 
 Widget (Widget &&)=delete
 
Widgetoperator= (Widget &&)=delete
 
virtual ~Widget ()
 Destroy a widget. More...
 
virtual void accept (WidgetVisitor &visitor)=0
 Accept the visitor. More...
 
void setSizeHint (float width, float height)
 Set the size hint of the widget. More...
 
sf::Vector2f getSizeHint () const
 Get the size hint of the widget. More...
 
void setHorizontalPolicy (SizePolicy policy)
 Set the horizontal size policy. More...
 
void setVerticalPolicy (SizePolicy policy)
 Set the vertical size policy. More...
 
void setSizePolicy (SizePolicy horizontal, SizePolicy vertical)
 Set the size policy. More...
 
void setHorizontalAlignment (Alignment alignment)
 Set the horizontal alignment policy. More...
 
void setVerticalAlignment (Alignment alignment)
 Set the vertical alignment policy. More...
 
const GeometrygetHorizontalGeometry () const
 Get the horizontal geometry. More...
 
GeometrygetHorizontalGeometry ()
 Get the horizontal geometry. More...
 
const GeometrygetVerticalGeometry () const
 Get the vertical geometry. More...
 
GeometrygetVerticalGeometry ()
 Get the vertical geometry. More...
 
void setGeometry (const sf::FloatRect &geometry)
 Set the vertical geometry thanks to a rectangle. More...
 
const sf::FloatRect getGeometry () const
 Get the geometry of the widget. More...
 
sf::Vector2f getCenter () const
 Get the center of the widget. More...
 
virtual void onPrimaryAction ()
 Do something if a primary action has been triggered. More...
 
virtual void onSecondaryAction ()
 Do something if a secondary action has been triggered. More...
 
virtual void layoutRequest ()=0
 Compute the size hint of the widget. More...
 
virtual void layoutAllocation ()=0
 Compute the size of the widget. More...
 

Detailed Description

A widget that contains several other widgets.

Member Typedef Documentation

typedef std::vector<Widget *>::iterator ui::Container::iterator
typedef std::vector<Widget *>::size_type ui::Container::size_type

Constructor & Destructor Documentation

virtual ui::Container::~Container ( )
virtual

Destroy the container.

Member Function Documentation

void ui::Container::addChild ( Widget widget)
inline

Add a child to the container.

Parameters
widgetthe new child to add.
iterator ui::Container::begin ( )
inline

Get the beginning of the container.

Returns
an iterator on the beginning of the container.
iterator ui::Container::end ( )
inline

Get the end of the container.

Returns
an iterator on the end of the container.
size_type ui::Container::getChildrenCount ( ) const
inline

Get the number of children of the container.

Returns
the number of children of the container.
bool ui::Container::hasChildren ( ) const
inline

Tell whether the container has children.

Returns
true if the container has children.
Widget* ui::Container::ithChild ( size_type  i)
inline

Return the ith child of the container.

Parameters
ithe child number (starting from 0).
Returns
the ith child of the container.
virtual void ui::Container::onClick ( sf::Mouse::Button  button,
const sf::Vector2f &  mouse 
)
overridevirtual

Do something when the widget is clicked.

Reimplemented from ui::Widget.