A class used to hold node-specific layout configuration (such as, for example, Margin).
Subclasses of CYILayout will also subclass CYILayoutConfig (or one of its subclasses) if they use custom node-specific layout configuration values.
#include <layout/YiLayoutConfig.h>
Classes | |
class | CubeOffset |
A class used to hold a 3D 'cube offset'. More... | |
class | SizeConstraint |
A class used to hold a size constraint for a specific dimension. More... | |
class | SizeConstraints |
A class used to hold the size constraint for each of the 3 dimensions. A flag that indicates if the width/height aspect ratio should be maintained is also contained in this class. More... | |
Public Types | |
enum | Gravity { Gravity::None, Gravity::Center, Gravity::Left, Gravity::Right, Gravity::Top, Gravity::Bottom, Gravity::Front, Gravity::Back, Gravity::TopLeft, Gravity::TopRight, Gravity::BottomLeft, Gravity::BottomRight } |
typedef CubeOffset | Margin |
Public Member Functions | |
CYILayoutConfig () | |
virtual | ~CYILayoutConfig () |
virtual std::unique_ptr< CYILayoutConfig > | Clone () const |
virtual void | ConfigureFrom (const IYIPropertiesSource *pSource) |
void | SetSizeConstraints (const SizeConstraints &sizeConstraints) |
const SizeConstraints & | GetSizeConstraints () const |
void | SetMargin (const Margin &margin) |
const Margin & | GetMargin () const |
void | SetLayoutable (bool layoutable) |
bool | IsLayoutable () const |
void | SetItemGravity (const glm::vec3 &itemGravity) |
void | SetItemGravity (Gravity itemGravity) |
const glm::vec3 & | GetItemGravity () const |
void | SetIsBackground (bool background) |
bool | IsBackground () const |
Static Public Member Functions | |
static void | RemoveSuffixFromNumber (CYIString &inOutNumber, CYIString &outSuffix) |
static glm::vec3 | ReadGravityFrom (CYIStringView key, const IYIPropertiesSource *pSource, const glm::vec3 &defaultGravity) |
static glm::vec3 | GetGravityVectorFor (Gravity gravity) |
typedef CubeOffset CYILayoutConfig::Margin |
|
strong |
An enum listing often-used gravity values. Note that not all possible gravity values are represented here. Also note that all presets (except Back and None) will use a 'depth' gravity of 'Front'.
CYILayoutConfig::CYILayoutConfig | ( | ) |
|
virtual |
|
virtual |
Creates a duplicate of this layout configuration object. The created type is the dynamic type of this object.
Reimplemented in CYIGridLayoutConfig, and CYIAnimatingLayoutConfig.
|
virtual |
Extracts configuration properties from properties source pSource (typically a scene node) and assigns them to this object.
Reimplemented in CYIGridLayoutConfig, and CYIAnimatingLayoutConfig.
|
static |
Returns the gravity vector equivalent to the gravity enum gravity.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Extracts gravity values from pSource using the property key key. If no value is specified (or only partial values are specified), then the values from default are used.
|
static |
An utility function that removes the 'suffix' from inOutNumber, and stores it in outSuffix.
This function removes a text suffix from a number, and stores it in a separate CYIString. For example, if called with "54.2 ms" for inOutNumber, the inOutNumber string will be set to "54.2" and the outSuffix string will be set to "ms". Spaces between the number and the suffix are removed.
The suffix is considered to start at the first character encountered that is no within this group: '0123456789 .-' For example, if called with "54.2+ suffix" for inOutNumber, the inOutNumber string will be set to "54.2" and the outSuffix string will be set to "+ suffix".
void CYILayoutConfig::SetIsBackground | ( | bool | background | ) |
Sets whether the associated node should be laid out as a 'background' to its container.
Background nodes will be laid out to completely fill the container. The padding values configured in the container will be ignored, but the margin values configured in the node will be respected.
void CYILayoutConfig::SetItemGravity | ( | const glm::vec3 & | itemGravity | ) |
Sets the item gravity to gravity.
Each component of the provided vector specifies a gravity value for the given dimension. A value of 0.0 means 'align to the start of the container', a value of 1.0 means 'align to the end of the container', and a value of 0.5 means 'center on the container'. The special value -1.0 means 'use the gravity value of the associated layout'.
void CYILayoutConfig::SetItemGravity | ( | Gravity | itemGravity | ) |
Sets the item gravity to one of the pre-defined gravity values.
void CYILayoutConfig::SetLayoutable | ( | bool | layoutable | ) |
Sets the layoutable flag to layoutable.
By default, all scene nodes are layoutable. However, if this function is called with layoutable = false, then the scene node that has this configuration object will be considered non-layoutable. Non-layoutable scene nodes will still be measured and have the ApplyMeasurements function called on them, but layouts that attempt to layout those scene nodes will not set their position, will not change their size, and will not consider the scene node's size in their layout calculations.
void CYILayoutConfig::SetMargin | ( | const Margin & | margin | ) |
Sets the margin to margin.
The margin of an object is a blank area left around the object when the object is laid out. The margin effectively increases the size of an object when it is laid out (but without affecting the content or children of the object).
void CYILayoutConfig::SetSizeConstraints | ( | const SizeConstraints & | sizeConstraints | ) |
Sets the size constraints to sizeConstraints.