TGUI 1.12
Loading...
Searching...
No Matches
VerticalTabs.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2026 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef TGUI_VERTICAL_TABS_HPP
26#define TGUI_VERTICAL_TABS_HPP
27
28#include <TGUI/Widgets/TabsBase.hpp>
29#include <TGUI/Text.hpp>
30
32
33namespace tgui
34{
42 class TGUI_API VerticalTabs : public TabsBase
43 {
44 public:
45
46 using Ptr = std::shared_ptr<VerticalTabs>;
47 using ConstPtr = std::shared_ptr<const VerticalTabs>;
48
49 static constexpr const char StaticWidgetType[] = "VerticalTabs";
50
58 explicit VerticalTabs(const char* typeName = StaticWidgetType, bool initRenderer = true);
59
65 TGUI_NODISCARD static VerticalTabs::Ptr create();
66
74 TGUI_NODISCARD static VerticalTabs::Ptr copy(const VerticalTabs::ConstPtr& tab);
75
85 void setSize(const Layout2d& size) override;
86 using Widget::setSize;
87
96 void setTabWidth(float width);
97
103 void setTabHeight(float height);
104
110 TGUI_NODISCARD float getTabHeight() const;
111
115 bool leftMousePressed(Vector2f pos) override;
116
120 void mouseMoved(Vector2f pos) override;
121
128 void draw(BackendRenderTarget& target, RenderStates states) const override;
129
131 protected:
132
134 // Recalculates the size of each tab image.
136 void recalculateTabsSize() override;
137
141 TGUI_NODISCARD std::unique_ptr<DataIO::Node> save(SavingRenderersMap& renderers) const override;
142
146 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
147
149 // Makes a copy of the widget
151 TGUI_NODISCARD Widget::Ptr clone() const override;
152
154 protected:
155
156 float m_tabHeight = 0;
157
159 };
160
162}
163
165
166#endif // TGUI_VERTICAL_TABS_HPP
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Class to store the position or size of a widget.
Definition Layout.hpp:321
void setTabHeight(float height)
Changes the height of the tabs.
void setTabWidth(float width)
Changes the width of the tabs.
bool leftMousePressed(Vector2f pos) override
Called by the parent when the left mouse button goes down on top of the widget.
std::shared_ptr< const VerticalTabs > ConstPtr
Shared constant widget pointer.
Definition VerticalTabs.hpp:47
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
float getTabHeight() const
Returns the height of the tabs.
static VerticalTabs::Ptr copy(const VerticalTabs::ConstPtr &tab)
Makes a copy of another tab.
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
static constexpr const char StaticWidgetType[]
Type name of the widget.
Definition VerticalTabs.hpp:49
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
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.
static VerticalTabs::Ptr create()
Creates a new tabs widget.
std::shared_ptr< VerticalTabs > Ptr
Shared widget pointer.
Definition VerticalTabs.hpp:46
void setSize(const Layout2d &size) override
Changes the area used by the tabs.
std::shared_ptr< Widget > Ptr
Shared widget pointer.
Definition Widget.hpp:87
virtual void setSize(const Layout2d &size)
Changes the size of the widget.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
States used for drawing.
Definition RenderStates.hpp:38