TGUI 1.13
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/Text.hpp>
29#include <TGUI/Widgets/TabsBase.hpp>
30
32
33namespace tgui
34{
42 class TGUI_API VerticalTabs : public TabsBase
43 {
44 public:
45 using Ptr = std::shared_ptr<VerticalTabs>;
46 using ConstPtr = std::shared_ptr<const VerticalTabs>;
47
48 static constexpr char StaticWidgetType[] = "VerticalTabs";
49
57 explicit VerticalTabs(const char* typeName = StaticWidgetType, bool initRenderer = true);
58
64 [[nodiscard]] static VerticalTabs::Ptr create();
65
73 [[nodiscard]] static VerticalTabs::Ptr copy(const VerticalTabs::ConstPtr& tab);
74
84 void setSize(const Layout2d& size) override;
85 using Widget::setSize;
86
95 void setTabWidth(float width);
96
102 void setTabHeight(float height);
103
109 [[nodiscard]] float getTabHeight() const;
110
114 bool leftMousePressed(Vector2f pos) override;
115
119 void mouseMoved(Vector2f pos) override;
120
127 void draw(BackendRenderTarget& target, RenderStates states) const override;
128
130
131 protected:
133 // Recalculates the size of each tab image.
135 void recalculateTabsSize() override;
136
140 [[nodiscard]] std::unique_ptr<DataIO::Node> save(SavingRenderersMap& renderers) const override;
141
145 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
146
148 // Makes a copy of the widget
150 [[nodiscard]] Widget::Ptr clone() const override;
151
153
154 protected:
155 float m_tabHeight = 0;
156 };
157} // namespace tgui
158
159#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:320
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:46
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.
static constexpr char StaticWidgetType[]
Type name of the widget.
Definition VerticalTabs.hpp:48
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
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:45
void setSize(const Layout2d &size) override
Changes the area used by the tabs.
std::shared_ptr< Widget > Ptr
Shared widget pointer.
Definition Widget.hpp:85
virtual void setSize(const Layout2d &size)
Changes the size of the widget.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
States used for drawing.
Definition RenderStates.hpp:38