added percentage feature
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -8,3 +8,8 @@
|
||||
|
||||
# Visual studio code
|
||||
.vscode
|
||||
*.pdb
|
||||
*.tlog
|
||||
*.obj
|
||||
*.pch
|
||||
*.log
|
||||
|
@@ -15,7 +15,7 @@ static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) {
|
||||
int result = 0;
|
||||
if (gManagedFunc) {
|
||||
char buffer[256];
|
||||
result = vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
result = vsnprintf_s(buffer, sizeof(buffer), format, args);
|
||||
(*gManagedFunc)(level, buffer);
|
||||
}
|
||||
return result;
|
||||
|
4
enums.py
4
enums.py
@@ -16,6 +16,10 @@ ENUMS = {
|
||||
'Inherit',
|
||||
'LTR',
|
||||
'RTL',
|
||||
],
|
||||
'Unit': [
|
||||
'Pixel',
|
||||
'Percent',
|
||||
],
|
||||
'FlexDirection': [
|
||||
'Column',
|
||||
|
@@ -21,6 +21,12 @@ typedef enum YGFlexDirection {
|
||||
YGFlexDirectionCount,
|
||||
} YGFlexDirection;
|
||||
|
||||
typedef enum YGUnit {
|
||||
YGUnitPixel,
|
||||
YGUnitPercent,
|
||||
YGUnitModeCount,
|
||||
} YGUnit;
|
||||
|
||||
typedef enum YGMeasureMode {
|
||||
YGMeasureModeUndefined,
|
||||
YGMeasureModeExactly,
|
||||
|
742
yoga/Yoga.c
742
yoga/Yoga.c
File diff suppressed because it is too large
Load Diff
47
yoga/Yoga.h
47
yoga/Yoga.h
@@ -38,6 +38,16 @@ typedef struct YGSize {
|
||||
float height;
|
||||
} YGSize;
|
||||
|
||||
typedef struct YGValue{
|
||||
float value;
|
||||
YGUnit unit;
|
||||
bool defined;
|
||||
|
||||
} YGValue;
|
||||
|
||||
WIN_EXPORT YGValue YGPx(const float value);
|
||||
WIN_EXPORT YGValue YGPercent(const float value);
|
||||
|
||||
typedef struct YGNode *YGNodeRef;
|
||||
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
||||
float width,
|
||||
@@ -82,7 +92,8 @@ WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool YGValueIsUndefined(const float value);
|
||||
WIN_EXPORT bool YGValueIsUndefinedf(const float value);
|
||||
WIN_EXPORT bool YGValueIsUndefined(const YGValue value);
|
||||
|
||||
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
||||
const float width,
|
||||
@@ -107,12 +118,24 @@ WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode
|
||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
||||
|
||||
#define YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \
|
||||
YG_NODE_STYLE_PROPERTY(float, name, paramName); \
|
||||
WIN_EXPORT void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name##WithUnit(const YGNodeRef node);
|
||||
|
||||
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
||||
const YGEdge edge, \
|
||||
const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
||||
|
||||
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT(type, name, paramName) \
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, name, paramName) \
|
||||
WIN_EXPORT void YGNodeStyleSet##name##WithUnit(const YGNodeRef node, \
|
||||
const YGEdge edge, \
|
||||
const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name##WithUnit(const YGNodeRef node, const YGEdge edge);
|
||||
|
||||
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
|
||||
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
|
||||
|
||||
@@ -134,19 +157,19 @@ YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
||||
WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, FlexBasis, flexBasis);
|
||||
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Position, position);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Margin, margin);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Padding, padding);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Position, position);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Margin, margin);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Padding, padding);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Border, border);
|
||||
|
||||
YG_NODE_STYLE_PROPERTY(float, Width, width);
|
||||
YG_NODE_STYLE_PROPERTY(float, Height, height);
|
||||
YG_NODE_STYLE_PROPERTY(float, MinWidth, minWidth);
|
||||
YG_NODE_STYLE_PROPERTY(float, MinHeight, minHeight);
|
||||
YG_NODE_STYLE_PROPERTY(float, MaxWidth, maxWidth);
|
||||
YG_NODE_STYLE_PROPERTY(float, MaxHeight, maxHeight);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, Width, width);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, Height, height);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinWidth, minWidth);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinHeight, minHeight);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxWidth, maxWidth);
|
||||
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxHeight, maxHeight);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
// Aspect ratio control the size of the undefined dimension of a node.
|
||||
|
Reference in New Issue
Block a user