TGUI  0.8-dev
tgui::Transformable Class Reference
Inheritance diagram for tgui::Transformable:
tgui::Widget tgui::ChatBox tgui::ClickableWidget tgui::ComboBox tgui::Container tgui::Knob tgui::ListBox tgui::MenuBar tgui::Scrollbar tgui::Slider tgui::Tabs tgui::TextBox

Public Member Functions

virtual void setPosition (const Layout2d &position)
 Sets the position of the widget. More...
 
void setPosition (Layout x, Layout y)
 Sets the position of the widget. More...
 
sf::Vector2f getPosition () const
 Gets the position of the widget. More...
 
virtual void setSize (const Layout2d &size)
 Changes the size of the widget. More...
 
void setSize (Layout width, Layout height)
 Changes the size of the widget. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the widget. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the entire size that the widget is using. More...
 

Member Function Documentation

◆ getFullSize()

virtual sf::Vector2f tgui::Transformable::getFullSize ( ) const
inlinevirtual

Returns the entire size that the widget is using.

This function will return a value equal or greater than what getSize returns. If the widget would e.g. have borders around it then this function will return the size, including these borders.

Returns
Full size of the widget

Reimplemented in tgui::ChildWindow, tgui::Slider, tgui::RadioButton, and tgui::CheckBox.

◆ getPosition()

sf::Vector2f tgui::Transformable::getPosition ( ) const
inline

Gets the position of the widget.

Returns
Current position
See also
setPosition

◆ getSize()

virtual sf::Vector2f tgui::Transformable::getSize ( ) const
inlinevirtual

Returns the size of the widget.

Returns
Size of the widgetTODO: Fix Grid and Tab to no longer override the getSize function

Reimplemented in tgui::Grid, and tgui::Tabs.

◆ setPosition() [1/2]

virtual void tgui::Transformable::setPosition ( const Layout2d position)
inlinevirtual

Sets the position of the widget.

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable widget is (0, 0).

Parameters
positionNew position
See also
move, getPosition

Usage examples:

// Place the widget on an exact position
widget->setPosition({40, 30});
// Place the widget relative to the size of its parent
widget->setPosition({"5%", "10%"});

Reimplemented in tgui::Widget, tgui::ChildWindow, tgui::ChatBox, and tgui::ListBox.

◆ setPosition() [2/2]

void tgui::Transformable::setPosition ( Layout  x,
Layout  y 
)
inline

Sets the position of the widget.

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable widget is (0, 0).

Parameters
xNew x coordinate
yNew y coordinate
See also
move, getPosition

Usage examples:

// Place the widget on an exact position
widget->setPosition(40, 30);
// Place the widget relative to the size of its parent
widget->setPosition("5%", "10%");

◆ setSize() [1/2]

virtual void tgui::Transformable::setSize ( const Layout2d size)
inlinevirtual

Changes the size of the widget.

Parameters
sizeSize of the widget

Usage examples:

// Give the widget an exact size
widget->setSize({100, 25});
// Give the widget a size relative to the size of its parent
widget->setPosition({"20%", "5%"});

Reimplemented in tgui::Widget, tgui::Picture, tgui::ChildWindow, tgui::Label, tgui::EditBox, tgui::Grid, tgui::ChatBox, tgui::ComboBox, tgui::ProgressBar, tgui::Canvas, tgui::ListBox, tgui::Group, tgui::Tabs, tgui::TextBox, tgui::Panel, tgui::Button, tgui::MenuBar, tgui::Slider, tgui::SpinButton, tgui::Container, tgui::RadioButton, tgui::Knob, tgui::Scrollbar, and tgui::BoxLayout.

◆ setSize() [2/2]

void tgui::Transformable::setSize ( Layout  width,
Layout  height 
)
inline

Changes the size of the widget.

Parameters
widthWidth of the widget
heightHeight of the widget

Usage examples:

// Give the widget an exact size
widget->setSize(100, 25);
// Give the widget a size relative to the size of its parent
widget->setPosition("20%", "5%");

The documentation for this class was generated from the following file: