26#ifndef TGUI_OUTLINE_HPP
27#define TGUI_OUTLINE_HPP
29#include <TGUI/Vector2.hpp>
30#include <TGUI/AbsoluteOrRelativeValue.hpp>
63 template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
99 m_left {leftBorderWidth},
100 m_top {topBorderHeight},
101 m_right {rightBorderWidth},
102 m_bottom{bottomBorderHeight}
115 return m_left.getValue();
127 return m_top.getValue();
139 return m_right.getValue();
151 return m_bottom.getValue();
161 return Vector2f(getLeft(), getTop());
175 return (getLeft() == outline.
getLeft()) && (getTop() == outline.
getTop()) && (getRight() == outline.
getRight()) && (getBottom() == outline.
getBottom());
189 return !(*
this == outline);
200 return {getLeft() + other.
getLeft(),
201 getTop() + other.
getTop(),
213 return {getLeft() - other.
getLeft(),
214 getTop() - other.
getTop(),
226 m_left = getLeft() + other.
getLeft();
227 m_top = getTop() + other.
getTop();
228 m_right = getRight() + other.
getRight();
229 m_bottom = getBottom() + other.
getBottom();
240 m_left = getLeft() - other.
getLeft();
241 m_top = getTop() - other.
getTop();
242 m_right = getRight() - other.
getRight();
243 m_bottom = getBottom() - other.
getBottom();
255 TGUI_CONSTEXPR
void updateParentSize(
Vector2f newParentSize)
257 m_left.updateParentSize(newParentSize.
x);
258 m_top.updateParentSize(newParentSize.
y);
259 m_right.updateParentSize(newParentSize.
x);
260 m_bottom.updateParentSize(newParentSize.
y);
271 String toString()
const
273 return "(" + m_left.toString() +
", " + m_top.toString() +
", " + m_right.toString() +
", " + m_bottom.toString() +
")";
280 AbsoluteOrRelativeValue m_left = 0;
281 AbsoluteOrRelativeValue m_top = 0;
282 AbsoluteOrRelativeValue m_right = 0;
283 AbsoluteOrRelativeValue m_bottom = 0;
289 using Borders = Outline;
290 using Padding = Outline;
Class to store the a value that is either a constant or a ratio.
Definition AbsoluteOrRelativeValue.hpp:43
Definition Outline.hpp:39
TGUI_CONSTEXPR Outline(AbsoluteOrRelativeValue size=0)
Default constructor that initializes the outline.
Definition Outline.hpp:48
TGUI_CONSTEXPR float getLeft() const
Returnes the width of the left border.
Definition Outline.hpp:113
TGUI_CONSTEXPR float getTop() const
Returnes the height of the top border.
Definition Outline.hpp:125
TGUI_CONSTEXPR bool operator!=(const Outline &outline) const
Compares two outlines.
Definition Outline.hpp:187
TGUI_CONSTEXPR float getRight() const
Returnes the width of the right border.
Definition Outline.hpp:137
TGUI_CONSTEXPR Outline(AbsoluteOrRelativeValue leftBorderWidth, AbsoluteOrRelativeValue topBorderHeight, AbsoluteOrRelativeValue rightBorderWidth, AbsoluteOrRelativeValue bottomBorderHeight)
Constructor that initializes the outline.
Definition Outline.hpp:98
TGUI_CONSTEXPR Outline operator+(const Outline &other) const
Adds two outlines together (e.g. to add padding and borders)
Definition Outline.hpp:198
TGUI_CONSTEXPR Outline(T size)
Constructor that initializes the outline.
Definition Outline.hpp:64
TGUI_CONSTEXPR bool operator==(const Outline &outline) const
Compares two outlines.
Definition Outline.hpp:173
TGUI_CONSTEXPR Outline & operator+=(const Outline &other)
Adds an outline to this instance (e.g. to add padding and borders)
Definition Outline.hpp:224
TGUI_CONSTEXPR Outline(AbsoluteOrRelativeValue width, AbsoluteOrRelativeValue height)
Constructor that initializes the outline.
Definition Outline.hpp:80
TGUI_CONSTEXPR Outline & operator-=(const Outline &other)
Subtracts an outline from this instance.
Definition Outline.hpp:238
TGUI_CONSTEXPR Outline operator-(const Outline &other) const
Subtracts two outlines from each other.
Definition Outline.hpp:211
TGUI_CONSTEXPR float getBottom() const
Returnes the height of the bottom border.
Definition Outline.hpp:149
TGUI_CONSTEXPR Vector2f getOffset() const
Returnes the width of the left and top borders.
Definition Outline.hpp:159
T y
Y coordinate of the vector.
Definition Vector2.hpp:142
T x
X coordinate of the vector.
Definition Vector2.hpp:141
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36