TGUI  1.3-dev
Loading...
Searching...
No Matches
SeparatorLine.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2024 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
26#ifndef TGUI_SEPARATOR_LINE_HPP
27#define TGUI_SEPARATOR_LINE_HPP
28
29#include <TGUI/Widgets/ClickableWidget.hpp>
30#include <TGUI/Renderers/SeparatorLineRenderer.hpp>
31
33
34TGUI_MODULE_EXPORT namespace tgui
35{
47 class TGUI_API SeparatorLine : public ClickableWidget
48 {
49 public:
50
51 using Ptr = std::shared_ptr<SeparatorLine>;
52 using ConstPtr = std::shared_ptr<const SeparatorLine>;
53
54 static constexpr const char StaticWidgetType[] = "SeparatorLine";
55
56
64 SeparatorLine(const char* typeName = StaticWidgetType, bool initRenderer = true);
65
66
72 TGUI_NODISCARD static SeparatorLine::Ptr create(const Layout2d& size = {"100%", 1});
73
74
82 TGUI_NODISCARD static SeparatorLine::Ptr copy(const SeparatorLine::ConstPtr& separator);
83
84
89 TGUI_NODISCARD SeparatorLineRenderer* getSharedRenderer() override;
90 TGUI_NODISCARD const SeparatorLineRenderer* getSharedRenderer() const override;
91
97 TGUI_NODISCARD SeparatorLineRenderer* getRenderer() override;
98
99
106 void draw(BackendRenderTarget& target, RenderStates states) const override;
107
108
110 protected:
111
117 void rendererChanged(const String& property) override;
118
119
121 // Makes a copy of the widget
123 TGUI_NODISCARD Widget::Ptr clone() const override;
124
125
127 protected:
128
129 // Cached renderer properties
130 Color m_colorCached = Color::Black;
131
133 };
134
136}
137
139
140#endif // TGUI_SEPARATOR_LINE_HPP
Base class for render targets.
Definition BackendRenderTarget.hpp:48
Clickable widget.
Definition ClickableWidget.hpp:40
Wrapper for colors.
Definition Color.hpp:72
Class to store the position or size of a widget.
Definition Layout.hpp:305
Definition SeparatorLineRenderer.hpp:37
Widget that is drawn as a filled rectangle and can be used as a line to visually separate widgets fro...
Definition SeparatorLine.hpp:48
TGUI_NODISCARD SeparatorLineRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
static TGUI_NODISCARD SeparatorLine::Ptr copy(const SeparatorLine::ConstPtr &separator)
Makes a copy of another separator.
TGUI_NODISCARD Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
std::shared_ptr< const SeparatorLine > ConstPtr
Shared constant widget pointer.
Definition SeparatorLine.hpp:52
TGUI_NODISCARD SeparatorLineRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
std::shared_ptr< SeparatorLine > Ptr
Shared widget pointer.
Definition SeparatorLine.hpp:51
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
static TGUI_NODISCARD SeparatorLine::Ptr create(const Layout2d &size={"100%", 1})
Creates a new separator widget.
Wrapper class to store strings.
Definition String.hpp:101
std::shared_ptr< Widget > Ptr
Shared widget pointer.
Definition Widget.hpp:87
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
States used for drawing.
Definition RenderStates.hpp:39