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

A leaf widget. More...

#include <ui/Leaf.h>

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

Public Member Functions

 Leaf ()
 Construct a leaf widget. More...
 
virtual void layoutRequest () override
 Compute the size hint of the widget. More...
 
virtual void layoutAllocation () override
 Compute the size of the widget. More...
 
Focus
bool isFocusable () const
 Tell whether the widget is focusable. More...
 
void setFocusable (bool focusable=true)
 Set the focusable state of the widget. More...
 
bool isFocused () const
 Tell whether the widget is focused. More...
 
void setFocused (bool focused=true)
 Set the focused state of the widget. More...
 
Padding
void setHorizontalPadding (float padding)
 Set the horizontal padding of the widget. More...
 
void setVerticalPadding (float padding)
 Set the vertical padding of the widget. More...
 
void setPadding (float padding)
 Set the padding of the widget. More...
 
float getHorizontalPadding () const
 Get the horizontal padding. More...
 
float getVerticalPadding () const
 Get the vertical padding. More...
 
sf::FloatRect getInternalGeometry () const
 Compute the internal geometry. 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 onClick (sf::Mouse::Button button, const sf::Vector2f &mouse)
 Do something when the widget is clicked. More...
 

Detailed Description

A leaf widget.

A leaf widget is a widget that has no child widget.

Constructor & Destructor Documentation

ui::Leaf::Leaf ( )
inline

Construct a leaf widget.

See also
setFocusable(), setFocused()

Member Function Documentation

float ui::Leaf::getHorizontalPadding ( ) const
inline

Get the horizontal padding.

Returns
the horizontal padding.
sf::FloatRect ui::Leaf::getInternalGeometry ( ) const

Compute the internal geometry.

This computation takes into account the padding.

Returns
a rectangle describing the internal geometry.
See also
Widget::getGeometry()
float ui::Leaf::getVerticalPadding ( ) const
inline

Get the vertical padding.

Returns
the vertical padding.
bool ui::Leaf::isFocusable ( ) const
inline

Tell whether the widget is focusable.

Returns
true if the widget is focusable.
bool ui::Leaf::isFocused ( ) const
inline

Tell whether the widget is focused.

Returns
true if the widget is focused.
virtual void ui::Leaf::layoutAllocation ( )
overridevirtual

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.

Implements ui::Widget.

virtual void ui::Leaf::layoutRequest ( )
overridevirtual

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.

Implements ui::Widget.

void ui::Leaf::setFocusable ( bool  focusable = true)
inline

Set the focusable state of the widget.

By default, a widget is focusable.

Parameters
focusablethe new focusable state.
void ui::Leaf::setFocused ( bool  focused = true)
inline

Set the focused state of the widget.

By default, a widget is not focused.

Parameters
focusedthe new focused state.
void ui::Leaf::setHorizontalPadding ( float  padding)
inline

Set the horizontal padding of the widget.

Parameters
paddingthe new horizontal padding
void ui::Leaf::setPadding ( float  padding)
inline

Set the padding of the widget.

This call is equivalent to:

Parameters
paddingthe new padding
void ui::Leaf::setVerticalPadding ( float  padding)
inline

Set the vertical padding of the widget.

Parameters
paddingthe new vertical padding