Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d70f289e73 | ||
|
498a5980e8 | ||
|
8021c5d968 | ||
|
c536ab214d | ||
|
adb81e2a1e | ||
|
c4a3e12add | ||
|
a3d7d72421 | ||
|
47266b9ae8 | ||
|
e39f13a8ea | ||
|
c04604dbc0 | ||
|
1782646723 | ||
|
78e64e3d5b | ||
|
0acb620159 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -7,6 +7,10 @@
|
||||
/gentest/test.html
|
||||
.buckversion
|
||||
|
||||
# Jekyll
|
||||
/.sass-cache/
|
||||
/_site/
|
||||
|
||||
# Visual studio code
|
||||
.vscode
|
||||
*.pdb
|
||||
|
58
.hgignore
58
.hgignore
@@ -1,58 +0,0 @@
|
||||
.DS_STORE
|
||||
|
||||
/buck-cache/
|
||||
/buck-out/
|
||||
/.buckconfig.local
|
||||
/.buckd
|
||||
/gentest/test.html
|
||||
.buckversion
|
||||
|
||||
# Visual studio code
|
||||
.vscode
|
||||
*.pdb
|
||||
*.tlog
|
||||
*.obj
|
||||
*.pch
|
||||
*.log
|
||||
*.orig
|
||||
|
||||
# Xcode
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
@@ -214,7 +214,7 @@
|
||||
[container.yoga applyLayout];
|
||||
|
||||
for (UIView *view in container.subviews) {
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), view.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
}
|
||||
|
||||
subview3.yoga.isIncludedInLayout = NO;
|
||||
@@ -287,7 +287,7 @@
|
||||
subview3.yoga.isIncludedInLayout = YES;
|
||||
[container.yoga applyLayout];
|
||||
for (UIView *view in container.subviews) {
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), view.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -89,10 +89,6 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool YGValueIsUndefined(float value);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode);
|
||||
|
||||
@@ -316,6 +312,9 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetHeight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetMargin(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetPadding(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
|
@@ -452,6 +452,54 @@ namespace Facebook.Yoga
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutMarginEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.End);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingLeft
|
||||
{
|
||||
get
|
||||
|
@@ -36,6 +36,12 @@ namespace Facebook.Yoga
|
||||
}
|
||||
}
|
||||
|
||||
public YogaNode(YogaNode srcNode)
|
||||
: this()
|
||||
{
|
||||
CopyStyle(srcNode);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_measureFunction = null;
|
||||
|
11
csharp/Facebook.YogaKit/Facebook.YogaKit.Shared.shproj
Normal file
11
csharp/Facebook.YogaKit/Facebook.YogaKit.Shared.shproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="Facebook.YogaKit.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
16
csharp/Facebook.YogaKit/Facebook.YogaKit.projitems
Normal file
16
csharp/Facebook.YogaKit/Facebook.YogaKit.projitems
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Facebook.YogaKit</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaLayout.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)IYogaLayout.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaKit.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
85
csharp/Facebook.YogaKit/IYogaLayout.cs
Normal file
85
csharp/Facebook.YogaKit/IYogaLayout.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Facebook.Yoga;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public interface IYogaLayout : IDisposable
|
||||
{
|
||||
bool IsEnabled { get; set; }
|
||||
bool IsIncludeInLayout { get; set; }
|
||||
|
||||
//YogaDirection Direction { get; set; }
|
||||
YogaFlexDirection FlexDirection { get; set; }
|
||||
YogaJustify JustifyContent { get; set; }
|
||||
YogaAlign AlignContent { get; set; }
|
||||
YogaAlign AlignSelf { get; set; }
|
||||
YogaAlign AlignItems { get; set; }
|
||||
YogaPositionType Position { get; set; }
|
||||
YogaWrap FlexWrap { get; set; }
|
||||
YogaOverflow Overflow { get; set; }
|
||||
|
||||
|
||||
float FlexGrow { get; set; }
|
||||
float FlexShrink { get; set; }
|
||||
float FlexBasis { get; set; }
|
||||
|
||||
float Left { get; set; }
|
||||
float Top { get; set; }
|
||||
float Right { get; set; }
|
||||
float Bottom { get; set; }
|
||||
float Start { get; set; }
|
||||
float End { get; set; }
|
||||
|
||||
float MarginLeft { get; set; }
|
||||
float MarginTop { get; set; }
|
||||
float MarginRight { get; set; }
|
||||
float MarginBottom { get; set; }
|
||||
float MarginStart { get; set; }
|
||||
float MarginEnd { get; set; }
|
||||
float MarginHorizontal { get; set; }
|
||||
float MarginVertical { get; set; }
|
||||
float Margin { get; set; }
|
||||
|
||||
float PaddingLeft { get; set; }
|
||||
float PaddingTop { get; set; }
|
||||
float PaddingRight { get; set; }
|
||||
float PaddingBottom { get; set; }
|
||||
float PaddingStart { get; set; }
|
||||
float PaddingEnd { get; set; }
|
||||
float PaddingHorizontal { get; set; }
|
||||
float PaddingVertical { get; set; }
|
||||
float Padding { get; set; }
|
||||
|
||||
float BorderLeftWidth { get; set; }
|
||||
float BorderTopWidth { get; set; }
|
||||
float BorderRightWidth { get; set; }
|
||||
float BorderBottomWidth { get; set; }
|
||||
float BorderStartWidth { get; set; }
|
||||
float BorderEndWidth { get; set; }
|
||||
float BorderWidth { get; set; }
|
||||
|
||||
float Width { get; set; }
|
||||
float Height { get; set; }
|
||||
float MinWidth { get; set; }
|
||||
float MinHeight { get; set; }
|
||||
float MaxWidth { get; set; }
|
||||
float MaxHeight { get; set; }
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
|
||||
// Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
||||
SizeF IntrinsicSize { get; }
|
||||
float AspectRatio { get; set; }
|
||||
// Get the resolved direction of this node. This won't be YGDirectionInherit
|
||||
YogaDirection ResolvedDirection { get; }
|
||||
// Returns the number of children that are using Flexbox.
|
||||
int NumberOfChildren { get; }
|
||||
// Return a BOOL indiciating whether or not we this node contains any subviews that are included in Yoga's layout.
|
||||
bool IsLeaf { get; }
|
||||
// Perform a layout calculation and update the frames of the views in the hierarchy with the results
|
||||
void ApplyLayout();
|
||||
// Mark that a view's layout needs to be recalculated. Only works for leaf views.
|
||||
void MarkDirty();
|
||||
}
|
||||
}
|
10
csharp/Facebook.YogaKit/YogaKit.cs
Normal file
10
csharp/Facebook.YogaKit/YogaKit.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Facebook.Yoga;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public static partial class YogaKit
|
||||
{
|
||||
internal static Dictionary<YogaNode, object> Bridges = new Dictionary<YogaNode, object>();
|
||||
}
|
||||
}
|
888
csharp/Facebook.YogaKit/YogaLayout.cs
Normal file
888
csharp/Facebook.YogaKit/YogaLayout.cs
Normal file
@@ -0,0 +1,888 @@
|
||||
using System;
|
||||
using Facebook.Yoga;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
#if __IOS__
|
||||
using NativeView = UIKit.UIView;
|
||||
#endif
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public partial class YogaLayout : IYogaLayout
|
||||
{
|
||||
WeakReference<NativeView> _viewRef;
|
||||
YogaNode _node;
|
||||
|
||||
internal YogaLayout(NativeView view)
|
||||
{
|
||||
_viewRef = new WeakReference<NativeView>(view);
|
||||
_node = new YogaNode();
|
||||
YogaKit.Bridges.Add(_node, view);
|
||||
|
||||
IsEnabled = false;
|
||||
IsIncludeInLayout = true;
|
||||
}
|
||||
|
||||
public new void MarkDirty()
|
||||
{
|
||||
if (IsLeaf)
|
||||
_node.MarkDirty();
|
||||
}
|
||||
|
||||
public bool IsLeaf
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsEnabled)
|
||||
{
|
||||
NativeView view = null;
|
||||
if (_viewRef.TryGetTarget(out view))
|
||||
{
|
||||
foreach (NativeView subview in GetChildren(view))
|
||||
{
|
||||
var layout = subview.Yoga();
|
||||
if (layout.IsEnabled && layout.IsIncludeInLayout)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsIncludeInLayout
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public int NumberOfChildren => _node.Count;
|
||||
|
||||
public YogaDirection ResolvedDirection => _node.LayoutDirection;
|
||||
|
||||
public YogaFlexDirection FlexDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.FlexDirection;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.FlexDirection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.AlignItems;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.AlignItems = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaJustify JustifyContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.JustifyContent;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.JustifyContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.AlignContent;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.AlignContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignSelf
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.AlignSelf;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.AlignSelf = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaPositionType Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PositionType;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PositionType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaWrap FlexWrap
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Wrap;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Wrap = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaOverflow Overflow
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Overflow;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Overflow = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float FlexGrow
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.FlexGrow;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.FlexGrow = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float FlexShrink
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.FlexShrink;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.FlexShrink = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float FlexBasis
|
||||
{
|
||||
get
|
||||
{
|
||||
return (float)_node.FlexBasis.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.FlexBasis = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Left
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Left.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Left = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Top
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Top.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Top = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Right
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Right.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Right = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Bottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Bottom.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Bottom = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Start
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Start.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Start = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float End
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.End.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.End = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginLeft.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginLeft = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginTop.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginTop = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginRight.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginRight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginBottom.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginBottom = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginStart.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginStart = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginEnd.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginEnd = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginHorizontal
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginHorizontal.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginHorizontal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MarginVertical
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MarginVertical.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MarginVertical = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Margin.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Margin = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingLeft.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingLeft = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingTop.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingTop = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingRight.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingRight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingBottom.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingBottom = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingStart.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingStart = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingEnd.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingEnd = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingHorizontal
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingHorizontal.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingHorizontal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float PaddingVertical
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.PaddingVertical.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.PaddingHorizontal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Padding
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Padding.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Padding = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderLeftWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderLeftWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderLeftWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderTopWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderTopWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderTopWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderRightWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderRightWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderRightWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderBottomWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderBottomWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderBottomWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderStartWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderStartWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderStartWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderEndWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderEndWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderEndWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.BorderWidth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.BorderWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Height.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Height = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.Width.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.Width = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MinWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MinWidth.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MinWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MinHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MinHeight.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MinHeight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MaxWidth.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MaxWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.MaxHeight.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.MaxHeight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float AspectRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
return _node.StyleAspectRatio;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_node.StyleAspectRatio = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyLayout()
|
||||
{
|
||||
NativeView view = null;
|
||||
if (_viewRef.TryGetTarget(out view))
|
||||
{
|
||||
float width = 0;
|
||||
float height = 0;
|
||||
GetWidthHeightOfNativeView(view, out width, out height);
|
||||
CalculateLayoutWithSize(this, width, height);
|
||||
ApplyLayoutToViewHierarchy(view);
|
||||
}
|
||||
}
|
||||
public SizeF IntrinsicSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return CalculateLayoutWithSize(this, float.NaN, float.NaN);
|
||||
}
|
||||
}
|
||||
|
||||
SizeF CalculateLayoutWithSize(YogaLayout layout, float width, float height)
|
||||
{
|
||||
//TODO : Check thread access
|
||||
if (!layout.IsEnabled)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Doesn't use Yoga");
|
||||
}
|
||||
NativeView view = null;
|
||||
if (_viewRef.TryGetTarget(out view))
|
||||
{
|
||||
AttachNodesFromViewHierachy(view);
|
||||
}
|
||||
|
||||
var node = layout._node;
|
||||
|
||||
node.Width = width;
|
||||
node.Height = height;
|
||||
node.CalculateLayout();
|
||||
|
||||
return new SizeF { Width = node.LayoutWidth, Height = node.LayoutHeight };
|
||||
}
|
||||
|
||||
static YogaSize MeasureView(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode)
|
||||
{
|
||||
var constrainedWidth = (widthMode == YogaMeasureMode.Undefined) ? float.MaxValue : width;
|
||||
var constrainedHeight = (heightMode == YogaMeasureMode.Undefined) ? float.MaxValue : height;
|
||||
|
||||
NativeView view = null;
|
||||
if (YogaKit.Bridges.ContainsKey(node))
|
||||
view = YogaKit.Bridges[node] as NativeView;
|
||||
|
||||
float sizeThatFitsWidth = 0;
|
||||
float sizeThatFitsHeight = 0;
|
||||
|
||||
MeasureNativeView(view, constrainedWidth, constrainedHeight, out sizeThatFitsWidth, out sizeThatFitsHeight);
|
||||
|
||||
var finalWidth = SanitizeMeasurement(constrainedWidth, sizeThatFitsWidth, widthMode);
|
||||
var finalHeight = SanitizeMeasurement(constrainedHeight, sizeThatFitsHeight, heightMode);
|
||||
|
||||
return MeasureOutput.Make(finalWidth, finalHeight);
|
||||
}
|
||||
|
||||
static float SanitizeMeasurement(float constrainedSize, float measuredSize, YogaMeasureMode measureMode)
|
||||
{
|
||||
float result;
|
||||
if (measureMode == YogaMeasureMode.Exactly)
|
||||
{
|
||||
result = (float)constrainedSize;
|
||||
}
|
||||
else if (measureMode == YogaMeasureMode.AtMost)
|
||||
{
|
||||
result = (float)Math.Min(constrainedSize, measuredSize);
|
||||
}
|
||||
else {
|
||||
result = (float)measuredSize;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool NodeHasExactSameChildren(YogaNode node, NativeView[] subviews)
|
||||
{
|
||||
if (node.Count != subviews.Length)
|
||||
return false;
|
||||
for (int i = 0; i < subviews.Length; i++)
|
||||
{
|
||||
YogaLayout yoga = subviews[i].Yoga() as YogaLayout;
|
||||
if (node[i] != yoga._node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void AttachNodesFromViewHierachy(NativeView view)
|
||||
{
|
||||
YogaLayout yoga = view.Yoga() as YogaLayout;
|
||||
var node = yoga._node;
|
||||
// Only leaf nodes should have a measure function
|
||||
if (yoga.IsLeaf)
|
||||
{
|
||||
RemoveAllChildren(node);
|
||||
node.SetMeasureFunction(MeasureView);
|
||||
}
|
||||
else
|
||||
{
|
||||
node.SetMeasureFunction(null);
|
||||
// Create a list of all the subviews that we are going to use for layout.
|
||||
var subviewsToInclude = new List<NativeView>();
|
||||
foreach (var subview in view.Subviews)
|
||||
{
|
||||
if (subview.Yoga().IsIncludeInLayout)
|
||||
{
|
||||
subviewsToInclude.Add(subview);
|
||||
}
|
||||
}
|
||||
|
||||
if (!NodeHasExactSameChildren(node, subviewsToInclude.ToArray()))
|
||||
{
|
||||
RemoveAllChildren(node);
|
||||
for (int i = 0; i < subviewsToInclude.Count; i++)
|
||||
{
|
||||
YogaLayout yogaSubview = subviewsToInclude[i].Yoga() as YogaLayout;
|
||||
node.Insert(i, yogaSubview._node);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var subView in subviewsToInclude)
|
||||
{
|
||||
AttachNodesFromViewHierachy(subView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveAllChildren(YogaNode node)
|
||||
{
|
||||
if (node == null)
|
||||
return;
|
||||
|
||||
if (node.Count > 0)
|
||||
{
|
||||
node.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
static double RoundPixelValue(float value)
|
||||
{
|
||||
float scale = NativePixelScale;
|
||||
|
||||
return Math.Round(value * scale) / scale;
|
||||
}
|
||||
|
||||
static void ApplyLayoutToViewHierarchy(NativeView view)
|
||||
{
|
||||
//TODO : "Framesetting should only be done on the main thread."
|
||||
YogaLayout yoga = view.Yoga() as YogaLayout;
|
||||
|
||||
if (!yoga.IsIncludeInLayout)
|
||||
return;
|
||||
|
||||
var node = yoga._node;
|
||||
|
||||
ApplyLayoutToNativeView(view, node);
|
||||
|
||||
if (!yoga.IsLeaf)
|
||||
{
|
||||
for (int i = 0; i < view.Subviews.Length; i++)
|
||||
{
|
||||
ApplyLayoutToViewHierarchy(view.Subviews[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<CompileDependsOn>CopyInNativeLib;$(CompileDependsOn)</CompileDependsOn>
|
||||
<CompileDependsOn>NativeLibrary;$(CompileDependsOn)</CompileDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- The # and , in this path does not play nice with the binding project logic, so make a copy -->
|
||||
<Target Name="CopyInNativeLib" Inputs="..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" Outputs="$(ProjectDir)libyoga.dylib">
|
||||
<Copy SourceFiles="..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" DestinationFiles="$(ProjectDir)/libyoga.dylib" />
|
||||
<Target Name="NativeLibrary" Outputs="$(ProjectDir)libyoga.dylib">
|
||||
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)buck-build.sh //csharp:yoganet#default,shared" />
|
||||
<Copy SourceFiles="$(ProjectDir)..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" DestinationFiles="$(ProjectDir)libyoga.dylib" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
namespace Facebook.Yoga.Mac.Sample
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : NSApplicationDelegate
|
@@ -6,8 +6,8 @@
|
||||
<ProjectGuid>{64E0AB97-A904-4607-A535-EEA5A966C09E}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.Yoga.Mac.Test</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.Mac.Test</AssemblyName>
|
||||
<RootNamespace>Facebook.Yoga.Mac.Sample</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.Mac.Sample</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
|
||||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
@@ -3,9 +3,9 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Facebook.Yoga.Mac.Test</string>
|
||||
<string>Facebook.Yoga.Mac.Sample</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.companyname.facebook-yoga-mac-test</string>
|
||||
<string>com.facebook.facebook-yoga-mac-sample</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
@@ -8,7 +8,7 @@
|
||||
|
||||
using AppKit;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
namespace Facebook.Yoga.Mac.Sample
|
||||
{
|
||||
static class MainClass
|
||||
{
|
@@ -10,11 +10,11 @@
|
||||
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="Facebook.Yoga.Mac.Test" id="1Xt-HY-uBw">
|
||||
<menuItem title="Facebook.Yoga.Mac.Sample" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Facebook.Yoga.Mac.Test" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<menu key="submenu" title="Facebook.Yoga.Mac.Sample" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About Facebook.Yoga.Mac.Test" id="5kV-Vb-QxS">
|
||||
<menuItem title="About Facebook.Yoga.Mac.Sample" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem" />
|
||||
@@ -28,7 +28,7 @@
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5" />
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R" />
|
||||
<menuItem title="Hide Facebook.Yoga.Mac.Test" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<menuItem title="Hide Facebook.Yoga.Mac.Sample" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68" />
|
||||
</connections>
|
||||
@@ -46,7 +46,7 @@
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT" />
|
||||
<menuItem title="Quit Facebook.Yoga.Mac.Test" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<menuItem title="Quit Facebook.Yoga.Mac.Sample" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF" />
|
||||
</connections>
|
||||
@@ -627,7 +627,7 @@
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="Facebook.Yoga.Mac.Test Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<menuItem title="Facebook.Yoga.Mac.Sample Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no" />
|
||||
</connections>
|
@@ -13,7 +13,7 @@ using AppKit;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
namespace Facebook.Yoga.Mac.Sample
|
||||
{
|
||||
public static class NSViewYogaExtensions
|
||||
{
|
@@ -6,7 +6,7 @@
|
||||
//
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
namespace Facebook.Yoga.Mac.Sample
|
||||
{
|
||||
[Register("ViewController")]
|
||||
partial class ViewController
|
6
csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist
Normal file
6
csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.Yoga.Mac.Tests</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.Mac.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
|
||||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<EnableCodeSigning>false</EnableCodeSigning>
|
||||
<CodeSigningKey>Mac Developer</CodeSigningKey>
|
||||
<CreatePackage>false</CreatePackage>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<IncludeMonoRuntime>false</IncludeMonoRuntime>
|
||||
<UseSGen>true</UseSGen>
|
||||
<UseRefCounting>true</UseRefCounting>
|
||||
<Profiling>true</Profiling>
|
||||
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
|
||||
<TlsProvider>Default</TlsProvider>
|
||||
<LinkMode>None</LinkMode>
|
||||
<XamMacArch>x86_64</XamMacArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<EnableCodeSigning>false</EnableCodeSigning>
|
||||
<CreatePackage>true</CreatePackage>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
||||
<UseSGen>true</UseSGen>
|
||||
<UseRefCounting>true</UseRefCounting>
|
||||
<LinkMode>SdkOnly</LinkMode>
|
||||
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
|
||||
<TlsProvider>Default</TlsProvider>
|
||||
<XamMacArch></XamMacArch>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga.Mac.csproj">
|
||||
<Project>{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}</Project>
|
||||
<Name>Facebook.Yoga.Mac</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
|
||||
</Project>
|
30
csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist
Normal file
30
csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Facebook.Yoga.Mac.Tests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.facebook.facebook-yoga-mac-tests</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.11</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${AuthorCopyright}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
</dict>
|
||||
</plist>
|
20
csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs
Normal file
20
csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE-examples file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Tests
|
||||
{
|
||||
static class MainClass
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
4
csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config
Normal file
4
csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="xamarinmac20" />
|
||||
</packages>
|
@@ -1,25 +1,39 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Test", "Facebook.Yoga.Mac.Test\Facebook.Yoga.Mac.Test.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Sample", "Facebook.Yoga.Mac.Sample\Facebook.Yoga.Mac.Sample.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9352A9B6-F93B-45DD-8BCE-4696A62B3789}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Tests", "Facebook.Yoga.Mac.Tests\Facebook.Yoga.Mac.Tests.csproj", "{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789}
|
||||
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
6
csharp/Mac/buck-build.sh
Executable file
6
csharp/Mac/buck-build.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
if buck --version >/dev/null 2>&1; then true; else
|
||||
echo "SKIP: Need to install buck https://buckbuild.com/setup/getting_started.html"
|
||||
exit 0
|
||||
fi
|
||||
buck build $1
|
2
csharp/iOS/.gitignore
vendored
Normal file
2
csharp/iOS/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
libyoga.a
|
||||
*.userprefs
|
6
csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist
Normal file
6
csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectGuid>{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.Yoga.iOS.Tests</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.iOS.Tests</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>28871</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="UnitTestAppDelegate.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
36
csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist
Normal file
36
csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Facebook.Yoga.iOS.Tests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.facebook-yoga-ios-tests</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>9.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
27
csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard
Normal file
27
csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
28
csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs
Normal file
28
csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE-examples file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.Yoga.iOS.Tests
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "UnitTestAppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
53
csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs
Normal file
53
csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE-examples file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using MonoTouch.NUnit.UI;
|
||||
|
||||
namespace Facebook.Yoga.iOS.Tests
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("UnitTestAppDelegate")]
|
||||
public partial class UnitTestAppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
UIWindow window;
|
||||
TouchRunner runner;
|
||||
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
// create a new window instance based on the screen size
|
||||
window = new UIWindow(UIScreen.MainScreen.Bounds);
|
||||
runner = new TouchRunner(window);
|
||||
|
||||
// register every tests included in the main application/assembly
|
||||
runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
window.RootViewController = new UINavigationController(runner.GetViewController());
|
||||
|
||||
// make the window visible
|
||||
window.MakeKeyAndVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
81
csharp/iOS/Facebook.Yoga.iOS.sln
Normal file
81
csharp/iOS/Facebook.Yoga.iOS.sln
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{89A39C6B-6A7B-4458-872B-A0456550CAA6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Tests", "Facebook.Yoga.iOS.Tests\Facebook.Yoga.iOS.Tests.csproj", "{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
|
||||
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
$1.inheritsSet = VisualStudio
|
||||
$1.inheritsScope = text/plain
|
||||
$1.scope = text/x-csharp
|
||||
$0.CSharpFormattingPolicy = $2
|
||||
$2.IndentSwitchSection = True
|
||||
$2.NewLinesForBracesInProperties = True
|
||||
$2.NewLinesForBracesInAccessors = True
|
||||
$2.NewLinesForBracesInAnonymousMethods = True
|
||||
$2.NewLinesForBracesInControlBlocks = True
|
||||
$2.NewLinesForBracesInAnonymousTypes = True
|
||||
$2.NewLinesForBracesInObjectCollectionArrayInitializers = True
|
||||
$2.NewLinesForBracesInLambdaExpressionBody = True
|
||||
$2.NewLineForElse = True
|
||||
$2.NewLineForCatch = True
|
||||
$2.NewLineForFinally = True
|
||||
$2.NewLineForMembersInObjectInit = True
|
||||
$2.NewLineForMembersInAnonymousTypes = True
|
||||
$2.NewLineForClausesInQuery = True
|
||||
$2.SpacingAfterMethodDeclarationName = False
|
||||
$2.SpaceAfterMethodCallName = False
|
||||
$2.SpaceBeforeOpenSquareBracket = False
|
||||
$2.inheritsSet = Mono
|
||||
$2.inheritsScope = text/x-csharp
|
||||
$2.scope = text/x-csharp
|
||||
EndGlobalSection
|
||||
EndGlobal
|
20
csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs
Normal file
20
csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
using UIKit;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace Facebook.Yoga.iOS
|
||||
{
|
||||
//this is needed
|
||||
}
|
10
csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets
Normal file
10
csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<CompileDependsOn>NativeLibrary;$(CompileDependsOn)</CompileDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target Name="NativeLibrary" Outputs="$(ProjectDir)libyoga.a">
|
||||
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)../../Mac/buck-build.sh //csharp:yoganet-ios" />
|
||||
<Copy SourceFiles="$(ProjectDir)..\..\..\buck-out\gen\csharp\yoganet-ios\libyoga.a" DestinationFiles="$(ProjectDir)libyoga.a" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
50
csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj
Normal file
50
csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</ProjectGuid>
|
||||
<ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Facebook.Yoga.iOS</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.iOS</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="CustomBuildAction.targets" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NativeReference Include="libyoga.a">
|
||||
<Kind>Static</Kind>
|
||||
<SmartLink>False</SmartLink>
|
||||
</NativeReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems" Label="Shared" Condition="Exists('..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
|
||||
<Import Project="CustomBuildAction.targets" />
|
||||
</Project>
|
23
csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs
Normal file
23
csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public override UIWindow Window
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"images": [
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "40x40",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "40x40",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "57x57",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "57x57",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "60x60",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "60x60",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "29x29",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "29x29",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "40x40",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "40x40",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "50x50",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "50x50",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "72x72",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "72x72",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "76x76",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "76x76",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "24x24",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "27.5x27.5",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "appLauncher",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "44x44",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "longLook",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "86x86",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "98x98",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "42mm"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectGuid>{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS.Sample</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS.Sample</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;__IOS__</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>56768</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType></DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\Contents.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
<InterfaceDefinition Include="Main.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="ViewController.cs" />
|
||||
<Compile Include="ViewController.designer.cs">
|
||||
<DependentUpon>ViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj">
|
||||
<Project>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</Project>
|
||||
<Name>Facebook.YogaKit.iOS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
39
csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist
Normal file
39
csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Facebook.YogaKit.iOS.Sample</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.facebook-yogakit-ios-sample</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
12
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs
Normal file
12
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
25
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard
Normal file
25
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ" />
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
54
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs
Normal file
54
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using CoreGraphics;
|
||||
using Facebook.Yoga;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
protected ViewController(IntPtr handle) : base(handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
CreateViewHierarchy(View, View.Bounds.Size.Width, View.Bounds.Size.Height);
|
||||
}
|
||||
|
||||
static void CreateViewHierarchy(UIView root, nfloat width, nfloat height)
|
||||
{
|
||||
root.BackgroundColor = UIColor.Red;
|
||||
root.Yoga().IsEnabled = true;
|
||||
|
||||
root.Yoga().Width = (float)width;
|
||||
root.Yoga().Height = (float)height;
|
||||
root.Yoga().AlignItems = YogaAlign.Center;
|
||||
root.Yoga().JustifyContent = YogaJustify.Center;
|
||||
|
||||
var child1 = new UIView { BackgroundColor = UIColor.Blue };
|
||||
child1.Yoga().IsEnabled = true;
|
||||
child1.Yoga().Width = 100;
|
||||
child1.Yoga().Height = 100;
|
||||
|
||||
var child2 = new UIView
|
||||
{
|
||||
BackgroundColor = UIColor.Green,
|
||||
Frame = new CGRect { Size = new CGSize(200, 100) }
|
||||
};
|
||||
|
||||
var child3 = new UIView
|
||||
{
|
||||
BackgroundColor = UIColor.Yellow,
|
||||
Frame = new CGRect { Size = new CGSize(100, 100) }
|
||||
};
|
||||
|
||||
child2.AddSubview(child3);
|
||||
root.AddSubview(child1);
|
||||
root.AddSubview(child2);
|
||||
root.Yoga().ApplyLayout();
|
||||
}
|
||||
}
|
||||
}
|
17
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs
generated
Normal file
17
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// This file has been generated automatically by MonoDevelop to store outlets and
|
||||
// actions made in the Xcode designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
[Register("ViewController")]
|
||||
partial class ViewController
|
||||
{
|
||||
void ReleaseDesignerOutlets()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
6
csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist
Normal file
6
csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectGuid>{238DB3A2-1182-4775-92BC-F62C885725D8}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS.Tests</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS.Tests</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>17481</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="UnitTestAppDelegate.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj">
|
||||
<Project>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</Project>
|
||||
<Name>Facebook.YogaKit.iOS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
36
csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist
Normal file
36
csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Facebook.YogaKit.iOS.Tests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.facebook-yogakit-ios-tests</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true />
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true />
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
20
csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs
Normal file
20
csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Tests
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "UnitTestAppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
45
csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs
Normal file
45
csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using MonoTouch.NUnit.UI;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Tests
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("UnitTestAppDelegate")]
|
||||
public partial class UnitTestAppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
UIWindow window;
|
||||
TouchRunner runner;
|
||||
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
// create a new window instance based on the screen size
|
||||
window = new UIWindow(UIScreen.MainScreen.Bounds);
|
||||
runner = new TouchRunner(window);
|
||||
|
||||
// register every tests included in the main application/assembly
|
||||
runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
window.RootViewController = new UINavigationController(runner.GetViewController());
|
||||
|
||||
// make the window visible
|
||||
window.MakeKeyAndVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
84
csharp/iOS/Facebook.YogaKit.iOS.sln
Normal file
84
csharp/iOS/Facebook.YogaKit.iOS.sln
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9FB621AA-66DD-46F1-8B10-94F508272A8D}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared", "..\Facebook.YogaKit\Facebook.YogaKit.Shared.shproj", "{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS", "Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj", "{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Sample", "Facebook.YogaKit.iOS.Sample\Facebook.YogaKit.iOS.Sample.csproj", "{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Tests", "Facebook.YogaKit.iOS.Tests\Facebook.YogaKit.iOS.Tests.csproj", "{238DB3A2-1182-4775-92BC-F62C885725D8}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared.Tests", "..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.shproj", "{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
69
csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj
Normal file
69
csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__IOS__</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>53781</IOSDebuggerPort>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="YogaLayout.cs" />
|
||||
<Compile Include="YogaKit.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Facebook.YogaKit\Facebook.YogaKit.projitems" Label="Shared" Condition="Exists('..\..\Facebook.YogaKit\Facebook.YogaKit.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
26
csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs
Normal file
26
csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("Facebook.YogaKit.iOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("rmarinho")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
43
csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs
Normal file
43
csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public static partial class YogaKit
|
||||
{
|
||||
static NSString YogaNodeKey = new NSString("YogaNode");
|
||||
|
||||
public static IYogaLayout Yoga(this UIView view)
|
||||
{
|
||||
return YogaLayoutNative(view);
|
||||
}
|
||||
|
||||
static IYogaLayout YogaLayoutNative(UIView view)
|
||||
{
|
||||
var yoga = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, YogaNodeKey.Handle)) as YogaLayout;
|
||||
if (yoga == null)
|
||||
{
|
||||
yoga = new YogaLayout(view);
|
||||
objc_setAssociatedObject(view.Handle, YogaNodeKey.Handle, yoga.Handle, AssociationPolicy.RETAIN_NONATOMIC);
|
||||
}
|
||||
return yoga;
|
||||
}
|
||||
|
||||
[DllImport("/usr/lib/libobjc.dylib")]
|
||||
static extern void objc_setAssociatedObject(IntPtr @object, IntPtr key, IntPtr value, AssociationPolicy policy);
|
||||
|
||||
[DllImport("/usr/lib/libobjc.dylib")]
|
||||
static extern IntPtr objc_getAssociatedObject(IntPtr @object, IntPtr key);
|
||||
|
||||
enum AssociationPolicy
|
||||
{
|
||||
ASSIGN = 0,
|
||||
RETAIN_NONATOMIC = 1,
|
||||
COPY_NONATOMIC = 3,
|
||||
RETAIN = 01401,
|
||||
COPY = 01403,
|
||||
}
|
||||
}
|
||||
}
|
52
csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs
Normal file
52
csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using CoreGraphics;
|
||||
using Facebook.Yoga;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public partial class YogaLayout : NSObject
|
||||
{
|
||||
static IEnumerable<UIView> GetChildren(UIView view) => view.Subviews;
|
||||
|
||||
static void MeasureNativeView(UIView view, float constrainedWidth, float constrainedHeight, out float sizeThatFitsWidth, out float sizeThatFitsHeight)
|
||||
{
|
||||
var sizeThatFits = view.SizeThatFits(new CGSize(constrainedWidth, constrainedHeight));
|
||||
sizeThatFitsWidth = (float)sizeThatFits.Width;
|
||||
sizeThatFitsHeight = (float)sizeThatFits.Height;
|
||||
}
|
||||
|
||||
static void GetWidthHeightOfNativeView(UIView view, out float width, out float height)
|
||||
{
|
||||
width = (float)view.Bounds.Width;
|
||||
height = (float)view.Bounds.Height;
|
||||
}
|
||||
|
||||
static float NativePixelScale => (float)UIScreen.MainScreen.Scale;
|
||||
|
||||
|
||||
static void ApplyLayoutToNativeView(UIView view, YogaNode node)
|
||||
{
|
||||
var topLeft = new CGPoint(node.LayoutX, node.LayoutY);
|
||||
var bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight);
|
||||
view.Frame = new CGRect(RoundPixelValue((float)topLeft.X), RoundPixelValue((float)topLeft.Y), RoundPixelValue((float)bottomRight.X) - RoundPixelValue((float)topLeft.X), RoundPixelValue((float)bottomRight.Y) - RoundPixelValue((float)topLeft.Y));
|
||||
}
|
||||
|
||||
bool _disposed;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !_disposed)
|
||||
{
|
||||
_disposed = true;
|
||||
if (YogaKit.Bridges.ContainsKey(_node))
|
||||
{
|
||||
YogaKit.Bridges.Remove(_node);
|
||||
}
|
||||
_node = null;
|
||||
_viewRef = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
@@ -22,7 +22,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YGMinMaxDimensionTest.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YGPaddingTest.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YGRoundingTest.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeCreateTest.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeSpacingTest.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeTest.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -276,6 +276,36 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100.Px(), node0.MaxHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCopyConstructor()
|
||||
{
|
||||
YogaNode node0 = new YogaNode();
|
||||
node0.MaxWidth = 80;
|
||||
|
||||
YogaNode node1 = new YogaNode(node0);
|
||||
Assert.AreEqual(80.Px(), node1.MaxWidth);
|
||||
|
||||
YogaNode node2 = new YogaNode(node1)
|
||||
{
|
||||
MaxHeight = 90,
|
||||
};
|
||||
Assert.AreEqual(80.Px(), node2.MaxWidth);
|
||||
Assert.AreEqual(90.Px(), node2.MaxHeight);
|
||||
|
||||
YogaNode node3 = new YogaNode(node0)
|
||||
{
|
||||
MaxWidth = 100,
|
||||
};
|
||||
Assert.AreEqual(100.Px(), node3.MaxWidth);
|
||||
|
||||
YogaNode node4 = new YogaNode(node2)
|
||||
{
|
||||
MaxWidth = 100,
|
||||
};
|
||||
Assert.AreEqual(100.Px(), node4.MaxWidth);
|
||||
Assert.AreEqual(90.Px(), node4.MaxHeight);
|
||||
}
|
||||
|
||||
private void ForceGC()
|
||||
{
|
||||
GC.Collect(GC.MaxGeneration);
|
||||
@@ -404,6 +434,23 @@ namespace Facebook.Yoga
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLayoutMargin() {
|
||||
YogaNode node = new YogaNode();
|
||||
node.Width = 100;
|
||||
node.Height = 100;
|
||||
node.MarginStart = 1;
|
||||
node.MarginEnd = 2;
|
||||
node.MarginTop = 3;
|
||||
node.MarginBottom = 4;
|
||||
node.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(1, node.LayoutMarginLeft);
|
||||
Assert.AreEqual(2, node.LayoutMarginRight);
|
||||
Assert.AreEqual(3, node.LayoutMarginTop);
|
||||
Assert.AreEqual(4, node.LayoutMarginBottom);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLayoutPadding() {
|
||||
YogaNode node = new YogaNode();
|
||||
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE}</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Facebook.YogaKit.Shared.Tests</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaKitTest.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="Facebook.YogaKit.Shared.Tests.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
369
csharp/tests/Facebook.YogaKit.Shared.Tests/YogaKitTest.cs
Normal file
369
csharp/tests/Facebook.YogaKit.Shared.Tests/YogaKitTest.cs
Normal file
@@ -0,0 +1,369 @@
|
||||
using System.Drawing;
|
||||
using Facebook.Yoga;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
#if __IOS__
|
||||
using NativeView = UIKit.UIView;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
[TestFixture]
|
||||
public class YogaKitTest
|
||||
{
|
||||
[Test]
|
||||
public void TestUsesYoga()
|
||||
{
|
||||
var view = new NativeView();
|
||||
Assert.False(view.Yoga().IsEnabled);
|
||||
view.Yoga().IsEnabled = true;
|
||||
Assert.True(view.Yoga().IsEnabled);
|
||||
view.Yoga().IsEnabled = false;
|
||||
Assert.False(view.Yoga().IsEnabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSizeThatFitsAsserts()
|
||||
{
|
||||
var view = new NativeView();
|
||||
Assert.Ignore("Not implemented yet");
|
||||
// dispatch_sync(dispatch_queue_create("com.facebook.Yoga.testing", DISPATCH_QUEUE_SERIAL), ^(void){
|
||||
// XCTAssertThrows(view.yoga.intrinsicSize);
|
||||
// });
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSizeThatFitsSmoke()
|
||||
{
|
||||
var container = new NativeView();
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
container.Yoga().AlignItems = YogaAlign.FlexStart;
|
||||
|
||||
var longTextLabel = new UIKit.UILabel();
|
||||
longTextLabel.Text = @"This is a very very very very very very very very long piece of text.";
|
||||
longTextLabel.LineBreakMode = UIKit.UILineBreakMode.TailTruncation;
|
||||
longTextLabel.Lines = 1;
|
||||
longTextLabel.Yoga().IsEnabled = true;
|
||||
longTextLabel.Yoga().FlexShrink = 1;
|
||||
container.AddSubview(longTextLabel);
|
||||
|
||||
var textBadgeView = new NativeView();
|
||||
textBadgeView.Yoga().IsEnabled = true;
|
||||
textBadgeView.Yoga().MarginLeft = 3.0f;
|
||||
textBadgeView.Yoga().Width = 10;
|
||||
textBadgeView.Yoga().Height = 10;
|
||||
container.AddSubview(textBadgeView);
|
||||
|
||||
var containerSize = container.Yoga().IntrinsicSize;
|
||||
Assert.True(new SizeF(514, 21) == containerSize, $"Size is actually {containerSize})");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatMarkingLeafsAsDirtyWillTriggerASizeRecalculation()
|
||||
{
|
||||
var container = new NativeView(new CGRect(0, 0, 500, 500));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
container.Yoga().AlignItems = YogaAlign.FlexStart;
|
||||
|
||||
var label = new UIKit.UILabel();
|
||||
label.Text = @"This is a short text.";
|
||||
label.Lines = 1;
|
||||
label.Yoga().IsEnabled = true;
|
||||
container.AddSubview(label);
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
Assert.True(new SizeF(146, 21) == label.Bounds.Size, $"Size is actually {label.Bounds.Size})");
|
||||
|
||||
label.Text = @"This is a slightly longer text.";
|
||||
label.Yoga().MarkDirty();
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
Assert.True(new SizeF(213, 21) == label.Bounds.Size, $"Size is actually {label.Bounds.Size})");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFrameAndOriginPlacement()
|
||||
{
|
||||
var containerSize = new SizeF(320, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
var subview = new NativeView();
|
||||
subview.Yoga().IsEnabled = true;
|
||||
subview.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview);
|
||||
}
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
Assert.False(CGRect.Intersect(container.Subviews[0].Frame, container.Subviews[1].Frame) == CGRect.Empty);
|
||||
Assert.False(CGRect.Intersect(container.Subviews[1].Frame, container.Subviews[2].Frame) == CGRect.Empty);
|
||||
Assert.False(CGRect.Intersect(container.Subviews[0].Frame, container.Subviews[2].Frame) == CGRect.Empty);
|
||||
|
||||
float totalWidth = 0;
|
||||
foreach (var view in container.Subviews)
|
||||
totalWidth += (float)view.Bounds.Size.Width;
|
||||
|
||||
Assert.AreEqual(containerSize.Width, totalWidth, $"The container's width is {containerSize.Width}, the subviews take up {totalWidth}");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestThatLayoutIsCorrectWhenWeSwapViewOrder()
|
||||
{
|
||||
var containerSize = new SizeF(300, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
subview1.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
subview2.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview2);
|
||||
|
||||
var subview3 = new NativeView();
|
||||
subview3.Yoga().IsEnabled = true;
|
||||
subview3.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview3);
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
Assert.True(subview1.Frame == new CGRect(0, 0, 100, 50));
|
||||
Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50), $"It's actually {subview2.Frame}");
|
||||
Assert.True(subview3.Frame == new CGRect(200, 0, 100, 50));
|
||||
|
||||
container.ExchangeSubview(2, 0);
|
||||
subview2.Yoga().IsIncludeInLayout = false;
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
Assert.True(subview3.Frame == new CGRect(0, 0, 150, 50));
|
||||
Assert.True(subview1.Frame == new CGRect(150, 0, 150, 50));
|
||||
//// this frame shouldn't have been modified since last time.
|
||||
Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatWeRespectIncludeInLayoutFlag()
|
||||
{
|
||||
var containerSize = new SizeF(300, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
subview1.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
subview2.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview2);
|
||||
|
||||
var subview3 = new NativeView();
|
||||
subview3.Yoga().IsEnabled = true;
|
||||
subview3.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview3);
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
foreach (var view in container.Subviews)
|
||||
{
|
||||
Assert.True(new CGSize(100, 50) == view.Bounds.Size, $"Actual size is {view.Bounds.Size}");
|
||||
}
|
||||
|
||||
subview3.Yoga().IsIncludeInLayout = false;
|
||||
container.Yoga().ApplyLayout();
|
||||
Assert.True(subview1.Frame.Size == new CGSize(150, 50), $"Actual size is {subview1.Frame.Size}");
|
||||
Assert.True(subview2.Frame.Size == new CGSize(150, 50), $"Actual size is {subview2.Frame.Size}");
|
||||
//// We don't set the frame to zero, so, it should be set to what it was previously at.
|
||||
Assert.True(subview3.Frame.Size == new CGSize(100, 50), $"Actual size is {subview3.Frame.Size}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews()
|
||||
{
|
||||
var container = new NativeView();
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
subview1.Yoga().IsIncludeInLayout = false;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
subview2.Yoga().IsIncludeInLayout = false;
|
||||
container.AddSubview(subview2);
|
||||
|
||||
var subview3 = new NativeView();
|
||||
subview3.Yoga().IsEnabled = true;
|
||||
subview3.Yoga().IsIncludeInLayout = true;
|
||||
container.AddSubview(subview3);
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
Assert.AreEqual(1, container.Yoga().NumberOfChildren);
|
||||
|
||||
subview2.Yoga().IsIncludeInLayout = true;
|
||||
container.Yoga().ApplyLayout();
|
||||
Assert.AreEqual(2, container.Yoga().NumberOfChildren);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond()
|
||||
{
|
||||
var containerSize = new SizeF(300, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Row;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
subview1.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
subview2.Yoga().FlexGrow = 1;
|
||||
container.AddSubview(subview2);
|
||||
|
||||
var subview3 = new NativeView();
|
||||
subview3.Yoga().IsEnabled = true;
|
||||
subview3.Yoga().FlexGrow = 1;
|
||||
subview3.Yoga().IsIncludeInLayout = false;
|
||||
container.AddSubview(subview3);
|
||||
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
Assert.True(subview1.Frame.Size == new CGSize(150, 50), $"Actual size is {subview1.Frame.Size}");
|
||||
Assert.True(subview2.Frame.Size == new CGSize(150, 50), $"Actual size is {subview2.Frame.Size}");
|
||||
Assert.True(subview3.Frame.Size == CGSize.Empty, $"Actual size is {subview3.Frame.Size}");
|
||||
|
||||
subview3.Yoga().IsIncludeInLayout = true;
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
foreach (var view in container.Subviews)
|
||||
{
|
||||
Assert.True(new CGSize(100, 50) == view.Bounds.Size, $"Actual size is {view.Bounds.Size}");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestYogaIsLeafFlag()
|
||||
{
|
||||
var view = new NativeView();
|
||||
Assert.True(view.Yoga().IsLeaf);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var subView = new NativeView();
|
||||
view.AddSubview(subView);
|
||||
}
|
||||
Assert.True(view.Yoga().IsLeaf);
|
||||
view.Yoga().IsEnabled = true;
|
||||
view.Yoga().Width = 50.0f;
|
||||
Assert.True(view.Yoga().IsLeaf);
|
||||
|
||||
var subView1 = view.Subviews[0];
|
||||
subView1.Yoga().IsEnabled = true;
|
||||
subView1.Yoga().Width = 50.0f;
|
||||
Assert.False(view.Yoga().IsLeaf);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatWeCorrectlyAttachNestedViews()
|
||||
{
|
||||
var containerSize = new SizeF(300, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
container.Yoga().FlexDirection = YogaFlexDirection.Column;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
subview1.Yoga().Width = 100;
|
||||
subview1.Yoga().FlexGrow = 1;
|
||||
subview1.Yoga().FlexDirection = YogaFlexDirection.Column;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
subview2.Yoga().Width = 150;
|
||||
subview2.Yoga().FlexGrow = 1;
|
||||
subview2.Yoga().FlexDirection = YogaFlexDirection.Column;
|
||||
container.AddSubview(subview2);
|
||||
|
||||
foreach (var view in new NativeView[] { subview1, subview2 })
|
||||
{
|
||||
var someView = new NativeView();
|
||||
someView.Yoga().IsEnabled = true;
|
||||
someView.Yoga().FlexGrow = 1;
|
||||
view.AddSubview(someView);
|
||||
}
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
// Add the same amount of new views, reapply layout.
|
||||
foreach (var view in new NativeView[] { subview1, subview2 })
|
||||
{
|
||||
var someView = new NativeView();
|
||||
someView.Yoga().IsEnabled = true;
|
||||
someView.Yoga().FlexGrow = 1;
|
||||
view.AddSubview(someView);
|
||||
}
|
||||
container.Yoga().ApplyLayout();
|
||||
|
||||
Assert.True(new CGSize(100, 25) == subview1.Bounds.Size, $"Actual size is {subview1.Bounds.Size}");
|
||||
foreach (var subview in subview1.Subviews)
|
||||
{
|
||||
var subviewSize = subview.Bounds.Size;
|
||||
Assert.False(subviewSize.IsEmpty);
|
||||
Assert.False(nfloat.IsNaN(subviewSize.Height));
|
||||
Assert.False(nfloat.IsNaN(subviewSize.Width));
|
||||
}
|
||||
|
||||
Assert.True(new CGSize(150, 25) == subview2.Bounds.Size, $"Actual size is {subview2.Bounds.Size}");
|
||||
foreach (var subview in subview2.Subviews)
|
||||
{
|
||||
var subviewSize = subview.Bounds.Size;
|
||||
Assert.False(subviewSize.IsEmpty);
|
||||
Assert.False(nfloat.IsNaN(subviewSize.Height));
|
||||
Assert.False(nfloat.IsNaN(subviewSize.Width));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestThatANonLeafNodeCanBecomeALeafNode()
|
||||
{
|
||||
var containerSize = new SizeF(300, 50);
|
||||
|
||||
var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));
|
||||
container.Yoga().IsEnabled = true;
|
||||
|
||||
var subview1 = new NativeView();
|
||||
subview1.Yoga().IsEnabled = true;
|
||||
container.AddSubview(subview1);
|
||||
|
||||
var subview2 = new NativeView();
|
||||
subview2.Yoga().IsEnabled = true;
|
||||
container.AddSubview(subview2);
|
||||
container.Yoga().ApplyLayout();
|
||||
subview2.RemoveFromSuperview();
|
||||
container.Yoga().ApplyLayout();
|
||||
}
|
||||
}
|
||||
}
|
@@ -19,7 +19,7 @@
|
||||
- title: API
|
||||
items:
|
||||
- id: c
|
||||
- id: objc
|
||||
- id: yogakit
|
||||
- id: java
|
||||
- id: csharp
|
||||
- id: javascript
|
||||
|
@@ -1,38 +0,0 @@
|
||||
---
|
||||
docid: objc
|
||||
title: Objective-C
|
||||
layout: docs
|
||||
permalink: /docs/api/objc/
|
||||
---
|
||||
|
||||
> The Objective-C API is very new and still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues). We hope to stabilize the API over the next couple weeks / months.
|
||||
|
||||
Yoga for Objective-C is implemented as a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview). We try to rely on the existing `UIView` properties and initializers where possible, making the Yoga API smaller for Objective-C than for other languages.
|
||||
|
||||
### Lifecycle
|
||||
|
||||
As with any `UIView` instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. With Yoga for Objective-C the frame is actually how you set the width and the height of the Yoga node, just like any other `UIView`.
|
||||
|
||||
Because Yoga is implemented as a category we need some way to mark the view as using Yoga as you might not want Yoga to control layout of your whole app, this is especially important if you are migrating an existing app to use Yoga. The property decides during layout/sizing whether or not `yg_*` properties should be applied. Defaults to `NO`.
|
||||
|
||||
<script src="https://gist.github.com/emilsjolander/b95467f51b945e906d39b66e44999806.js"></script>
|
||||
|
||||
### Children
|
||||
|
||||
Yoga relies on `UIView` subviews to build up its internal layout tree. However using properties such as `yg_includeInLayout` a View can exclude itself from layout. Therefor we provide the following method to query the number of children which are laid out using Yoga.
|
||||
|
||||
<script src="https://gist.github.com/emilsjolander/253d69b12bef2ee1ec899ace81b768a6.js"></script>
|
||||
|
||||
### Style setters
|
||||
|
||||
The large part of Yoga's API consists of setters for styles. These all follow the same general structure. Bellow are the function and enums used to control the various styles. For an in depth guide to how each style works see the getting started guide.
|
||||
|
||||
<script src="https://gist.github.com/emilsjolander/e7c7732b9465173335d2e019a6bc5941.js"></script>
|
||||
|
||||
### Layout
|
||||
- `yg_includeInLayout` decides if we should include this view when calculating layout. Defaults to `YES`.
|
||||
- `yg_intrinsicSize` returns the size of the view if no constraints were given. This is equivalent to calling `[view sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]`.
|
||||
- `yg_applyLayout` performs layout calculation and update the frames of the views in the hierarchy with the results.
|
||||
- `yg_resolvedDirection` returns the resolved layout direction of this view. Either `YGDirectionRTL` or `YGDirectionLTR`.
|
||||
|
||||
<script src="https://gist.github.com/emilsjolander/437661e872c1f9106b728419d5ea49e9.js"></script>
|
27
docs/_docs/api/yogakit.md
Normal file
27
docs/_docs/api/yogakit.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
docid: yogakit
|
||||
title: YogaKit
|
||||
layout: docs
|
||||
permalink: /docs/api/yogakit/
|
||||
---
|
||||
|
||||
> The YogaKit API is still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues).
|
||||
|
||||
YogaKit is a Objective-C (and Swift-compatible) wrapper for Yoga. It allows iOS Developers to manage the layout of their views using the power of Yoga.
|
||||
|
||||
Layout configuration is done via the [YGLayout](https://github.com/facebook/yoga/blob/master/YogaKit/YGLayout.h) object. YogaKit exposes `YGLayout` via a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview).
|
||||
|
||||
### Lifecycle
|
||||
|
||||
As with any `UIView`, instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. YogaKit uses the frame of the parent view to determine the space that is available for children in layout.
|
||||
|
||||
### Children
|
||||
|
||||
Yoga relies on `UIView` subviews to build up its internal layout tree. However, a subview can exclude itself from layout by setting the `isIncludedInLayout` property on `YGLayout` to `NO`.
|
||||
|
||||
It is also possible to query the number of children **included** in layout via `numberOfChildren`.
|
||||
|
||||
### Layout
|
||||
To apply a layout to a view (and its' subviews) you need to call `[view.yoga applyLayout]`. This will do a layout calculation (if needed) and apply the calculated frames to every view included in the layout.
|
||||
|
||||
In the event that you need to another layout pass on a view you can mark it dirty via `[view.yoga markDirty]`.
|
@@ -5,32 +5,30 @@ layout: docs
|
||||
permalink: /docs/aspect-ratio/
|
||||
---
|
||||
|
||||
`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined. `AspectRatio` can apply to either the width or the height of an item, it depends on which dimension is fixed. `AspectRatio` Also respects the `Min` and `Max` dimensions of an item.
|
||||
`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined.
|
||||
|
||||
- If an item has a `Width` set then `AspectRatio` controls the item's height.
|
||||
- If an item has a `Height` set then `AspectRatio` controls the item's width.
|
||||
- If an item has a `FlexBasis` set then `AspectRatio` controls the item's cross axis dimension.
|
||||
- If an item's alignment is `Stretch` and its main axis is undefined then `AspectRatio` controls the item's main axis dimension.
|
||||
- If an item has `FlexGrow` or `FlexShrink` set then `AspectRatio` controls the item's cross axis dimension if it is undefined.
|
||||
- If both dimensions of an item are fixed then `AspectRatio` is ignored.
|
||||
- `AspectRatio` is defined as the ratio between the width and the height of a node e.g. if a node has an aspect ratio of 2 then its width is twice the size of its height.
|
||||
- `AspectRatio` respects the `Min` and `Max` dimensions of an item.
|
||||
- `AspectRatio` has higher priority than `FlexGrow`
|
||||
- If `AspectRatio`, `Width`, and `Height` are set then the cross dimension is overridden.
|
||||
|
||||
#### Width = 100; AspectRatio = 2;
|
||||
|
||||
<div class="yoga" style="align-items: flex-start;">
|
||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
||||
<div class="yoga" style="background-color: #303846; width: 100px; height: 200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
#### Width = 100; AspectRatio = 0.5;
|
||||
|
||||
<div class="yoga" style="align-items: flex-start;">
|
||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
||||
<div class="yoga" style="background-color: #303846; width: 100px; height: 50px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 0.5;
|
||||
#### Width = 100; AspectRatio = 0.5;
|
||||
|
||||
<div class="yoga" style="align-items: flex-start;">
|
||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
||||
<div class="yoga" style="background-color: #303846; width: 100px; height: 200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 2;
|
||||
|
||||
<div class="yoga" style="align-items: flex-start;">
|
||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px; flex-direction: row;">
|
||||
|
@@ -29,7 +29,7 @@ id: home
|
||||
</div>
|
||||
</div>
|
||||
<div class="blockContent gistsample">
|
||||
<script src="https://gist.github.com/emilsjolander/56c2ea1167dafdc996a2527aa4c8ec7c.js"></script>
|
||||
<script src="https://gist.github.com/dshahidehpour/a426c443a1e02c5432b22b09c457ede0.js"></script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
22
java/com/facebook/yoga/YogaBaselineFunction.java
Normal file
22
java/com/facebook/yoga/YogaBaselineFunction.java
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public interface YogaBaselineFunction {
|
||||
/**
|
||||
* Return the baseline of the node in pixels. When no baseline function is set the baseline
|
||||
* default to the computed height of the node.
|
||||
*/
|
||||
@DoNotStrip
|
||||
float baseline(YogaNodeAPI node, float width, float height);
|
||||
}
|
@@ -52,6 +52,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
private YogaNode mParent;
|
||||
private List<YogaNode> mChildren;
|
||||
private YogaMeasureFunction mMeasureFunction;
|
||||
private YogaBaselineFunction mBaselineFunction;
|
||||
private long mNativePointer;
|
||||
private Object mData;
|
||||
|
||||
@@ -69,6 +70,14 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
@DoNotStrip
|
||||
private float mLeft = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mMarginLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginTop = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginRight = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginBottom = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingTop = 0;
|
||||
@@ -572,6 +581,26 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutMargin(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mMarginLeft;
|
||||
case TOP:
|
||||
return mMarginTop;
|
||||
case RIGHT:
|
||||
return mMarginRight;
|
||||
case BOTTOM:
|
||||
return mMarginBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginRight : mMarginLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginLeft : mMarginRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutPadding(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
@@ -623,6 +652,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
YogaMeasureMode.values()[heightMode]);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
@Override
|
||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||
mBaselineFunction = baselineFunction;
|
||||
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public final float baseline(float width, float height) {
|
||||
return mBaselineFunction.baseline(this, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMeasureDefined() {
|
||||
return mMeasureFunction != null;
|
||||
|
@@ -18,6 +18,7 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
||||
YogaNodeType getParent();
|
||||
int indexOf(YogaNodeType child);
|
||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
||||
boolean isMeasureDefined();
|
||||
void calculateLayout();
|
||||
boolean isDirty();
|
||||
@@ -81,6 +82,7 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
||||
float getLayoutY();
|
||||
float getLayoutWidth();
|
||||
float getLayoutHeight();
|
||||
float getLayoutMargin(YogaEdge edge);
|
||||
float getLayoutPadding(YogaEdge edge);
|
||||
YogaDirection getLayoutDirection();
|
||||
YogaOverflow getOverflow();
|
||||
|
@@ -19,7 +19,7 @@ public class YogaValue {
|
||||
public final float value;
|
||||
public final YogaUnit unit;
|
||||
|
||||
YogaValue(float value, YogaUnit unit) {
|
||||
public YogaValue(float value, YogaUnit unit) {
|
||||
this.value = value;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
@@ -30,6 +30,11 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
|
||||
static auto leftField = obj->getClass()->getField<jfloat>("mLeft");
|
||||
static auto topField = obj->getClass()->getField<jfloat>("mTop");
|
||||
|
||||
static auto marginLeftField = obj->getClass()->getField<jfloat>("mMarginLeft");
|
||||
static auto marginTopField = obj->getClass()->getField<jfloat>("mMarginTop");
|
||||
static auto marginRightField = obj->getClass()->getField<jfloat>("mMarginRight");
|
||||
static auto marginBottomField = obj->getClass()->getField<jfloat>("mMarginBottom");
|
||||
|
||||
static auto paddingLeftField = obj->getClass()->getField<jfloat>("mPaddingLeft");
|
||||
static auto paddingTopField = obj->getClass()->getField<jfloat>("mPaddingTop");
|
||||
static auto paddingRightField = obj->getClass()->getField<jfloat>("mPaddingRight");
|
||||
@@ -40,6 +45,11 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
|
||||
obj->setFieldValue(leftField, YGNodeLayoutGetLeft(root));
|
||||
obj->setFieldValue(topField, YGNodeLayoutGetTop(root));
|
||||
|
||||
obj->setFieldValue(marginLeftField, YGNodeLayoutGetMargin(root, YGEdgeLeft));
|
||||
obj->setFieldValue(marginTopField, YGNodeLayoutGetMargin(root, YGEdgeTop));
|
||||
obj->setFieldValue(marginRightField, YGNodeLayoutGetMargin(root, YGEdgeRight));
|
||||
obj->setFieldValue(marginBottomField, YGNodeLayoutGetMargin(root, YGEdgeBottom));
|
||||
|
||||
obj->setFieldValue(paddingLeftField, YGNodeLayoutGetPadding(root, YGEdgeLeft));
|
||||
obj->setFieldValue(paddingTopField, YGNodeLayoutGetPadding(root, YGEdgeTop));
|
||||
obj->setFieldValue(paddingRightField, YGNodeLayoutGetPadding(root, YGEdgeRight));
|
||||
@@ -63,6 +73,14 @@ static void YGPrint(YGNodeRef node) {
|
||||
}
|
||||
}
|
||||
|
||||
static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) {
|
||||
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
||||
return findClassLocal("com/facebook/yoga/YogaNode")->getMethod<jfloat(jfloat, jfloat)>("baseline")(obj, width, height);
|
||||
} else {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
static YGSize YGJNIMeasureFunc(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
@@ -203,6 +221,10 @@ void jni_YGNodeSetHasMeasureFunc(alias_ref<jobject>, jlong nativePointer, jboole
|
||||
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
||||
}
|
||||
|
||||
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>, jlong nativePointer, jboolean hasBaselineFunc) {
|
||||
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer), hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
||||
}
|
||||
|
||||
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
||||
return (jboolean) YGNodeGetHasNewLayout(_jlong2YGNodeRef(nativePointer));
|
||||
}
|
||||
@@ -332,6 +354,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||
YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen),
|
||||
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
||||
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
||||
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
||||
|
@@ -23,6 +23,35 @@ public class YogaNodeTest {
|
||||
assertEquals(refCount + 1, YogaNode.jni_YGNodeGetInstanceCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBaseline() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignItems(YogaAlign.BASELINE);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
final YogaNode child1 = new YogaNode();
|
||||
child1.setWidth(40);
|
||||
child1.setHeight(40);
|
||||
root.addChildAt(child1, 0);
|
||||
|
||||
final YogaNode child2 = new YogaNode();
|
||||
child2.setWidth(40);
|
||||
child2.setHeight(40);
|
||||
child2.setBaselineFunction(new YogaBaselineFunction() {
|
||||
public float baseline(YogaNodeAPI node, float width, float height) {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
root.addChildAt(child2, 1);
|
||||
|
||||
root.calculateLayout();
|
||||
|
||||
assertEquals(0, (int) child1.getLayoutY());
|
||||
assertEquals(40, (int) child2.getLayoutY());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMeasure() {
|
||||
final YogaNode node = new YogaNode();
|
||||
@@ -139,6 +168,23 @@ public class YogaNodeTest {
|
||||
assertEquals(100, (int) node0.getMaxHeight().value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLayoutMargin() {
|
||||
final YogaNode node = new YogaNode();
|
||||
node.setWidth(100);
|
||||
node.setHeight(100);
|
||||
node.setMargin(YogaEdge.START, 1);
|
||||
node.setMargin(YogaEdge.END, 2);
|
||||
node.setMargin(YogaEdge.TOP, 3);
|
||||
node.setMargin(YogaEdge.BOTTOM, 4);
|
||||
node.calculateLayout();
|
||||
|
||||
assertEquals(1, (int) node.getLayoutMargin(YogaEdge.LEFT));
|
||||
assertEquals(2, (int) node.getLayoutMargin(YogaEdge.RIGHT));
|
||||
assertEquals(3, (int) node.getLayoutMargin(YogaEdge.TOP));
|
||||
assertEquals(4, (int) node.getLayoutMargin(YogaEdge.BOTTOM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLayoutPadding() {
|
||||
final YogaNode node = new YogaNode();
|
||||
|
File diff suppressed because one or more lines are too long
@@ -453,3 +453,13 @@ Layout Node::getComputedLayout(void) const
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
double Node::getComputedMargin(int edge) const
|
||||
{
|
||||
return YGNodeLayoutGetMargin(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
double Node::getComputedPadding(int edge) const
|
||||
{
|
||||
return YGNodeLayoutGetPadding(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
@@ -176,6 +176,9 @@ class Node {
|
||||
|
||||
Layout getComputedLayout(void) const;
|
||||
|
||||
double getComputedMargin(int edge) const;
|
||||
double getComputedPadding(int edge) const;
|
||||
|
||||
private:
|
||||
|
||||
YGNodeRef m_node;
|
||||
|
@@ -153,4 +153,7 @@ NBIND_CLASS(Node)
|
||||
method(getComputedHeight);
|
||||
|
||||
method(getComputedLayout);
|
||||
|
||||
method(getComputedMargin);
|
||||
method(getComputedPadding);
|
||||
}
|
||||
|
33
javascript/tests/Facebook.Yoga/YGComputedMarginTest.js
Normal file
33
javascript/tests/Facebook.Yoga/YGComputedMarginTest.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
|
||||
|
||||
it("margin_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setMargin(Yoga.EDGE_START, `10%`);
|
||||
|
||||
root.calculateLayout(100, 100, Yoga.DIRECTION_LTR);
|
||||
|
||||
console.assert(10 === root.getComputedMargin(Yoga.EDGE_LEFT), "10 === root.getComputedMargin(Yoga.EDGE_LEFT)");
|
||||
console.assert(0 === root.getComputedMargin(Yoga.EDGE_RIGHT), "0 === root.getComputedMargin(Yoga.EDGE_RIGHT)");
|
||||
|
||||
root.calculateLayout(100, 100, Yoga.DIRECTION_RTL);
|
||||
|
||||
console.assert(0 === root.getComputedMargin(Yoga.EDGE_LEFT), "0 === root.getComputedMargin(Yoga.EDGE_LEFT)");
|
||||
console.assert(10 === root.getComputedMargin(Yoga.EDGE_RIGHT), "10 === root.getComputedMargin(Yoga.EDGE_RIGHT)");
|
||||
|
||||
if (typeof root !== "undefined")
|
||||
root.freeRecursive();
|
||||
|
||||
(typeof gc !== "undefined") && gc();
|
||||
console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")");
|
||||
});
|
33
javascript/tests/Facebook.Yoga/YGComputedPaddingTest.js
Normal file
33
javascript/tests/Facebook.Yoga/YGComputedPaddingTest.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
|
||||
|
||||
it("padding_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setPadding(Yoga.EDGE_START, `10%`);
|
||||
|
||||
root.calculateLayout(100, 100, Yoga.DIRECTION_LTR);
|
||||
|
||||
console.assert(10 === root.getComputedPadding(Yoga.EDGE_LEFT), "10 === root.getComputedPadding(Yoga.EDGE_LEFT)");
|
||||
console.assert(0 === root.getComputedPadding(Yoga.EDGE_RIGHT), "0 === root.getComputedPadding(Yoga.EDGE_RIGHT)");
|
||||
|
||||
root.calculateLayout(100, 100, Yoga.DIRECTION_RTL);
|
||||
|
||||
console.assert(0 === root.getComputedPadding(Yoga.EDGE_LEFT), "0 === root.getComputedPadding(Yoga.EDGE_LEFT)");
|
||||
console.assert(10 === root.getComputedPadding(Yoga.EDGE_RIGHT), "10 === root.getComputedPadding(Yoga.EDGE_RIGHT)");
|
||||
|
||||
if (typeof root !== "undefined")
|
||||
root.freeRecursive();
|
||||
|
||||
(typeof gc !== "undefined") && gc();
|
||||
console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")");
|
||||
});
|
@@ -676,3 +676,24 @@ TEST(YogaTest, aspect_ratio_height_overrides_align_stretch_column) {
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
TEST(YogaTest, aspect_ratio_allow_child_overflow_parent_size) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeStyleSetHeight(root_child0, 50);
|
||||
YGNodeStyleSetAspectRatio(root_child0, 4);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_EQ(50, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
30
tests/YGComputedMarginTest.cpp
Normal file
30
tests/YGComputedMarginTest.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include <yoga/Yoga.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(YogaTest, computed_layout_margin) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
YGNodeStyleSetMarginPercent(root, YGEdgeStart, 10);
|
||||
|
||||
YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetMargin(root, YGEdgeLeft));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetMargin(root, YGEdgeRight));
|
||||
|
||||
YGNodeCalculateLayout(root, 100, 100, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetMargin(root, YGEdgeLeft));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetMargin(root, YGEdgeRight));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
@@ -41,18 +41,12 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef YG_ENUM_BEGIN
|
||||
#ifndef NS_ENUM
|
||||
#define YG_ENUM_BEGIN(name) enum name
|
||||
#else
|
||||
#define YG_ENUM_BEGIN(name) NS_ENUM(NSInteger, name)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef YG_ENUM_END
|
||||
#ifndef NS_ENUM
|
||||
#define YG_ENUM_END(name) name
|
||||
#else
|
||||
#ifdef NS_ENUM
|
||||
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a enum).
|
||||
// Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
|
||||
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
|
||||
#define YG_ENUM_END(name)
|
||||
#endif
|
||||
#else
|
||||
#define YG_ENUM_BEGIN(name) enum name
|
||||
#define YG_ENUM_END(name) name
|
||||
#endif
|
||||
|
80
yoga/Yoga.c
80
yoga/Yoga.c
@@ -47,6 +47,7 @@ typedef struct YGCachedMeasurement {
|
||||
typedef struct YGLayout {
|
||||
float position[4];
|
||||
float dimensions[2];
|
||||
float margin[6];
|
||||
float padding[6];
|
||||
YGDirection direction;
|
||||
|
||||
@@ -181,8 +182,6 @@ YGCalloc gYGCalloc = &calloc;
|
||||
YGRealloc gYGRealloc = &realloc;
|
||||
YGFree gYGFree = &free;
|
||||
|
||||
static YGValue YGValueUndefined = YG_UNDEFINED_VALUES;
|
||||
|
||||
static YGValue YGValueZero = {.value = 0, .unit = YGUnitPixel};
|
||||
|
||||
#ifdef ANDROID
|
||||
@@ -532,6 +531,29 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
|
||||
return node->layout.instanceName; \
|
||||
}
|
||||
|
||||
#define YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(type, name, instanceName) \
|
||||
type YGNodeLayoutGet##name(const YGNodeRef node, const YGEdge edge) { \
|
||||
YG_ASSERT(edge <= YGEdgeEnd, "Cannot get layout properties of multi-edge shorthands"); \
|
||||
\
|
||||
if (edge == YGEdgeLeft) { \
|
||||
if (node->layout.direction == YGDirectionRTL) { \
|
||||
return node->layout.instanceName[YGEdgeEnd]; \
|
||||
} else { \
|
||||
return node->layout.instanceName[YGEdgeStart]; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if (edge == YGEdgeRight) { \
|
||||
if (node->layout.direction == YGDirectionRTL) { \
|
||||
return node->layout.instanceName[YGEdgeStart]; \
|
||||
} else { \
|
||||
return node->layout.instanceName[YGEdgeEnd]; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return node->layout.instanceName[edge]; \
|
||||
}
|
||||
|
||||
YG_NODE_PROPERTY_IMPL(void *, Context, context, context);
|
||||
YG_NODE_PROPERTY_IMPL(YGPrintFunc, PrintFunc, printFunc, print);
|
||||
YG_NODE_PROPERTY_IMPL(bool, HasNewLayout, hasNewLayout, hasNewLayout);
|
||||
@@ -573,27 +595,8 @@ YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]);
|
||||
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]);
|
||||
YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction);
|
||||
|
||||
float YGNodeLayoutGetPadding(const YGNodeRef node, const YGEdge edge) {
|
||||
YG_ASSERT(edge <= YGEdgeEnd, "Cannot get layout paddings of multi-edge shorthands");
|
||||
|
||||
if (edge == YGEdgeLeft) {
|
||||
if (node->layout.direction == YGDirectionRTL) {
|
||||
return node->layout.padding[YGEdgeEnd];
|
||||
} else {
|
||||
return node->layout.padding[YGEdgeStart];
|
||||
}
|
||||
}
|
||||
|
||||
if (edge == YGEdgeRight) {
|
||||
if (node->layout.direction == YGDirectionRTL) {
|
||||
return node->layout.padding[YGEdgeStart];
|
||||
} else {
|
||||
return node->layout.padding[YGEdgeEnd];
|
||||
}
|
||||
}
|
||||
|
||||
return node->layout.padding[edge];
|
||||
}
|
||||
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin);
|
||||
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding);
|
||||
|
||||
uint32_t gCurrentGenerationCount = 0;
|
||||
|
||||
@@ -1744,6 +1747,23 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
const YGDirection direction = YGNodeResolveDirection(node, parentDirection);
|
||||
node->layout.direction = direction;
|
||||
|
||||
node->layout.margin[YGEdgeStart] =
|
||||
YGNodeLeadingMargin(node,
|
||||
YGFlexDirectionResolve(YGFlexDirectionRow, direction),
|
||||
parentWidth);
|
||||
node->layout.margin[YGEdgeEnd] =
|
||||
YGNodeTrailingMargin(node,
|
||||
YGFlexDirectionResolve(YGFlexDirectionRow, direction),
|
||||
parentWidth);
|
||||
node->layout.margin[YGEdgeTop] =
|
||||
YGNodeLeadingMargin(node,
|
||||
YGFlexDirectionResolve(YGFlexDirectionColumn, direction),
|
||||
parentWidth);
|
||||
node->layout.margin[YGEdgeBottom] =
|
||||
YGNodeTrailingMargin(node,
|
||||
YGFlexDirectionResolve(YGFlexDirectionColumn, direction),
|
||||
parentWidth);
|
||||
|
||||
node->layout.padding[YGEdgeStart] =
|
||||
YGNodeLeadingPadding(node,
|
||||
YGFlexDirectionResolve(YGFlexDirectionRow, direction),
|
||||
@@ -2239,8 +2259,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
availableInnerWidth));
|
||||
childHeightMeasureMode = YGMeasureModeExactly;
|
||||
|
||||
childHeight = fminf(childHeight, availableInnerHeight);
|
||||
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
||||
// Parent size constraint should have higher priority than flex
|
||||
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||
childHeight = fminf(childHeight, availableInnerHeight);
|
||||
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
||||
}
|
||||
} else {
|
||||
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
|
||||
YGNodePaddingAndBorderForAxis(currentRelativeChild,
|
||||
@@ -2248,8 +2271,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
availableInnerWidth));
|
||||
childWidthMeasureMode = YGMeasureModeExactly;
|
||||
|
||||
childWidth = fminf(childWidth, availableInnerWidth);
|
||||
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
||||
// Parent size constraint should have higher priority than flex
|
||||
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||
childWidth = fminf(childWidth, availableInnerWidth);
|
||||
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,8 @@ typedef struct YGValue {
|
||||
YGUnit unit;
|
||||
} YGValue;
|
||||
|
||||
static const YGValue YGValueUndefined = { YGUndefined, YGUnitUndefined };
|
||||
|
||||
typedef struct YGNode *YGNodeRef;
|
||||
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
||||
float width,
|
||||
@@ -197,6 +199,7 @@ YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
||||
// pixel values then the returned value will be the same as YGNodeStyleGetPadding. However if
|
||||
// padding was set using a percentage value then the returned value is the computed value used
|
||||
// during layout.
|
||||
WIN_EXPORT float YGNodeLayoutGetMargin(const YGNodeRef node, const YGEdge edge);
|
||||
WIN_EXPORT float YGNodeLayoutGetPadding(const YGNodeRef node, const YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGSetLogger(YGLogger logger);
|
||||
|
Reference in New Issue
Block a user