Helper class to create an AbsoluteOrRelativeValue object containing a relative value without using a string.
More...
#include <TGUI/AbsoluteOrRelativeValue.hpp>
|
constexpr | RelativeValue (float ratio) |
| Default constructor that sets the given ratio.
|
|
constexpr | AbsoluteOrRelativeValue ()=default |
| Default constructor.
|
|
template<typename T , typename = typename std::enable_if_t<std::is_arithmetic<T>::value, T>> |
constexpr | AbsoluteOrRelativeValue (T constant) |
| Constructor to set constant.
|
|
| AbsoluteOrRelativeValue (const char *expression) |
| Construct the value from a string that either contains a value or a percentage.
|
|
| AbsoluteOrRelativeValue (const String &expression) |
| Construct the value from a string that either contains a value or a percentage.
|
|
constexpr float | getValue () const |
| Returns the value.
|
|
constexpr float | getRatio () const |
| Returns the stored ratio.
|
|
constexpr bool | isConstant () const |
| Returns whether the value is constant or a ratio.
|
|
constexpr void | updateParentSize (float newParentSize) |
|
String | toString () const |
|
|
bool | m_constant = true |
|
float | m_value = 0 |
|
float | m_ratio = 0 |
|
float | m_parentValue = 0 |
|
Helper class to create an AbsoluteOrRelativeValue object containing a relative value without using a string.
◆ RelativeValue()
tgui::RelativeValue::RelativeValue |
( |
float | ratio | ) |
|
|
inlineexplicitconstexpr |
Default constructor that sets the given ratio.
- Parameters
-
ratio | Ratio of the value relative to its parent size |
The documentation for this struct was generated from the following file: