Add basic Xamarin.iOS support #280

Closed
rmarinho wants to merge 20 commits from add-xamarin-ios into master
293 changed files with 2957 additions and 24192 deletions
Showing only changes of commit 01f497775e - Show all commits

View File

@@ -53,7 +53,7 @@
- (NSUInteger)yg_numberOfChildren
{
return YGNodeChildCount([self ygNode]);
return YGNodeGetChildCount([self ygNode]);
}
#pragma mark - Setters
@@ -295,7 +295,7 @@ static void YGAttachNodesFromViewHierachy(UIView *view) {
}
BOOL shouldReconstructChildList = NO;
if (YGNodeChildCount(node) != subviewsToInclude.count) {
if (YGNodeGetChildCount(node) != subviewsToInclude.count) {
shouldReconstructChildList = YES;
} else {
for (int i = 0; i < subviewsToInclude.count; i++) {
@@ -324,8 +324,8 @@ static void YGRemoveAllChildren(const YGNodeRef node)
return;
}
while (YGNodeChildCount(node) > 0) {
YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeChildCount(node) - 1));
while (YGNodeGetChildCount(node) > 0) {
YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1));
}
}

View File

@@ -14,22 +14,19 @@ namespace Facebook.Yoga
{
splhack commented 2016-12-15 22:05:01 -08:00 (Migrated from github.com)
Review

It will be fixed in #277, can you revert changes of csharp/Facebook.Yoga/Native.cs, csharp/Facebook.Yoga/YogaLogger.cs, csharp/Facebook.Yoga/YogaNode.cs?

It will be fixed in #277, can you revert changes of csharp/Facebook.Yoga/Native.cs, csharp/Facebook.Yoga/YogaLogger.cs, csharp/Facebook.Yoga/YogaNode.cs?
rmarinho commented 2016-12-16 06:35:50 -08:00 (Migrated from github.com)
Review

Done

Done
internal static class Native
{
#if UNITY_IOS && !UNITY_EDITOR || __IOS__
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
private const string DllName = "__Internal";
#else
private const string DllName = "yoga";
#endif
#if !__IOS__
[DllImport(DllName)]
public static extern void YGInteropSetLogger(
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
#endif
[DllImport(DllName)]
public static extern IntPtr YGNodeNew();
#if !__IOS__
[DllImport(DllName)]
public static extern void YGNodeInit(IntPtr node);
#endif
[DllImport(DllName)]
public static extern void YGNodeFree(IntPtr node);
@@ -58,7 +55,7 @@ namespace Facebook.Yoga
public static extern IntPtr YGNodeGetChild(IntPtr node, uint index);
[DllImport(DllName)]
public static extern uint YGNodeChildCount(IntPtr node);
public static extern uint YGNodeGetChildCount(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeCalculateLayout(IntPtr node,

View File

@@ -36,7 +36,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
obj->setFieldValue(topField, YGNodeLayoutGetTop(root));
YGTransferLayoutDirection(root, obj);
for (uint32_t i = 0; i < YGNodeChildCount(root); i++) {
for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) {
YGTransferLayoutOutputsRecursive(YGNodeGetChild(root, i));
}
} else {

View File

@@ -13,7 +13,7 @@
TEST(YogaTest, assert_default_values) {
const YGNodeRef root = YGNodeNew();
ASSERT_EQ(0, YGNodeChildCount(root));
ASSERT_EQ(0, YGNodeGetChildCount(root));
ASSERT_EQ(NULL, YGNodeGetChild(root, 1));
ASSERT_EQ(YGDirectionInherit, YGNodeStyleGetDirection(root));

View File

@@ -256,7 +256,7 @@ void YGNodeFree(const YGNodeRef node) {
node->parent = NULL;
}
const uint32_t childCount = YGNodeChildCount(node);
const uint32_t childCount = YGNodeGetChildCount(node);
for (uint32_t i = 0; i < childCount; i++) {
const YGNodeRef child = YGNodeGetChild(node, i);
child->parent = NULL;
@@ -268,7 +268,7 @@ void YGNodeFree(const YGNodeRef node) {
}
void YGNodeFreeRecursive(const YGNodeRef root) {
while (YGNodeChildCount(root) > 0) {
while (YGNodeGetChildCount(root) > 0) {
const YGNodeRef child = YGNodeGetChild(root, 0);
YGNodeRemoveChild(root, child);
YGNodeFreeRecursive(child);
@@ -277,7 +277,7 @@ void YGNodeFreeRecursive(const YGNodeRef root) {
}
void YGNodeReset(const YGNodeRef node) {
YG_ASSERT(YGNodeChildCount(node) == 0, "Cannot reset a node which still has children attached");
YG_ASSERT(YGNodeGetChildCount(node) == 0, "Cannot reset a node which still has children attached");
YG_ASSERT(node->parent == NULL, "Cannot reset a node still attached to a parent");
YGNodeListFree(node->children);
@@ -303,7 +303,7 @@ void YGNodeSetMeasureFunc(const YGNodeRef node, YGMeasureFunc measureFunc) {
if (measureFunc == NULL) {
node->measure = NULL;
} else {
YG_ASSERT(YGNodeChildCount(node) == 0,
YG_ASSERT(YGNodeGetChildCount(node) == 0,
"Cannot set measure function: Nodes with measure functions cannot have children.");
node->measure = measureFunc;
}
@@ -337,7 +337,7 @@ YGNodeRef YGNodeGetParent(const YGNodeRef node) {
return node->parent;
}
inline uint32_t YGNodeChildCount(const YGNodeRef node) {
inline uint32_t YGNodeGetChildCount(const YGNodeRef node) {
return YGNodeListCount(node->children);
}

View File

@@ -65,7 +65,7 @@ WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node);
WIN_EXPORT uint32_t YGNodeChildCount(const YGNodeRef node);
WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node);
WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
const float availableWidth,