25#ifndef TGUI_SPLIT_CONTAINER_HPP
26#define TGUI_SPLIT_CONTAINER_HPP
28#include <TGUI/Widgets/Group.hpp>
29#include <TGUI/Renderers/SplitContainerRenderer.hpp>
33TGUI_MODULE_EXPORT
namespace tgui
47 using Ptr = std::shared_ptr<SplitContainer>;
48 using ConstPtr = std::shared_ptr<const SplitContainer>;
50 static constexpr const char StaticWidgetType[] =
"SplitContainer";
59 SplitContainer(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
99 using Widget::setSize;
255 void mouseMoved(
Vector2f pos)
override;
260 void mouseNoLongerOnWidget()
override;
283 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
288 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
308 void updateAvailableSize();
313 void updateChildren();
318 TGUI_NODISCARD
FloatRect getSplitterInteractRect()
const;
323 Orientation m_orientation = Orientation::Horizontal;
327 float m_currentSplitterOffset = 0;
328 float m_splitterWidth = 3;
329 float m_minimumGrabWidth = 5;
331 bool m_mouseHoverOnSplitter =
false;
332 bool m_mouseDownOnSplitter =
false;
333 float m_mouseDownOnSplitterOffset = 0;
334 Cursor::Type m_currentSplitContainerMouseCursor = Cursor::Type::Arrow;
337 Color m_splitterColorCached;
338 Color m_splitterColorHoverCached;
Class to store the a value that is either a constant or a ratio.
Definition AbsoluteOrRelativeValue.hpp:45
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Wrapper for colors.
Definition Color.hpp:73
Type
List of available cursors.
Definition Cursor.hpp:50
Group widget.
Definition Group.hpp:42
Class to store the position or size of a widget.
Definition Layout.hpp:323
Definition SplitContainerRenderer.hpp:36
Container that should contains exactly 2 child widgets which will be resized to fill the container to...
Definition SplitContainer.hpp:44
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
static SplitContainer::Ptr copy(const SplitContainer::ConstPtr &splitContainer)
Makes a copy of another split container.
void setSize(const Layout2d &size) override
Changes the size of the split container.
void setOrientation(Orientation orientation)
Sets whether the widgets are placed left and right of the splitter or above and below the splitter.
std::shared_ptr< const SplitContainer > ConstPtr
Shared constant widget pointer.
Definition SplitContainer.hpp:48
std::shared_ptr< SplitContainer > Ptr
Shared widget pointer.
Definition SplitContainer.hpp:47
void mouseEnteredWidget() override
This function is called when the mouse enters the widget.
void add(const Widget::Ptr &widgetPtr, const String &widgetName="") override
Adds a widget to the container.
static SplitContainer::Ptr create(const Layout2d &size={"100%", "100%"})
Creates a new split container widget.
Orientation getOrientation() const
Returns whether the widgets are placed left and right of the splitter or above and below the splitter...
float getSplitterOffset() const
Returns the position of the splitter from the left or top position (depending on orientation)
bool isMouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
void setMinValidSplitterOffset(AbsoluteOrRelativeValue minOffset)
Sets the minimum value for the splitter, effectively providing a minimum size for the top/left widget...
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the child widgets to a render target.
float getMinimumGrabWidth() const
Returns the minimum width of the area where the splitter can be dragged.
float getMinValidSplitterOffset() const
Returns the minimum value for the splitter.
void setMinimumGrabWidth(float width)
Sets the minimum width of the area where the splitter can be dragged.
void setSplitterWidth(float width)
Sets the width of the draggable splitter line that separates the two widgets in the container.
SplitContainerRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
float getMaxValidSplitterOffset() const
Returns the maximum value for the splitter.
bool setWidgetIndex(const Widget::Ptr &widget, std::size_t index) override
Changes the index of a widget in this container.
std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
SplitContainerRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
bool leftMousePressed(Vector2f pos) override
Called by the parent when the left mouse button goes down on top of the widget.
void setMaxValidSplitterOffset(AbsoluteOrRelativeValue maxOffset)
Sets the maximum value for the splitter, effectively providing a minimum size for the bottom/right wi...
void setSplitterOffset(AbsoluteOrRelativeValue offset)
Sets the position of the splitter from the left or top position (depending on orientation)
void mouseLeftWidget() override
This function is called when the mouse leaves the widget.
float getSplitterWidth() const
Returns the width of the draggable splitter line that separates the two widgets in the container.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Orientation
Orientation of the object.
Definition Layout.hpp:52
Helper class to create an AbsoluteOrRelativeValue object containing a relative value without using a ...
Definition AbsoluteOrRelativeValue.hpp:166
States used for drawing.
Definition RenderStates.hpp:38