
#include "yoga/Yoga.h"

native enum YGDirection;
native enum YGEdge;
native enum YGJustify as Sandbox.UI.Justify;
native enum YGAlign as Sandbox.UI.Align;
native enum YGPositionType as Sandbox.UI.PositionMode;
native enum YGWrap as Sandbox.UI.Wrap;
native enum YGOverflow as Sandbox.UI.OverflowMode;
native enum YGDisplay as Sandbox.UI.DisplayMode;
native enum YGFlexDirection as Sandbox.UI.FlexDirection;

native enum YGGutter;
native struct YGValue;
native enum YGUnit;

native static class globalYoga as Yoga
{
	YGNodeRef YGNodeNew();
	YGNodeRef YGNodeNewWithConfig( YGConfigRef config );
	void YGNodeFree( YGNodeRef r );
	void YGNodeReset( YGNodeRef r );

	[callback]
	void YGNodeCalculateLayout( YGNodeRef r, float ownerWidth, float ownerHeight, YGDirection direction );

	bool YGNodeGetHasNewLayout( YGNodeRef r );
	void YGNodeSetHasNewLayout( YGNodeRef r, bool b );
	void YGNodeIsDirty( YGNodeRef r );
	void YGNodeMarkDirty( YGNodeRef r );
	void YGNodeInsertChild( YGNodeRef owner, YGNodeRef child, int index );
	void YGNodeRemoveChild( YGNodeRef owner, YGNodeRef child );
	void YGNodeRemoveAllChildren( YGNodeRef owner );
	ulong YGNodeGetChildCount( YGNodeRef owner );
	YGNodeRef YGNodeGetParent( YGNodeRef owner );
	void YGNodeSetConfig( YGNodeRef r, YGConfigRef congig );

	float YGNodeLayoutGetLeft( YGNodeRef r );
	float YGNodeLayoutGetTop( YGNodeRef r );
	float YGNodeLayoutGetRight( YGNodeRef r );
	float YGNodeLayoutGetBottom( YGNodeRef r );
	float YGNodeLayoutGetWidth( YGNodeRef r );
	float YGNodeLayoutGetHeight( YGNodeRef r );
	YGDirection YGNodeLayoutGetDirection( YGNodeRef r );
	float YGNodeLayoutGetHadOverflow( YGNodeRef r );

	float YGNodeLayoutGetMargin(YGNodeRef node, YGEdge edge);
	float YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge);
	float YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge);

	YGConfigRef YGConfigNew();
	void YGConfigFree( YGConfigRef c );
	void YGConfigSetUseWebDefaults(YGConfigRef config, bool enabled);
	void YGConfigSetPointScaleFactor( YGConfigRef config, float pixelsInPoint);

	void YGNodeCopyStyle(YGNodeRef dstNode, YGNodeRef srcNode);

	void YGNodeStyleSetDirection(YGNodeRef node, YGDirection direction);
	YGDirection YGNodeStyleGetDirection(YGNodeRef node);

	void YGNodeStyleSetFlexDirection( YGNodeRef node, YGFlexDirection flexDirection);
	YGFlexDirection YGNodeStyleGetFlexDirection(YGNodeRef node);

	void YGNodeStyleSetJustifyContent( YGNodeRef node, YGJustify justifyContent);
	YGJustify YGNodeStyleGetJustifyContent(YGNodeRef node);

	void YGNodeStyleSetAlignContent(YGNodeRef node, YGAlign alignContent);
	YGAlign YGNodeStyleGetAlignContent(YGNodeRef node);

	void YGNodeStyleSetAlignItems(YGNodeRef node, YGAlign alignItems);
	YGAlign YGNodeStyleGetAlignItems(YGNodeRef node);

	void YGNodeStyleSetAlignSelf(YGNodeRef node, YGAlign alignSelf);
	YGAlign YGNodeStyleGetAlignSelf(YGNodeRef node);

	void YGNodeStyleSetPositionType( YGNodeRef node, YGPositionType positionType);
	YGPositionType YGNodeStyleGetPositionType(YGNodeRef node);

	void YGNodeStyleSetFlexWrap(YGNodeRef node, YGWrap flexWrap);
	YGWrap YGNodeStyleGetFlexWrap(YGNodeRef node);

	void YGNodeStyleSetOverflow(YGNodeRef node, YGOverflow overflow);
	YGOverflow YGNodeStyleGetOverflow(YGNodeRef node);

	void YGNodeStyleSetDisplay(YGNodeRef node, YGDisplay display);
	YGDisplay YGNodeStyleGetDisplay(YGNodeRef node);

	void YGNodeStyleSetFlex(YGNodeRef node, float flex);
	float YGNodeStyleGetFlex(YGNodeRef node);

	void YGNodeStyleSetFlexGrow(YGNodeRef node, float flexGrow);
	float YGNodeStyleGetFlexGrow(YGNodeRef node);

	void YGNodeStyleSetFlexShrink(YGNodeRef node, float flexShrink);
	float YGNodeStyleGetFlexShrink(YGNodeRef node);

	void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
	void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
	void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
	YGValue YGNodeStyleGetFlexBasis(YGNodeRef node);

	void YGNodeStyleSetPosition(YGNodeRef node, YGEdge edge, float position);
	void YGNodeStyleSetPositionPercent(YGNodeRef node, YGEdge edge, float position);
	YGValue YGNodeStyleGetPosition(YGNodeRef node, YGEdge edge);

	void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float margin);
	void YGNodeStyleSetMarginPercent(YGNodeRef node, YGEdge edge, float margin);
	void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge);
	YGValue YGNodeStyleGetMargin(YGNodeRef node, YGEdge edge);

	void YGNodeStyleSetPadding(YGNodeRef node, YGEdge edge, float padding);
	void YGNodeStyleSetPaddingPercent(YGNodeRef node, YGEdge edge, float padding);
	YGValue YGNodeStyleGetPadding(YGNodeRef node, YGEdge edge);

	void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, float border);
	float YGNodeStyleGetBorder(YGNodeRef node, YGEdge edge);

	void YGNodeStyleSetGap(YGNodeRef node, YGGutter gutter, float gapLength);
	float YGNodeStyleGetGap(YGNodeRef node, YGGutter gutter);

	void YGNodeStyleSetWidth(YGNodeRef node, float width);
	void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
	void YGNodeStyleSetWidthAuto(YGNodeRef node);
	YGValue YGNodeStyleGetWidth(YGNodeRef node);

	void YGNodeStyleSetHeight(YGNodeRef node, float height);
	void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
	void YGNodeStyleSetHeightAuto(YGNodeRef node);
	YGValue YGNodeStyleGetHeight(YGNodeRef node);

	void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
	void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
	YGValue YGNodeStyleGetMinWidth(YGNodeRef node);

	void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
	void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
	YGValue YGNodeStyleGetMinHeight(YGNodeRef node);

	void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
	void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
	YGValue YGNodeStyleGetMaxWidth(YGNodeRef node);

	void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
	void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
	YGValue YGNodeStyleGetMaxHeight(YGNodeRef node);

	void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);
	float YGNodeStyleGetAspectRatio(YGNodeRef node);

	void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc);
	bool YGNodeHasMeasureFunc(YGNodeRef node);
}

[small]
native struct YGNodeRef;

[small]
native struct YGConfigRef;

[small]
native struct YGMeasureFunc;
// typedef YGSize (*YGMeasureFunc)( YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode);