Gorgon Game Engine
basic_Margin< T_ > Class Template Reference

This class defines Margin of an object or an area. More...

Inheritance diagram for basic_Margin< T_ >:
[legend]

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_Marginoperator+= (const basic_Margin &right)
 Adds a Margin to this one. More...
 
basic_Margin operator- (const basic_Margin &right) const
 Subtracts two Margin. More...
 
basic_Marginoperator-= (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...
 

Detailed Description

template<class T_>
class Gorgon::Geometry::basic_Margin< T_ >

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.

Member Typedef Documentation

◆ BaseType

typedef T_ BaseType

Base type of the margin elements.

Constructor & Destructor Documentation

◆ basic_Margin() [1/4]

Default constructor.

◆ basic_Margin() [2/4]

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() [3/4]

basic_Margin ( T_  horizontal,
T_  vertical 
)

Sets horizontal and vertical Margin separately.

◆ basic_Margin() [4/4]

basic_Margin ( T_  left,
T_  top,
T_  right,
T_  bottom 
)

Sets all Margin separately.

Member Function Documentation

◆ AddToBottom()

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.

Parameters
heightof the object
Marginto be applied to the object

◆ AddToLeft()

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.

Parameters
widthof the object
Marginto be applied to the object

◆ AddToRight()

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.

Parameters
widthof the object
Marginto be applied to the object

◆ AddToTop()

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.

Parameters
heightof the object
Marginto be applied to the object

◆ CombineMargins()

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

◆ CombinePadding()

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

◆ Horizontal()

T_ Horizontal ( ) const

Calculates and returns the total Margin in X axis.

◆ operator std::string()

operator std::string ( ) const
explicit

Converts this object to a string.

TODO

◆ operator!=()

bool operator!= ( const basic_Margin< T_ > &  margin) const

Compares two Margin.

◆ operator+()

basic_Margin operator+ ( const basic_Margin< T_ > &  right) const

Adds two Margin.

◆ operator+=()

basic_Margin& operator+= ( const basic_Margin< T_ > &  right)

Adds a Margin to this one.

◆ operator-()

basic_Margin operator- ( const basic_Margin< T_ > &  right) const

Subtracts two Margin.

◆ operator-=()

basic_Margin& operator-= ( const basic_Margin< T_ > &  right)

Subtracts a Margin from this one.

◆ operator==()

bool operator== ( const basic_Margin< T_ > &  margin) const

Compares two Margin.

◆ TopLeft()

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.

◆ Total()

basic_Size<T_> Total ( ) const

Calculates and returns the total Margin in X axis.

◆ TotalX()

T_ TotalX ( ) const

Calculates and returns the total Margin in X axis.

◆ TotalY()

T_ TotalY ( ) const

Calculates and returns the total Margin in Y axis.

◆ Vertical()

T_ Vertical ( ) const

Calculates and returns the total Margin in Y axis.

Member Data Documentation

◆ Bottom

T_ Bottom

Bottom margin.

◆ Left

T_ Left

Left margin.

◆ Right

T_ Right

Right margin.

◆ Top

T_ Top

Top margin.


The documentation for this class was generated from the following file: