25#ifndef TGUI_TAB_CONTAINER_HPP
26#define TGUI_TAB_CONTAINER_HPP
28#include <TGUI/SubwidgetContainer.hpp>
29#include <TGUI/Widgets/Tabs.hpp>
30#include <TGUI/Widgets/Panel.hpp>
34TGUI_MODULE_EXPORT
namespace tgui
48 using Ptr = std::shared_ptr<TabContainer>;
49 using ConstPtr = std::shared_ptr<const TabContainer>;
51 static constexpr const char StaticWidgetType[] =
"TabContainer";
69 TabContainer(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
112 TGUI_NODISCARD
const TabsRenderer* getTabsSharedRenderer()
const;
127 using Container::setSize;
313 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
318 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
342 std::vector<Panel::Ptr> m_panels;
348 TabAlign m_tabAlign = TabAlign::Top;
350 float m_tabFixedSize = 0.0f;
Container widget.
Definition Container.hpp:48
Class to store the position or size of a widget.
Definition Layout.hpp:313
Class to store the left, top, width or height of a widget.
Definition Layout.hpp:101
std::shared_ptr< Panel > Ptr
Shared widget pointer.
Definition Panel.hpp:42
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:350
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Wrapper class to store strings.
Definition String.hpp:96
TabContainer widget.
Definition TabContainer.hpp:45
static TGUI_NODISCARD TabContainer::Ptr create(const Layout2d &size={ "100%", "100%" })
Creates a new tab container widget.
std::shared_ptr< TabContainer > Ptr
Shared widget pointer.
Definition TabContainer.hpp:48
TGUI_NODISCARD int getSelectedIndex() const
Returns index of the selected panel.
bool changeTabText(std::size_t index, const String &text)
Changes the text of one of the tabs.
TGUI_NODISCARD std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree of nodes in order to save it to a file.
TabContainer(TabContainer &©) noexcept
Move constructor.
bool removeTab(std::size_t index)
Removes a tab and its corresponding panel with a given index.
TGUI_NODISCARD String getTabText(std::size_t index) const
Gets the text of one of the tabs.
TGUI_NODISCARD bool isMouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
TGUI_NODISCARD TabAlign getTabAlignment() const
Returns the alignment of the tabs.
Panel::Ptr addTab(const String &name, bool select=true)
Adds a new tab and corresponding panel.
void setTabsHeight(const Layout &height)
Changes the height of tabs part of the widget.
TabContainer(const TabContainer ©)
Copy constructor.
void setTabAlignment(TabAlign align)
Changes the alignment of the tabs.
TGUI_NODISCARD TabsRenderer * getTabsSharedRenderer()
Returns the renderer of tabs part of widget.
TGUI_NODISCARD Widget::Ptr clone() const override
Makes a copy of the widget.
void setTabFixedSize(float fixedSize)
Changes the tab fixed size for fixed size alignment.
TGUI_NODISCARD TabsRenderer * getTabsRenderer()
Returns the renderer of tabs part of widget.
bool removeTab(const String &text)
Removes a tab and its corresponding panel, given the text of the tab.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
static TGUI_NODISCARD TabContainer::Ptr copy(const TabContainer::ConstPtr &tabContainer)
Makes a copy of another tab container.
Panel::Ptr insertTab(std::size_t index, const String &name, bool select=true)
Inserts a new tab and panel somewhere between the existing ones.
TGUI_NODISCARD int getIndex(const Panel::Ptr &panel)
Returns index of the specified panel.
std::shared_ptr< const TabContainer > ConstPtr
Shared constant widget pointer.
Definition TabContainer.hpp:49
TGUI_NODISCARD Signal & getSignal(String signalName) override
Retrieves a signal based on its name.
void select(std::size_t index)
Sets selection to panel.
void setSize(const Layout2d &size) override
Changes the size of the tab container.
TGUI_NODISCARD Panel::Ptr getPanel(int index) const
Returns the panel with given index.
TabAlign
Enumeration of the tab alignments for tabs.
Definition TabContainer.hpp:57
TGUI_NODISCARD Panel::Ptr getSelected() const
Returns the selected panel or nullptr.
TGUI_NODISCARD float getTabFixedSize() const
Returns the tab fixed size for fixed size alignment, default is 0.0f.
TGUI_NODISCARD Tabs::Ptr getTabs() const
Returns internal tabs widget.
TGUI_NODISCARD std::size_t getPanelCount() const
Returns the number of holded panels.
Definition TabsRenderer.hpp:35
std::shared_ptr< Tabs > Ptr
Shared widget pointer.
Definition Tabs.hpp:46
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38