2020-08-04 12:31:33 +08:00
|
|
|
#ifndef __MARGIN_H__
|
|
|
|
#define __MARGIN_H__
|
|
|
|
|
|
|
|
#include "FairyGUIMacros.h"
|
|
|
|
|
|
|
|
NS_FGUI_BEGIN
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
//copy from ax::ui::Margin
|
2020-08-04 12:31:33 +08:00
|
|
|
class Margin
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Left margin.
|
|
|
|
*/
|
|
|
|
float left;
|
|
|
|
/**
|
|
|
|
* Top margin.
|
|
|
|
*/
|
|
|
|
float top;
|
|
|
|
/**
|
|
|
|
* Right margin.
|
|
|
|
*/
|
|
|
|
float right;
|
|
|
|
/**
|
|
|
|
* Bottom margin.
|
|
|
|
*/
|
|
|
|
float bottom;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
|
|
|
Margin();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a Margin instance with left, top, right and bottom margins.
|
|
|
|
*@param l Left margin in float.
|
|
|
|
*@param t Top margin in float.
|
|
|
|
*@param r Right margin in float.
|
|
|
|
*@param b Bottom margin in float.
|
|
|
|
*/
|
|
|
|
Margin(float l, float t, float r, float b);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy constructor.
|
|
|
|
*/
|
|
|
|
Margin(const Margin& other);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy assignment operator.
|
|
|
|
*/
|
|
|
|
Margin& operator= (const Margin& other);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change margin with left, top, right and bottom margin.
|
|
|
|
*@param l Left margin in float.
|
|
|
|
*@param t Top margin in float.
|
|
|
|
*@param r Right margin in float.
|
|
|
|
*@param b Bottom margin in float.
|
|
|
|
*/
|
|
|
|
void setMargin(float l, float t, float r, float b);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test equality of two margins.
|
|
|
|
*@param target A Margin instance.
|
|
|
|
*@return True if two margins are equal, false otherwise.
|
|
|
|
*/
|
|
|
|
bool equals(const Margin& target) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A margin constant with all margins equal zero.
|
|
|
|
*/
|
|
|
|
static const Margin ZERO;
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_FGUI_END
|
|
|
|
|
|
|
|
#endif
|