25#ifndef TGUI_OUTLINE_HPP
26#define TGUI_OUTLINE_HPP
28#include <TGUI/Vector2.hpp>
29#include <TGUI/AbsoluteOrRelativeValue.hpp>
33TGUI_MODULE_EXPORT
namespace tgui
59 template <typename T, typename = typename std::enable_if_t<std::is_arithmetic<T>::value, T>>
91 m_left {leftBorderWidth},
92 m_top {topBorderHeight},
93 m_right {rightBorderWidth},
94 m_bottom{bottomBorderHeight}
103 TGUI_NODISCARD
constexpr float getLeft()
const
105 return m_left.getValue();
113 TGUI_NODISCARD
constexpr float getTop()
const
115 return m_top.getValue();
125 return m_right.getValue();
135 return m_bottom.getValue();
144 return {getLeft(), getTop()};
156 return (getLeft() == outline.
getLeft()) && (getTop() == outline.
getTop()) && (getRight() == outline.
getRight()) && (getBottom() == outline.
getBottom());
168 return !(*
this == outline);
178 return {getLeft() + other.
getLeft(),
179 getTop() + other.
getTop(),
191 return {getLeft() - other.
getLeft(),
192 getTop() - other.
getTop(),
204 m_left = getLeft() + other.
getLeft();
205 m_top = getTop() + other.
getTop();
206 m_right = getRight() + other.
getRight();
207 m_bottom = getBottom() + other.
getBottom();
218 m_left = getLeft() - other.
getLeft();
219 m_top = getTop() - other.
getTop();
220 m_right = getRight() - other.
getRight();
221 m_bottom = getBottom() - other.
getBottom();
231 constexpr void updateParentSize(
Vector2f newParentSize)
233 m_left.updateParentSize(newParentSize.
x);
234 m_top.updateParentSize(newParentSize.
y);
235 m_right.updateParentSize(newParentSize.
x);
236 m_bottom.updateParentSize(newParentSize.
y);
245 TGUI_NODISCARD String toString()
const
247 return U
"(" + m_left.toString() + U
", " + m_top.toString() + U
", " + m_right.toString() + U
", " + m_bottom.toString() + U
")";
253 AbsoluteOrRelativeValue m_left = 0;
254 AbsoluteOrRelativeValue m_top = 0;
255 AbsoluteOrRelativeValue m_right = 0;
256 AbsoluteOrRelativeValue m_bottom = 0;
261 using Borders = Outline;
262 using Padding = Outline;
Class to store the a value that is either a constant or a ratio.
Definition AbsoluteOrRelativeValue.hpp:45
Definition Outline.hpp:38
constexpr Outline operator+(const Outline &other) const
Adds two outlines together (e.g. to add padding and borders)
Definition Outline.hpp:176
constexpr bool operator!=(const Outline &outline) const
Compares two outlines.
Definition Outline.hpp:166
constexpr Outline & operator-=(const Outline &other)
Subtracts an outline from this instance.
Definition Outline.hpp:216
constexpr Outline(AbsoluteOrRelativeValue leftBorderWidth, AbsoluteOrRelativeValue topBorderHeight, AbsoluteOrRelativeValue rightBorderWidth, AbsoluteOrRelativeValue bottomBorderHeight)
Constructor that initializes the outline.
Definition Outline.hpp:90
constexpr float getTop() const
Returnes the height of the top border.
Definition Outline.hpp:113
constexpr Outline(AbsoluteOrRelativeValue width, AbsoluteOrRelativeValue height)
Constructor that initializes the outline.
Definition Outline.hpp:74
constexpr Vector2f getOffset() const
Returnes the width of the left and top borders.
Definition Outline.hpp:142
constexpr float getRight() const
Returnes the width of the right border.
Definition Outline.hpp:123
constexpr Outline & operator+=(const Outline &other)
Adds an outline to this instance (e.g. to add padding and borders)
Definition Outline.hpp:202
constexpr Outline(T size)
Constructor that initializes the outline.
Definition Outline.hpp:60
constexpr float getLeft() const
Returnes the width of the left border.
Definition Outline.hpp:103
constexpr Outline(AbsoluteOrRelativeValue size=0)
Default constructor that initializes the outline.
Definition Outline.hpp:46
constexpr bool operator==(const Outline &outline) const
Compares two outlines.
Definition Outline.hpp:154
constexpr float getBottom() const
Returnes the height of the bottom border.
Definition Outline.hpp:133
constexpr Outline operator-(const Outline &other) const
Subtracts two outlines from each other.
Definition Outline.hpp:189
T y
Y coordinate of the vector.
Definition Vector2.hpp:136
T x
X coordinate of the vector.
Definition Vector2.hpp:135
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38