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

A form widget. More...

#include <ui/Form.h>

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

Public Member Functions

 Form ()
 Construct a form. More...
 
void addRow (Widget *left, Widget *right)
 Add a row to the form. More...
 
size_type getRowCount () const
 Get the number of rows. More...
 
std::pair< Widget *, Widget * > ithRow (size_type i)
 Get the ith row of the form. More...
 
virtual void accept (WidgetVisitor &visitor) override
 Accept the visitor. More...
 
- Public Member Functions inherited from ui::Table
 Table (size_type cols, size_type rows)
 Construct a table widget with a specified number of columns and rows. More...
 
size_type getColumnsCount () const
 Get the number of columns. More...
 
size_type getRowsCount () const
 Get the number of rows. More...
 
void setHorizontalGap (float gap)
 Set the horizontal gap between columns. More...
 
float getHorizontalGap () const
 Get the horizontal gap between columns. More...
 
void setVerticalGap (float gap)
 Set the vertical gap between rows. More...
 
float getVerticalGap () const
 Get the vertical gap between rows. More...
 
virtual void layoutRequest () override
 Compute the size hint of the widget. More...
 
virtual void layoutAllocation () override
 Compute the size of the widget. More...
 
- Public Member Functions inherited from ui::Container
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...
 
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...
 

Additional Inherited Members

- Public Types inherited from ui::Table
typedef Container::size_type size_type
 
- Public Types inherited from ui::Container
typedef std::vector< Widget * >
::size_type 
size_type
 
typedef std::vector< Widget * >
::iterator 
iterator
 

Detailed Description

A form widget.

A form is a two-column table.

Constructor & Destructor Documentation

ui::Form::Form ( )

Construct a form.

Member Function Documentation

virtual void ui::Form::accept ( WidgetVisitor visitor)
overridevirtual

Accept the visitor.

Parameters
visitorthe visitor.

Reimplemented from ui::Table.

void ui::Form::addRow ( Widget left,
Widget right 
)

Add a row to the form.

Parameters
leftthe widget in the left column.
rightthe widget in the right column.
size_type ui::Form::getRowCount ( ) const

Get the number of rows.

This call is equivalent to:

Returns
the number of rows in the form.
std::pair<Widget*, Widget*> ui::Form::ithRow ( size_type  i)

Get the ith row of the form.

This call is equivalent to:

{ ithChild(2 * i), ithChild(2 * i + 1) }
Parameters
ithe row number.(starting from 0).
Returns
the pair of widgets of the ith row.