TGUI  1.6.1
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#ifndef TGUI_SEPARATOR_LINE_HPP
26#define TGUI_SEPARATOR_LINE_HPP
27
28#include <TGUI/Widgets/ClickableWidget.hpp>
29#include <TGUI/Renderers/SeparatorLineRenderer.hpp>
30
32
33TGUI_MODULE_EXPORT namespace tgui
34{
46 class TGUI_API SeparatorLine : public ClickableWidget
47 {
48 public:
49
50 using Ptr = std::shared_ptr<SeparatorLine>;
51 using ConstPtr = std::shared_ptr<const SeparatorLine>;
52
53 static constexpr const char StaticWidgetType[] = "SeparatorLine";
54
62 SeparatorLine(const char* typeName = StaticWidgetType, bool initRenderer = true);
63
69 TGUI_NODISCARD static SeparatorLine::Ptr create(const Layout2d& size = {"100%", 1});
70
78 TGUI_NODISCARD static SeparatorLine::Ptr copy(const SeparatorLine::ConstPtr& separator);
79
84 TGUI_NODISCARD SeparatorLineRenderer* getSharedRenderer() override;
85 TGUI_NODISCARD const SeparatorLineRenderer* getSharedRenderer() const override;
86
92 TGUI_NODISCARD SeparatorLineRenderer* getRenderer() override;
93
100 void draw(BackendRenderTarget& target, RenderStates states) const override;
101
103 protected:
104
110 void rendererChanged(const String& property) override;
111
113 // Makes a copy of the widget
115 TGUI_NODISCARD Widget::Ptr clone() const override;
116
118 protected:
119
120 // Cached renderer properties
121 Color m_colorCached = Color::Black;
122
124 };
125
127}
128
130
131#endif // TGUI_SEPARATOR_LINE_HPP
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Clickable widget.
Definition ClickableWidget.hpp:38
Wrapper for colors.
Definition Color.hpp:73
Class to store the position or size of a widget.
Definition Layout.hpp:323
Definition SeparatorLineRenderer.hpp:35
Widget that is drawn as a filled rectangle and can be used as a line to visually separate widgets fro...
Definition SeparatorLine.hpp:47
SeparatorLineRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
std::shared_ptr< const SeparatorLine > ConstPtr
Shared constant widget pointer.
Definition SeparatorLine.hpp:51
static SeparatorLine::Ptr create(const Layout2d &size={"100%", 1})
Creates a new separator widget.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
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:50
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
static SeparatorLine::Ptr copy(const SeparatorLine::ConstPtr &separator)
Makes a copy of another separator.
SeparatorLineRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Wrapper class to store strings.
Definition String.hpp:96
std::shared_ptr< Widget > Ptr
Shared widget pointer.
Definition Widget.hpp:86
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
States used for drawing.
Definition RenderStates.hpp:38