30#include <TGUI/Container.hpp>
42 typedef std::shared_ptr<Grid>
Ptr;
171 Alignment alignment = Alignment::Center);
219 virtual bool mouseOnWidget(
float x,
float y)
const override;
229 sf::Vector2f getMinSize();
235 void updatePositionsOfAllWidgets();
243 return std::make_shared<Grid>(*
this);
250 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
256 std::vector<std::vector<Widget::Ptr>> m_gridWidgets;
257 std::vector<std::vector<Borders>> m_objBorders;
258 std::vector<std::vector<Alignment>> m_objAlignment;
260 std::vector<float> m_rowHeight;
261 std::vector<float> m_columnWidth;
263 std::map<Widget::Ptr, unsigned int> m_connectedCallbacks;
265 sf::Vector2f m_realSize;
Definition: Borders.hpp:38
Container widget.
Definition: Container.hpp:48
Grid(const Grid ©)
Copy constructor.
static Grid::Ptr copy(Grid::ConstPtr grid)
Makes a copy of another grid.
void changeWidgetAlignment(const Widget::Ptr &widget, Alignment alignment=Alignment::Center)
Changes the alignment of a given widget in its cell.
void updateWidgets()
Updates the position and size of the widget.
void addWidget(const Widget::Ptr &widget, unsigned int row, unsigned int column, const Borders &borders=Borders(0, 0, 0, 0), Alignment alignment=Alignment::Center)
Add a widget to the grid.
Alignment
The alignment of the widget in its cell.
Definition: Grid.hpp:54
virtual sf::Vector2f getSize() const override
Returns the size of the grid.
Definition: Grid.hpp:133
virtual void removeAllWidgets() override
Removes all widgets that were added to the container.
virtual Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Grid.hpp:241
Widget::Ptr getWidget(unsigned int row, unsigned int column)
Returns the widget in a specific square of the grid.
static Grid::Ptr create()
Creates a new grid widget.
std::shared_ptr< Grid > Ptr
Shared widget pointer.
Definition: Grid.hpp:42
virtual void setSize(const Layout2d &size) override
Changes the size of the grid.
void changeWidgetBorders(const Widget::Ptr &widget, const Borders &borders=Borders(0, 0, 0, 0))
Changes borders of a given widget.
std::shared_ptr< const Grid > ConstPtr
Shared constant widget pointer.
Definition: Grid.hpp:43
virtual bool remove(const Widget::Ptr &widget) override
Removes a single widget that was added to the container.
Class to store the position or size of a widget.
Definition: Layout.hpp:255
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34