TGUI  1.6.1
Loading...
Searching...
No Matches
Group.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_GROUP_HPP
26#define TGUI_GROUP_HPP
27
28#include <TGUI/Container.hpp>
29#include <TGUI/Renderers/GroupRenderer.hpp>
30
32
33TGUI_MODULE_EXPORT namespace tgui
34{
41 class TGUI_API Group : public Container
42 {
43 public:
44
45 using Ptr = std::shared_ptr<Group>;
46 using ConstPtr = std::shared_ptr<const Group>;
47
48 static constexpr const char StaticWidgetType[] = "Group";
49
57 Group(const char* typeName = StaticWidgetType, bool initRenderer = true);
58
66 TGUI_NODISCARD static Group::Ptr create(const Layout2d& size = {"100%", "100%"});
67
75 TGUI_NODISCARD static Group::Ptr copy(const Group::ConstPtr& group);
76
81 TGUI_NODISCARD GroupRenderer* getSharedRenderer() override;
82 TGUI_NODISCARD const GroupRenderer* getSharedRenderer() const override;
83
89 TGUI_NODISCARD GroupRenderer* getRenderer() override;
90
96 void setSize(const Layout2d& size) override;
97 using Widget::setSize;
98
103 TGUI_NODISCARD Vector2f getInnerSize() const override;
104
111 TGUI_NODISCARD Vector2f getChildWidgetsOffset() const override;
112
118 TGUI_NODISCARD bool isMouseOnWidget(Vector2f pos) const override;
119
126 void draw(BackendRenderTarget& target, RenderStates states) const override;
127
129 protected:
130
136 void rendererChanged(const String& property) override;
137
139 // Makes a copy of the widget
141 TGUI_NODISCARD Widget::Ptr clone() const override;
142
144 protected:
145
146 // Cached renderer properties
147 Padding m_paddingCached;
148
150 };
151
153}
154
156
157#endif // TGUI_GROUP_HPP
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Container widget.
Definition Container.hpp:48
Definition GroupRenderer.hpp:35
Group widget.
Definition Group.hpp:42
static Group::Ptr create(const Layout2d &size={"100%", "100%"})
Creates a new group.
void setSize(const Layout2d &size) override
Changes the size of the group.
static Group::Ptr copy(const Group::ConstPtr &group)
Makes a copy of another group.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
Vector2f getInnerSize() const override
Returns the space available for widgets inside the container.
bool isMouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
GroupRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Vector2f getChildWidgetsOffset() const override
Returns the distance between the position of the container and a widget that would be drawn inside th...
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the child widgets to a render target.
std::shared_ptr< const Group > ConstPtr
Shared constant widget pointer.
Definition Group.hpp:46
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
std::shared_ptr< Group > Ptr
Shared widget pointer.
Definition Group.hpp:45
GroupRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Class to store the position or size of a widget.
Definition Layout.hpp:323
Definition Outline.hpp:38
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