![]() |
Gorgon Game Engine
|
This class defines Margin of an object or an area. More...
Public Types | |
typedef T_ | BaseType |
Base type of the margin elements. More... | |
Public Member Functions | |
basic_Margin () | |
Default constructor. More... | |
basic_Margin (T_ all) | |
Sets all Margin to the given value. More... | |
basic_Margin (T_ horizontal, T_ vertical) | |
Sets horizontal and vertical Margin separately. More... | |
basic_Margin (T_ left, T_ top, T_ right, T_ bottom) | |
Sets all Margin separately. More... | |
basic_Margin | AddToBottom (T_ height, basic_Margin Margin=0) |
Adds an object to the bottom of this Margin to create a new Margin marking the used area. More... | |
basic_Margin | AddToLeft (T_ width, basic_Margin Margin=0) |
Adds an object to the left of this Margin to create a new Margin marking the used area. More... | |
basic_Margin | AddToRight (T_ width, basic_Margin Margin=0) |
Adds an object to the right of this Margin to create a new Margin marking the used area. More... | |
basic_Margin | AddToTop (T_ height, const basic_Margin &Margin=0) |
Adds an object to the top of this Margin to create a new Margin marking the used area. More... | |
basic_Margin | CombineMargins (const basic_Margin &other) const |
Combines two margins that are next to each other, basically taking the maximum margin from each side with its opposite. More... | |
basic_Margin | CombinePadding (const basic_Margin &other) const |
Combines two margins that are inside each other, basically taking the maximum margin from each side. More... | |
T_ | Horizontal () const |
Calculates and returns the total Margin in X axis. More... | |
operator std::string () const | |
Converts this object to a string. More... | |
bool | operator!= (const basic_Margin &margin) const |
Compares two Margin. More... | |
basic_Margin | operator+ (const basic_Margin &right) const |
Adds two Margin. More... | |
basic_Margin & | operator+= (const basic_Margin &right) |
Adds a Margin to this one. More... | |
basic_Margin | operator- (const basic_Margin &right) const |
Subtracts two Margin. More... | |
basic_Margin & | operator-= (const basic_Margin &right) |
Subtracts a Margin from this one. More... | |
bool | operator== (const basic_Margin &margin) const |
Compares two Margin. More... | |
basic_Point< T_ > | TopLeft () const |
Top left coordinate of the object that will be placed within a <0:inf, 0:inf> bounds that has this Margin. More... | |
basic_Size< T_ > | Total () const |
Calculates and returns the total Margin in X axis. More... | |
T_ | TotalX () const |
Calculates and returns the total Margin in X axis. More... | |
T_ | TotalY () const |
Calculates and returns the total Margin in Y axis. More... | |
T_ | Vertical () const |
Calculates and returns the total Margin in Y axis. More... | |
Public Attributes | |
T_ | Bottom |
Bottom margin. More... | |
T_ | Left |
Left margin. More... | |
T_ | Right |
Right margin. More... | |
T_ | Top |
Top margin. More... | |
This class defines Margin of an object or an area.
This class is designed to be used with Bounds object. Order of components are Left, Top, Right, Bottom. Negative margin values are allowed.
typedef T_ BaseType |
Base type of the margin elements.
basic_Margin | ( | ) |
Default constructor.
basic_Margin | ( | T_ | all | ) |
Sets all Margin to the given value.
Intentionally left implicit as Margin can be represented as a simple integer
basic_Margin | ( | T_ | horizontal, |
T_ | vertical | ||
) |
Sets horizontal and vertical Margin separately.
basic_Margin | ( | T_ | left, |
T_ | top, | ||
T_ | right, | ||
T_ | bottom | ||
) |
Sets all Margin separately.
basic_Margin AddToBottom | ( | T_ | height, |
basic_Margin< T_ > | Margin = 0 |
||
) |
Adds an object to the bottom of this Margin to create a new Margin marking the used area.
height | of the object |
Margin | to be applied to the object |
basic_Margin AddToLeft | ( | T_ | width, |
basic_Margin< T_ > | Margin = 0 |
||
) |
Adds an object to the left of this Margin to create a new Margin marking the used area.
width | of the object |
Margin | to be applied to the object |
basic_Margin AddToRight | ( | T_ | width, |
basic_Margin< T_ > | Margin = 0 |
||
) |
Adds an object to the right of this Margin to create a new Margin marking the used area.
width | of the object |
Margin | to be applied to the object |
basic_Margin AddToTop | ( | T_ | height, |
const basic_Margin< T_ > & | Margin = 0 |
||
) |
Adds an object to the top of this Margin to create a new Margin marking the used area.
height | of the object |
Margin | to be applied to the object |
basic_Margin CombineMargins | ( | const basic_Margin< T_ > & | other | ) | const |
Combines two margins that are next to each other, basically taking the maximum margin from each side with its opposite.
Only one of the values should be used. Negative margins do not collapse
basic_Margin CombinePadding | ( | const basic_Margin< T_ > & | other | ) | const |
Combines two margins that are inside each other, basically taking the maximum margin from each side.
Negative margins do not collapse
T_ Horizontal | ( | ) | const |
Calculates and returns the total Margin in X axis.
|
explicit |
Converts this object to a string.
TODO
bool operator!= | ( | const basic_Margin< T_ > & | margin | ) | const |
Compares two Margin.
basic_Margin operator+ | ( | const basic_Margin< T_ > & | right | ) | const |
Adds two Margin.
basic_Margin& operator+= | ( | const basic_Margin< T_ > & | right | ) |
Adds a Margin to this one.
basic_Margin operator- | ( | const basic_Margin< T_ > & | right | ) | const |
Subtracts two Margin.
basic_Margin& operator-= | ( | const basic_Margin< T_ > & | right | ) |
Subtracts a Margin from this one.
bool operator== | ( | const basic_Margin< T_ > & | margin | ) | const |
Compares two Margin.
basic_Point<T_> TopLeft | ( | ) | const |
Top left coordinate of the object that will be placed within a <0:inf, 0:inf> bounds that has this Margin.
basic_Size<T_> Total | ( | ) | const |
Calculates and returns the total Margin in X axis.
T_ TotalX | ( | ) | const |
Calculates and returns the total Margin in X axis.
T_ TotalY | ( | ) | const |
Calculates and returns the total Margin in Y axis.
T_ Vertical | ( | ) | const |
Calculates and returns the total Margin in Y axis.
T_ Bottom |
Bottom margin.
T_ Left |
Left margin.
T_ Right |
Right margin.
T_ Top |
Top margin.