libsuit  0.1.1
SFML User Interface Toolkit
Public Member Functions | List of all members
ui::Widget Class Referenceabstract

An element of the graphical interface. More...

#include <ui/Widget.h>

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

Public Member Functions

 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...
 
Geometry
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...
 
Interactions
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 onClick (sf::Mouse::Button button, const sf::Vector2f &mouse)
 Do something when the widget is clicked. More...
 
Layout
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

An element of the graphical interface.

Constructor & Destructor Documentation

ui::Widget::Widget ( )
inline

Construct a widget.

ui::Widget::Widget ( const Widget )
delete
ui::Widget::Widget ( Widget &&  )
delete
virtual ui::Widget::~Widget ( )
virtual

Destroy a widget.

Member Function Documentation

virtual void ui::Widget::accept ( WidgetVisitor visitor)
pure virtual

Accept the visitor.

Parameters
visitorthe visitor.

Implemented in ui::Table, ui::Select, ui::Stack, ui::Area, ui::Form, ui::Button, ui::Bin, ui::Toggle, ui::Label, ui::HBox, and ui::VBox.

sf::Vector2f ui::Widget::getCenter ( ) const
inline

Get the center of the widget.

Returns
the center of the widget.
const sf::FloatRect ui::Widget::getGeometry ( ) const
inline

Get the geometry of the widget.

Returns
the rectangle describing the geometry.
const Geometry& ui::Widget::getHorizontalGeometry ( ) const
inline

Get the horizontal geometry.

Returns
the horizontal geometry.
Geometry& ui::Widget::getHorizontalGeometry ( )
inline

Get the horizontal geometry.

Returns
the horizontal geometry.
sf::Vector2f ui::Widget::getSizeHint ( ) const
inline

Get the size hint of the widget.

Returns
the desired size of the widget.
const Geometry& ui::Widget::getVerticalGeometry ( ) const
inline

Get the vertical geometry.

Returns
the vertical geometry.
Geometry& ui::Widget::getVerticalGeometry ( )
inline

Get the vertical geometry.

Returns
the vertical geometry.
virtual void ui::Widget::layoutAllocation ( )
pure virtual

Compute the size of the widget.

The computation of the size takes into account the size of the parent of the widget. This is a top-down process.

Implemented in ui::Leaf, ui::Table, ui::Stack, and ui::Bin.

virtual void ui::Widget::layoutRequest ( )
pure virtual

Compute the size hint of the widget.

The computation of the size hint takes into account the size of the children of the widget. This is a bottom-up process.

Implemented in ui::Leaf, ui::Table, ui::Stack, and ui::Bin.

virtual void ui::Widget::onClick ( sf::Mouse::Button  button,
const sf::Vector2f &  mouse 
)
virtual

Do something when the widget is clicked.

Reimplemented in ui::Container, ui::Select, ui::Stack, ui::Button, ui::Bin, and ui::Toggle.

virtual void ui::Widget::onPrimaryAction ( )
virtual

Do something if a primary action has been triggered.

Reimplemented in ui::Select, ui::Area, ui::Toggle, ui::Button, and ui::Bin.

virtual void ui::Widget::onSecondaryAction ( )
virtual

Do something if a secondary action has been triggered.

Reimplemented in ui::Select, ui::Area, and ui::Bin.

Widget& ui::Widget::operator= ( const Widget )
delete
Widget& ui::Widget::operator= ( Widget &&  )
delete
void ui::Widget::setGeometry ( const sf::FloatRect &  geometry)
inline

Set the vertical geometry thanks to a rectangle.

Parameters
geometrythe rectangle describing the geometry.
void ui::Widget::setHorizontalAlignment ( Alignment  alignment)
inline

Set the horizontal alignment policy.

Parameters
alignmentthe alignment policy.
void ui::Widget::setHorizontalPolicy ( SizePolicy  policy)
inline

Set the horizontal size policy.

Parameters
policythe size policy.
void ui::Widget::setSizeHint ( float  width,
float  height 
)
inline

Set the size hint of the widget.

Parameters
widththe desired width
heightthe desired height
void ui::Widget::setSizePolicy ( SizePolicy  horizontal,
SizePolicy  vertical 
)
inline

Set the size policy.

Parameters
horizontalthe horizontal size policy.
verticalthe vertical size policy.
void ui::Widget::setVerticalAlignment ( Alignment  alignment)
inline

Set the vertical alignment policy.

Parameters
alignmentthe alignment policy.
void ui::Widget::setVerticalPolicy ( SizePolicy  policy)
inline

Set the vertical size policy.

Parameters
policythe size policy.