Compare commits
410 Commits
v1.1.1
...
v2017.01.09.00
Author | SHA1 | Date | |
---|---|---|---|
|
9982295e10 | ||
|
8ed71b2777 | ||
|
969b3709db | ||
|
e2a7938b26 | ||
|
70a4221b9e | ||
|
8d320ceac2 | ||
|
c169a98be6 | ||
|
6d48307c8d | ||
|
e539ecc9aa | ||
|
bf5eeaf61e | ||
|
a36faf89e3 | ||
|
29c44e281c | ||
|
1877a97898 | ||
|
bf6602ebff | ||
|
6bcf0e3a50 | ||
|
d0aeabb8f0 | ||
|
956df20c64 | ||
|
7108454455 | ||
|
663a93912b | ||
|
a85bd4ad2a | ||
|
6f462a72bf | ||
|
352f592767 | ||
|
f2080e520f | ||
|
cd78291de5 | ||
|
ab595d1875 | ||
|
597544e30a | ||
|
9f59a13836 | ||
|
12017e49bd | ||
|
abad796c44 | ||
|
92137273a2 | ||
|
f1ab289022 | ||
|
a302b76d59 | ||
|
4717594e93 | ||
|
df0f76bba5 | ||
|
e43c9f66ff | ||
|
0df58d8aa2 | ||
|
ff1a0e1eb8 | ||
|
ed765fe508 | ||
|
1b5eb7da5e | ||
|
071f576db9 | ||
|
3d10ba5f72 | ||
|
85b8386ba1 | ||
|
7ec3607446 | ||
|
835bb1cd9c | ||
|
9d35dce63e | ||
|
74fb205083 | ||
|
ba0bb10366 | ||
|
0296511f2c | ||
|
04fe81f88f | ||
|
98bbc15435 | ||
|
25b206ac53 | ||
|
88a4e44fd4 | ||
|
642ea07d6f | ||
|
e85c5ce39d | ||
|
cf753af247 | ||
|
12efe604bb | ||
|
f36f545d75 | ||
|
8fcd544c81 | ||
|
73662ebf83 | ||
|
47a8ec06a1 | ||
|
b611fac20b | ||
|
b11155423c | ||
|
40371cbf2d | ||
|
613590b0d8 | ||
|
4710a65f7a | ||
|
901f65ca05 | ||
|
72cf6806de | ||
|
1b7ae2ed3d | ||
|
c6100d0771 | ||
|
6339467b6d | ||
|
dda24b1e23 | ||
|
f7cc614d67 | ||
|
4bbf35832e | ||
|
b9feb10420 | ||
|
42b6f6b6e5 | ||
|
07cf47baad | ||
|
686289814d | ||
|
bb37e65ab1 | ||
|
31b961d8b3 | ||
|
4a578284a5 | ||
|
c5bbcd78ae | ||
|
4fbe0495b4 | ||
|
ff3d2e1691 | ||
|
684a36d6cf | ||
|
7d74e1cb66 | ||
|
b32b6029de | ||
|
5fa42cd1b0 | ||
|
6318801470 | ||
|
97d524fa96 | ||
|
c31df519e0 | ||
|
0240d09949 | ||
|
22b0fdb3e6 | ||
|
a0d560a24b | ||
|
dc10fdd958 | ||
|
b90f6e21bd | ||
|
d54f09e32b | ||
|
49a21e657b | ||
|
2d58a36619 | ||
|
f56e8a5163 | ||
|
e78cf02a30 | ||
|
55fc795686 | ||
|
b16c22a8f3 | ||
|
56ec33a463 | ||
|
367c3a28be | ||
|
653150a7c4 | ||
|
542fc50409 | ||
|
4f192481ee | ||
|
0bb2955c5c | ||
|
191ac98b89 | ||
|
32c175ac55 | ||
|
4b61cdccea | ||
|
b9c4c403a9 | ||
|
56aa279fef | ||
|
7e4bb732ff | ||
|
32ba5ae647 | ||
|
2fa6f5087d | ||
|
c2aac9f46e | ||
|
ef81d4b0c7 | ||
|
667858990c | ||
|
d80bac4234 | ||
|
d1c555fede | ||
|
ac4d0ab2a1 | ||
|
603321e1ab | ||
|
129437f49e | ||
|
204aba80b9 | ||
|
e6702e1168 | ||
|
b99172d28b | ||
|
7a3df9999b | ||
|
e0e88f97b6 | ||
|
b4d0e1a17c | ||
|
e40af30fa5 | ||
|
cd054ecf26 | ||
|
aaa977f645 | ||
|
70e01a4476 | ||
|
3e2c13f418 | ||
|
0dbbfc5910 | ||
|
f222d22ba8 | ||
|
087d1f3a82 | ||
|
c382d513fb | ||
|
8a7183f465 | ||
|
ff602d4606 | ||
|
f5912a97e4 | ||
|
a253c6fbb7 | ||
|
863378d74e | ||
|
f1fcd5e382 | ||
|
6a6efe0764 | ||
|
e54af5e854 | ||
|
502f3c7010 | ||
|
12ebaa56b6 | ||
|
3e567fdcae | ||
|
1baa239389 | ||
|
b50090a04e | ||
|
ba2905dd1d | ||
|
997088ffbb | ||
|
ffb90e6ff2 | ||
|
1c22a1aa53 | ||
|
7082734c6b | ||
|
366a61af8d | ||
|
18fe0959f0 | ||
|
1ffce3edb1 | ||
|
6165d7a2be | ||
|
01a3881426 | ||
|
9c1896043d | ||
|
0f822bbef2 | ||
|
e00e30ca15 | ||
|
b938017ccf | ||
|
630ae0972b | ||
|
d8662805d5 | ||
|
26e7490fc9 | ||
|
d94363ea7e | ||
|
af5e6771d7 | ||
|
ced779b259 | ||
|
a65e6930cf | ||
|
267e17f23a | ||
|
df6368e048 | ||
|
ba20d75992 | ||
|
620cb3f507 | ||
|
3201e24780 | ||
|
2cac77eaa1 | ||
|
46823878a5 | ||
|
b59ce09109 | ||
|
c34299edc9 | ||
|
1ba81d9ec7 | ||
|
d6d817c142 | ||
|
01c2ac3369 | ||
|
0cc1b83569 | ||
|
c8d77b2aae | ||
|
01507044b3 | ||
|
2168d68007 | ||
|
4d0e657653 | ||
|
4452c7be5c | ||
|
15f5c4cea5 | ||
|
97fef59f96 | ||
|
e9b9973cae | ||
|
69c374e74e | ||
|
4c57029a28 | ||
|
c28429efc8 | ||
|
ab4ce535b9 | ||
|
7fee10691c | ||
|
4d964bdbc3 | ||
|
ef538a45cd | ||
|
dc5e613285 | ||
|
1488f822c3 | ||
|
7673de823f | ||
|
26bcc1e072 | ||
|
2e090cb1c8 | ||
|
daed6f5b8a | ||
|
e4ad7d3c12 | ||
|
fa2ffc72a4 | ||
|
d1d9326fa4 | ||
|
9c3970dd75 | ||
|
6152ca46c8 | ||
|
9fb1b29f14 | ||
|
82dafa75cf | ||
|
eb4f1cdc96 | ||
|
501ed57784 | ||
|
bfb9b926b3 | ||
|
b21efa45e6 | ||
|
c619c0be5a | ||
|
63d3e8f3f3 | ||
|
770fa6d254 | ||
|
eedee80f25 | ||
|
0254e3e97f | ||
|
05ba3a2565 | ||
|
89440f630f | ||
|
832d07902e | ||
|
b45a7e3737 | ||
|
14009ec470 | ||
|
203e3dc9b8 | ||
|
7548164edb | ||
|
722bfb9032 | ||
|
2a8a4e10c6 | ||
|
8df9320f4c | ||
|
df6b4d3682 | ||
|
8939bcb96d | ||
|
d3fc24e842 | ||
|
7f6b942146 | ||
|
29fa232129 | ||
|
41b64478c4 | ||
|
23acf2156f | ||
|
1de914737a | ||
|
033658196f | ||
|
136ec25e8c | ||
|
62dba4c741 | ||
|
871a7cf310 | ||
|
cdf4ee1e59 | ||
|
588d2c91ba | ||
|
f61fbd269e | ||
|
d506e6ab94 | ||
|
56f6efdecf | ||
|
90844d62c5 | ||
|
c233bafeb2 | ||
|
b57abb2f60 | ||
|
56279110c0 | ||
|
01115b8bbd | ||
|
47bd1bb943 | ||
|
2870d3ce4d | ||
|
23f2878808 | ||
|
11f85ce91e | ||
|
1f300a58fb | ||
|
dbf3b11946 | ||
|
3b1515f2b7 | ||
|
6b16dc4060 | ||
|
9c93c7fc42 | ||
|
15d5cb0169 | ||
|
dba5faabb2 | ||
|
ff8f17ac99 | ||
|
017fb2c734 | ||
|
8fd14c710c | ||
|
1415a5d7fd | ||
|
2592894d2d | ||
|
dcaef7ecb0 | ||
|
2dcd8b4074 | ||
|
1951242a52 | ||
|
d4121401d7 | ||
|
0be3b1013f | ||
|
21a05417cd | ||
|
8fcb265830 | ||
|
64fffcb8f3 | ||
|
059384f277 | ||
|
57725e849a | ||
|
b51e832e4e | ||
|
d9191431ff | ||
|
251a499ba6 | ||
|
3c33184dbb | ||
|
583830b3df | ||
|
36eaae88e0 | ||
|
284634c880 | ||
|
94bbbde930 | ||
|
1051c39a59 | ||
|
1abb2d1714 | ||
|
c28148caff | ||
|
e3fa40e694 | ||
|
89c00a7a3b | ||
|
2808e547c6 | ||
|
8b4a61df1a | ||
|
43faff434a | ||
|
ea9a6ce06f | ||
|
beb51fac1b | ||
|
d33befeb98 | ||
|
2fc622adbd | ||
|
1fd3a16116 | ||
|
aa70125f6c | ||
|
9985e398b3 | ||
|
b629bcacab | ||
|
f65febb1af | ||
|
ccbfee3841 | ||
|
9eb75e27cc | ||
|
15afb4207c | ||
|
f1ae87cd73 | ||
|
e8465aee45 | ||
|
ca72b2b796 | ||
|
4bcefd8845 | ||
|
0672f5572f | ||
|
9d34b4e110 | ||
|
dab03cb800 | ||
|
dd2346f8ac | ||
|
dde2b349f2 | ||
|
7cd6305371 | ||
|
f28dacf280 | ||
|
a960203567 | ||
|
48e5304276 | ||
|
53ff4f59ca | ||
|
28bc42a988 | ||
|
c373056d80 | ||
|
f68521aa69 | ||
|
fdd5c8ce82 | ||
|
7a1e353404 | ||
|
6a44dbc43b | ||
|
597354a43b | ||
|
1ce14cd097 | ||
|
d125911894 | ||
|
e307dc22d1 | ||
|
916170f6ac | ||
|
57021eba9d | ||
|
a43b813517 | ||
|
e5a3f7bf5b | ||
|
af5b14335e | ||
|
118f64f206 | ||
|
450472766d | ||
|
759cb707a4 | ||
|
328db9ca1c | ||
|
f15b563166 | ||
|
7f27046cc5 | ||
|
faad5cdf4d | ||
|
256d080fd2 | ||
|
efe1595f0e | ||
|
9278ff462e | ||
|
b32d384337 | ||
|
f5caf93c6e | ||
|
c74eae50ac | ||
|
7af5e3d68d | ||
|
9689062f6c | ||
|
ac44d2ea6e | ||
|
9ab97af05d | ||
|
cdf18b9c2b | ||
|
c7d02257e3 | ||
|
c72321f8a9 | ||
|
a0805d0b90 | ||
|
5207b90420 | ||
|
5e7d95b403 | ||
|
041960fcbc | ||
|
46c842c71a | ||
|
b26794a375 | ||
|
8ffff2bfaf | ||
|
fdd8552c4e | ||
|
93809b69c8 | ||
|
667106e423 | ||
|
57874a1a9e | ||
|
8b7f353746 | ||
|
ca34ff4446 | ||
|
d878091c4b | ||
|
c4fa32cfd3 | ||
|
6e05325f08 | ||
|
a1f36b53f5 | ||
|
383d8a6b3d | ||
|
7b0c008300 | ||
|
45e595e6ae | ||
|
2a816bf5a7 | ||
|
71eb25d1cc | ||
|
c06752e052 | ||
|
bd92550d57 | ||
|
9260363fef | ||
|
9d62cee68b | ||
|
16f43dac87 | ||
|
8177bfe702 | ||
|
8779d942ea | ||
|
f3dd51ab97 | ||
|
b0d00ad338 | ||
|
7bd6b2b7dd | ||
|
68e0b0cc58 | ||
|
5b56be412c | ||
|
3454511947 | ||
|
b157ab4a00 | ||
|
8d5cdd4e6c | ||
|
425345aa8d | ||
|
dd8e5cd65d | ||
|
64704dd708 | ||
|
dc7059d340 | ||
|
acd295e470 | ||
|
5d5630d3c8 | ||
|
c9094f94d0 | ||
|
f3b6fb3be0 | ||
|
3d7bc48fa6 | ||
|
219bdaed15 | ||
|
f2aa5ba604 | ||
|
53769ccbc5 | ||
|
2733ebf1d0 | ||
|
45227c0b9a | ||
|
e848706911 |
2
.buckconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
[cxx]
|
||||
gtest_dep = //lib/gtest:gtest
|
20
.eslintrc
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"extends": "./node_modules/fbjs-scripts/eslint/.eslintrc",
|
||||
"globals": {
|
||||
"jasmine": true,
|
||||
"describe": true,
|
||||
"beforeEach": true,
|
||||
"afterEach": true,
|
||||
"spyOn": true,
|
||||
"it": true,
|
||||
"xit": true,
|
||||
"expect": true,
|
||||
"require": true,
|
||||
"global": true,
|
||||
"__dirname": true,
|
||||
"module": true,
|
||||
"console": true,
|
||||
"setTimeout": true,
|
||||
"define": true
|
||||
}
|
||||
}
|
65
.gitignore
vendored
@@ -1,7 +1,58 @@
|
||||
a.out
|
||||
*.class
|
||||
/**/java/out/*
|
||||
/**/.idea/workspace.xml
|
||||
/lib/
|
||||
/node_modules/
|
||||
npm-debug.log
|
||||
.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
|
||||
|
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "lib/gtest/googletest"]
|
||||
path = lib/gtest/googletest
|
||||
url = https://github.com/google/googletest.git
|
58
.hgignore
Normal file
@@ -0,0 +1,58 @@
|
||||
.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
|
48
.travis.yml
@@ -1,14 +1,42 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.12"
|
||||
# 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.
|
||||
|
||||
sudo: false
|
||||
os: osx
|
||||
osx_image: xcode7.3
|
||||
language: cpp
|
||||
compiler: clang
|
||||
|
||||
before_install:
|
||||
- npm install grunt-cli -g
|
||||
- brew update
|
||||
- brew tap facebook/fb
|
||||
- brew install buck
|
||||
- brew cask install java
|
||||
- brew outdated xctool || brew upgrade xctool
|
||||
- brew install mono
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc
|
||||
|
||||
- export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
|
||||
- export PATH=$JAVA_HOME/bin:$PATH
|
||||
|
||||
install:
|
||||
- cd javascript
|
||||
- npm install
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
|
||||
script:
|
||||
- buck test //:yoga
|
||||
- buck test //java:java
|
||||
- buck test //YogaKit:YogaKitTests --config cxx.default_platform=iphonesimulator-x86_64 --config cxx.cflags=-DTRAVIS_CI
|
||||
- sh csharp/tests/Facebook.Yoga/test_macos.sh
|
||||
|
||||
- cd javascript
|
||||
- npm run test:all
|
||||
- npm run bench
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
|
||||
- buck run //benchmark:benchmark
|
||||
- git checkout HEAD^
|
||||
- buck run //benchmark:benchmark
|
||||
|
42
BUCK
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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_defs('//YOGA_DEFS')
|
||||
|
||||
GMOCK_OVERRIDE_FLAGS = [
|
||||
# gmock does not mark mocked methods as override, ignore the warnings in tests
|
||||
'-Wno-inconsistent-missing-override',
|
||||
]
|
||||
|
||||
COMPILER_FLAGS = BASE_COMPILER_FLAGS + ['-std=c11', '-fPIC']
|
||||
TEST_COMPILER_FLAGS = BASE_COMPILER_FLAGS + GMOCK_OVERRIDE_FLAGS + ['-std=c++11']
|
||||
|
||||
cxx_library(
|
||||
name = 'yoga',
|
||||
soname = 'libyogacore.$(ext)',
|
||||
srcs = glob(['yoga/*.c']),
|
||||
tests=[':YogaTests'],
|
||||
exported_headers = subdir_glob([('', 'yoga/*.h')]),
|
||||
header_namespace = '',
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
deps = [] if THIS_IS_FBOBJC else [
|
||||
yoga_dep('lib/fb:ndklog'),
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
cxx_test(
|
||||
name = 'YogaTests',
|
||||
contacts = ['emilsj@fb.com'],
|
||||
srcs = glob(['tests/*.cpp']),
|
||||
compiler_flags = TEST_COMPILER_FLAGS,
|
||||
deps = [
|
||||
':yoga',
|
||||
GTEST_TARGET,
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
@@ -1,10 +1,7 @@
|
||||
# Contributing to css-layout
|
||||
# Contributing to yoga
|
||||
We want to make contributing to this project as easy and transparent as
|
||||
possible.
|
||||
|
||||
## Our Development Process
|
||||
All the development is happening on GitHub first and we have internal tools to sync down to Facebook codebase.
|
||||
|
||||
## Pull Requests
|
||||
We actively welcome your pull requests.
|
||||
1. Fork the repo and create your branch from `master`.
|
||||
@@ -29,10 +26,8 @@ disclosure of security bugs. In those cases, please go through the process
|
||||
outlined on that page and do not file a public issue.
|
||||
|
||||
## Coding Style
|
||||
* 2 spaces for indentation rather than tabs
|
||||
* 80 character line length
|
||||
* ...
|
||||
* format.sh
|
||||
|
||||
## License
|
||||
By contributing to css-layout, you agree that your contributions will be licensed
|
||||
By contributing to yoga, you agree that your contributions will be licensed
|
||||
under its BSD license.
|
189
Gruntfile.js
@@ -1,189 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(grunt) {
|
||||
var path = require('path');
|
||||
var isWindows = (/^win/).test(process.platform);
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
// config
|
||||
var config = {
|
||||
delimiter: path.delimiter,
|
||||
libName: 'css-layout',
|
||||
distFolder: 'dist',
|
||||
srcFolder: 'src',
|
||||
testFolder: 'src/__tests__',
|
||||
javaLibFolder: 'src/java/lib',
|
||||
javaSource: 'src/java/tests/com/facebook/csslayout/*.java',
|
||||
javaTestFiles: 'org.junit.runner.JUnitCore com.facebook.csslayout.LayoutEngineTest com.facebook.csslayout.LayoutCachingTest com.facebook.csslayout.CSSNodeTest'
|
||||
};
|
||||
|
||||
// C compilation configuration
|
||||
if (isWindows) {
|
||||
// Windows build, assumes cl is in the path (see https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
|
||||
config.cTestOutput = 'c_test.exe';
|
||||
config.cTestCompile = 'cl -nologo -Zi -Tpsrc/__tests__/Layout-test.c -Tpsrc/Layout.c -Tpsrc/Layout-test-utils.c -link -incremental:no -out:"<%= config.cTestOutput %>"';
|
||||
config.cTestExecute = '<%= config.cTestOutput %>';
|
||||
config.cTestClean = ['<%= config.cTestOutput %>', '*.obj', '*.pdb'];
|
||||
} else {
|
||||
// GCC build (OSX, Linux, ...), assumes gcc is in the path.
|
||||
config.cTestOutput = 'c_test';
|
||||
config.cTestCompile = 'gcc -std=c99 -Werror -Wno-padded src/__tests__/Layout-test.c src/Layout.c src/Layout-test-utils.c -lm -o "./<%= config.cTestOutput %>"';
|
||||
config.cTestExecute = './<%= config.cTestOutput %>';
|
||||
config.cTestClean = ['<%= config.cTestOutput %>'];
|
||||
}
|
||||
|
||||
grunt.initConfig({
|
||||
config: config,
|
||||
|
||||
mkdir: {
|
||||
dist: {
|
||||
options: {
|
||||
create: ['<%= config.distFolder %>']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clean: {
|
||||
dist: ['<%= config.distFolder %>/css-layout.*'],
|
||||
cTest: config.cTestClean,
|
||||
javaTest: ['**/*.class']
|
||||
},
|
||||
|
||||
eslint: {
|
||||
options: {
|
||||
configFile: '.eslintrc'
|
||||
},
|
||||
target: ['<%= config.srcFolder %>/**/*.js', './Gruntfile.js']
|
||||
},
|
||||
|
||||
includereplace: {
|
||||
options: {
|
||||
prefix: '// @@'
|
||||
},
|
||||
main: {
|
||||
src: '<%= config.srcFolder %>/<%= config.libName %>.js',
|
||||
dest: '<%= config.distFolder %>/<%= config.libName %>.js'
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sourceMapIncludeSources: true
|
||||
},
|
||||
main: {
|
||||
files: {
|
||||
'<%= config.distFolder %>/<%= config.libName %>.min.js':
|
||||
['<%= config.distFolder %>/<%= config.libName %>.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
karma: {
|
||||
main: {
|
||||
options: {
|
||||
files: [
|
||||
'<%= config.srcFolder %>/Layout.js',
|
||||
'<%= config.srcFolder %>/Layout-test-utils.js',
|
||||
'<%= config.testFolder %>/Layout-test.js',
|
||||
'<%= config.testFolder %>/Layout-consts-test.js'
|
||||
],
|
||||
browsers: ['Chrome'],
|
||||
frameworks: ['jasmine'],
|
||||
singleRun: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
execute: {
|
||||
transpile: {
|
||||
src: ['<%= config.srcFolder %>/transpile.js']
|
||||
}
|
||||
},
|
||||
|
||||
concat: {
|
||||
options: {
|
||||
separator: '\n',
|
||||
// Replace all 'use strict' statements in the code with a single one at the top
|
||||
banner: [
|
||||
'/*',
|
||||
' * #define CSS_LAYOUT_IMPLEMENTATION',
|
||||
' * before you include this file in *one* C or C++ file to create the implementation.',
|
||||
' */\n'
|
||||
].join('\n'),
|
||||
process: function(src, filepath) {
|
||||
if (path.extname(filepath) === '.c') {
|
||||
return [
|
||||
'#ifdef CSS_LAYOUT_IMPLEMENTATION',
|
||||
src,
|
||||
'#endif // CSS_LAYOUT_IMPLEMENTATION'
|
||||
].join('\n');
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
}
|
||||
},
|
||||
dist: {
|
||||
src: ['<%= config.srcFolder %>/Layout.h', '<%= config.srcFolder %>/Layout.c'],
|
||||
dest: '<%= config.distFolder %>/css-layout.h'
|
||||
}
|
||||
},
|
||||
|
||||
shell: {
|
||||
cCompile: {
|
||||
command: config.cTestCompile
|
||||
},
|
||||
cTestExecute: {
|
||||
command: config.cTestExecute
|
||||
},
|
||||
javaCompile: {
|
||||
command: 'javac -cp <%= config.javaLibFolder %>/junit4.jar<%= config.delimiter %><%= config.javaLibFolder %>/jsr305.jar<%= config.delimiter %><%= config.javaLibFolder %>/infer-annotations-1.4.jar' + ' -sourcepath ./src/java/src<%= config.delimiter %>./src/java/tests' + ' <%= config.javaSource %>'
|
||||
},
|
||||
javaTestExecute: {
|
||||
command: 'java -cp ./src/java/src<%= config.delimiter %>./src/java/tests<%= config.delimiter %><%= config.javaLibFolder %>/junit4.jar<%= config.delimiter %><%= config.javaLibFolder %>/infer-annotations-1.4.jar <%= config.javaTestFiles %>'
|
||||
},
|
||||
javaPackage: {
|
||||
command: 'jar cf <%= config.distFolder %>/<%= config.libName %>.jar <%= config.javaSource %>'
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
files: ['src/Layout.js'],
|
||||
tasks: ['ci']
|
||||
}
|
||||
});
|
||||
|
||||
// Compiles and runs the Java tests
|
||||
grunt.registerTask('test-java', ['shell:javaCompile', 'shell:javaTestExecute', 'clean:javaTest']);
|
||||
|
||||
// Compiles and runs the C tests
|
||||
grunt.registerTask('test-c', ['shell:cCompile', 'shell:cTestExecute', 'clean:cTest']);
|
||||
|
||||
// Transpiles the JavaScript to C and Java, running tests
|
||||
grunt.registerTask('transpile', ['execute:transpile', 'test-c', 'test-java']);
|
||||
|
||||
// Lints and tests the JavaScritp using Chrome
|
||||
grunt.registerTask('test-javascript', ['eslint', 'karma']);
|
||||
|
||||
// Packages the JavaScript as a single UMD module and minifies
|
||||
grunt.registerTask('package-javascript', ['includereplace', 'uglify']);
|
||||
|
||||
// Packages the Java as a JAR
|
||||
grunt.registerTask('package-java', ['shell:javaPackage']);
|
||||
|
||||
// Packages the C code as a single header
|
||||
grunt.registerTask('package-c', ['concat']);
|
||||
|
||||
// package all languages
|
||||
grunt.registerTask('package-all', ['package-javascript', 'package-java', 'package-c']);
|
||||
|
||||
// Default build, performs the full works!
|
||||
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'mkdir:dist', 'package-all']);
|
||||
|
||||
// The JavaScript unit tests require Chrome (they need a faithful flexbox implementation
|
||||
// to test against), so under CI this step is skipped.
|
||||
grunt.registerTask('ci', ['eslint', 'transpile', 'clean:dist', 'mkdir:dist', 'package-all']);
|
||||
|
||||
grunt.registerTask('default', ['build']);
|
||||
};
|
4
LICENSE
@@ -1,8 +1,8 @@
|
||||
BSD License
|
||||
|
||||
For css-layout software
|
||||
For yoga software
|
||||
|
||||
Copyright (c) 2014, Facebook, Inc. All rights reserved.
|
||||
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
9
LICENSE-examples
Normal file
@@ -0,0 +1,9 @@
|
||||
The examples provided by Facebook are for non-commercial testing and evaluation
|
||||
purposes only. Facebook reserves all rights not expressly granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2
PATENTS
@@ -1,6 +1,6 @@
|
||||
Additional Grant of Patent Rights Version 2
|
||||
|
||||
"Software" means the CSS Layout software distributed by Facebook, Inc.
|
||||
"Software" means the yoga software distributed by Facebook, Inc.
|
||||
|
||||
Facebook, Inc. (“Facebook”) hereby grants to each recipient of the Software
|
||||
(“you”) a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
|
||||
|
155
README.md
@@ -1,147 +1,30 @@
|
||||
css-layout [](https://travis-ci.org/facebook/css-layout)
|
||||
==========
|
||||
# Yoga [](https://travis-ci.org/facebook/yoga)
|
||||
|
||||
This project implements a subset of CSS including flexbox and the box model using pure JavaScript, then transpiled to C and Java. The goal is to have a small standalone library to layout elements. It doesn't rely on the DOM at all.
|
||||
## Building
|
||||
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
|
||||
|
||||
The Java, C and JavaScript version of the code is available via [npm](https://www.npmjs.com/package/css-layout) or directly from the `dist` folder of this repo. The JavaScript version is also available via [cdnjs](https://cdnjs.com/libraries/css-layout).
|
||||
## Testing
|
||||
For testing we rely on [gtest](https://github.com/google/googletest) as a submodule. After cloning Yoga run `git submodule init` followed by `git submodule update`.
|
||||
|
||||
In order to make sure that the code is correct, it is developed in JavaScript using TDD where each commit adds a unit test and the associated code to make it work. All the unit tests are tested against Chrome's implementation of CSS.
|
||||
For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the `tests` directory. Run the tests by executing `buck test //:yoga`.
|
||||
|
||||
The JavaScript version has been implemented in a way that can be easily transpiled to C and Java via regexes. The layout function doesn't do any allocation nor uses any of the dynamic aspects of JavaScript. The tests are also transpiled to make sure that the implementations are correct everywhere.
|
||||
Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run `gentest/gentest.rb` to generated a test for you. You can write html which you want to verify in Yoga, in `gentest/fixtures` folder, such as the following.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
A single function `computeLayout` is exposed that
|
||||
- takes a tree of nodes: `{ style: { ... }, children: [ nodes ] }`
|
||||
- computes the layout and writes it back to the node tree.
|
||||
|
||||
For example,
|
||||
|
||||
```javascript
|
||||
// create an initial tree of nodes
|
||||
var nodeTree = {
|
||||
"style": {
|
||||
"padding": 50
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"style": {
|
||||
"padding": 10,
|
||||
"alignSelf": "stretch"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// compute the layout
|
||||
computeLayout(nodeTree);
|
||||
|
||||
// the layout information is written back to the node tree, with
|
||||
// each node now having a layout property:
|
||||
|
||||
// JSON.stringify(nodeTree, null, 2);
|
||||
{
|
||||
"style": {
|
||||
"padding": 50
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"style": {
|
||||
"padding": 10,
|
||||
"alignSelf": "stretch"
|
||||
},
|
||||
"layout": {
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"top": 50,
|
||||
"left": 50,
|
||||
"right": 50,
|
||||
"bottom": 50,
|
||||
"direction": "ltr"
|
||||
},
|
||||
"children": [],
|
||||
"lineIndex": 0
|
||||
}
|
||||
],
|
||||
"layout": {
|
||||
"width": 120,
|
||||
"height": 120,
|
||||
"top": 0,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"bottom": 0,
|
||||
"direction": "ltr"
|
||||
}
|
||||
}
|
||||
```html
|
||||
<div id="my_test" style="width: 100px; height: 100px; align-items: center;">
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
```
|
||||
|
||||
Supported Attributes
|
||||
--------------------
|
||||
Run `gentest/gentest.rb` to generate test code and re-run `buck test //:yoga` to validate the behavior. One test case will be generated for every root `div` in the input html.
|
||||
|
||||
Name | Value
|
||||
----:|------
|
||||
width, height | positive number
|
||||
minWidth, minHeight | positive number
|
||||
maxWidth, maxHeight | positive number
|
||||
left, right, top, bottom | number
|
||||
margin, marginLeft, marginRight, marginTop, marginBottom | number
|
||||
padding, paddingLeft, paddingRight, paddingTop, paddingBottom | positive number
|
||||
borderWidth, borderLeftWidth, borderRightWidth, borderTopWidth, borderBottomWidth | positive number
|
||||
flexDirection | 'column', 'row'
|
||||
justifyContent | 'flex-start', 'center', 'flex-end', 'space-between', 'space-around'
|
||||
alignItems, alignSelf | 'flex-start', 'center', 'flex-end', 'stretch'
|
||||
flex | positive number
|
||||
flexWrap | 'wrap', 'nowrap'
|
||||
position | 'relative', 'absolute'
|
||||
You may need to install the latest watir-webdriver gem (`gem install watir-webdriver`) and [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) to run `gentest/gentest.rb` Ruby script.
|
||||
|
||||
- `inherit` value is not implemented because it's a way to disambiguate between multiple colliding rules. This should be done in a pre-processing step, not in the actual layout algorithm.
|
||||
### .NET
|
||||
.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, `csharp/tests/Facebook.Yoga/test_macos.sh`.
|
||||
|
||||
## Code style
|
||||
For the main C implementation of Yoga clang-format is used to ensure a consistent code style. Please run `bash format.sh` before submitting a pull request. For other languages just try to follow the current code style.
|
||||
|
||||
|
||||
Default values
|
||||
--------------
|
||||
Since we are only using flexbox, we can use defaults that are much more sensible. This is the configuration to use in order to get the same behavior using the DOM and CSS. You can try those default settings with the [following JSFiddle](http://jsfiddle.net/vjeux/y11txxv9/).
|
||||
|
||||
```css
|
||||
div, span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
flex-shrink: 0;
|
||||
align-content: flex-start;
|
||||
|
||||
border: 0 solid black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
```
|
||||
|
||||
- `box-sizing: border-box` is the most convenient way to express the relation between `width` and `borderWidth`.
|
||||
- Everything is `display: flex` by default. All the behaviors of `block` and `inline-block` can be expressed in term of `flex` but not the opposite.
|
||||
- All the flex elements are oriented from top to bottom, left to right and do not shrink. This is how things are laid out using the default CSS settings and what you'd expect.
|
||||
- Everything is `position: relative`. This makes `position: absolute` target the direct parent and not some parent which is either `relative` or `absolute`. If you want to position an element relative to something else, you should move it in the DOM instead of relying of CSS. It also makes `top, left, right, bottom` do something when not specifying `position: absolute`.
|
||||
|
||||
Native Usage Notes
|
||||
------------------
|
||||
|
||||
The C equivalent of `computeLayout` is [`layoutNode`](dist/css-layout.h#L1378).
|
||||
|
||||
In order for layout to properly layout reflowable text, the `measure` function must be set on the `css_node` structure. The property can be found in [`css-layout.h`](dist/css-layout.h#L146). This function must take a void pointer to a `context` that will affect the size of the node and the `width` as computed by the layout engine, and must return a `css_dim_t` structure defining the actual needed size of the node. For the most part, the `context` field can be the text inside the node. No C implementation of this function is provided in provided - it depends on your use of css-layout. However an implementation of the function in JavaScript can be used for reference in the [test utilities](src/Layout-test-utils.js#L383).
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
The core logic resides with `Layout.js`, which is transpiled into equivalent C and Java implementations.
|
||||
|
||||
The JavaScript build process is managed via Grunt. The build performs linting, runs the tests against Chrome, transpiles and packages the code (JavaScript and Java) into the `dist` folder. For JavaScript, the build output uses the Universal Module Format (UMD) so that it can be used via AMD / RequireJS, CommonJS or included directly into an HTML page.
|
||||
|
||||
While developing you can just run the lint / Chrome-based tests a follows:
|
||||
|
||||
```
|
||||
grunt test-javascript
|
||||
```
|
||||
## Benchmarks
|
||||
Benchmarks are located in `benchmarks/YGBenchmark.c` and can be run with `buck run //benchmarks:benchmarks`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.
|
||||
|
35
YOGA_DEFS
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
YOGA_ROOT = '//...'
|
||||
INFER_ANNOTATIONS_TARGET = '//lib/infer-annotations:infer-annotations'
|
||||
JSR_305_TARGET = '//lib/jsr-305:jsr-305'
|
||||
JUNIT_TARGET = '//lib/junit:junit'
|
||||
PROGRUARD_ANNOTATIONS_TARGET = '//java/com/facebook/proguard/annotations:annotations'
|
||||
SOLOADER_TARGET = '//lib/soloader:soloader'
|
||||
GTEST_TARGET = '//lib/gtest:gtest'
|
||||
JNI_TARGET = '//lib/jni:jni'
|
||||
FBJNI_TARGET = '//lib/fb:fbjni'
|
||||
|
||||
THIS_IS_FBOBJC = False
|
||||
|
||||
CXX_LIBRARY_WHITELIST = [
|
||||
'//:yoga',
|
||||
'//lib/fb:fbjni',
|
||||
'//java:jni',
|
||||
]
|
||||
|
||||
BASE_COMPILER_FLAGS = [
|
||||
'-fno-omit-frame-pointer',
|
||||
'-fexceptions',
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-O3',
|
||||
]
|
||||
|
||||
def yoga_dep(dep):
|
||||
return '//' + dep
|
||||
|
||||
class allow_unsafe_import:
|
||||
def __enter__(self):
|
||||
pass
|
||||
def __exit__(self, type, value, traceback):
|
||||
pass
|
58
YogaKit/BUCK
Normal file
@@ -0,0 +1,58 @@
|
||||
# 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_defs('//YOGA_DEFS')
|
||||
|
||||
COMPILER_FLAGS = [
|
||||
'-fobjc-arc',
|
||||
'-Wconditional-uninitialized',
|
||||
'-Wdangling-else',
|
||||
'-Wdeprecated-declarations',
|
||||
'-Wimplicit-retain-self',
|
||||
'-Wincomplete-implementation',
|
||||
'-Wobjc-method-access',
|
||||
'-Wobjc-missing-super-calls',
|
||||
'-Wmismatched-return-types',
|
||||
'-Wreturn-type',
|
||||
'-Wno-global-constructors',
|
||||
'-Wno-shadow',
|
||||
'-Wunused-const-variable',
|
||||
'-Wunused-function',
|
||||
'-Wunused-property-ivar',
|
||||
'-Wunused-result',
|
||||
'-Wunused-value',
|
||||
]
|
||||
|
||||
apple_library(
|
||||
name = 'YogaKit',
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
srcs = glob(['*.m']),
|
||||
exported_headers = glob(['*.h']),
|
||||
frameworks = [
|
||||
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
|
||||
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
|
||||
],
|
||||
deps = [
|
||||
yoga_dep(':yoga'),
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
apple_test(
|
||||
name = 'YogaKitTests',
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
info_plist = 'Tests/Info.plist',
|
||||
srcs = glob(['Tests/**/*.m']),
|
||||
frameworks = [
|
||||
'$SDKROOT/System/Library/Frameworks/CoreGraphics.framework',
|
||||
'$PLATFORM_DIR/Developer/Library/Frameworks/XCTest.framework',
|
||||
],
|
||||
deps = [
|
||||
':YogaKit',
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
22
YogaKit/Tests/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.facebook.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
387
YogaKit/Tests/YogaKitTests.m
Normal file
@@ -0,0 +1,387 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <YogaKit/UIView+Yoga.h>
|
||||
|
||||
@interface YogaKitTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation YogaKitTests
|
||||
|
||||
#ifndef TRAVIS_CI
|
||||
|
||||
- (void)testNodesAreDeallocedWithSingleView
|
||||
{
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
view.yoga.flexBasis = 1;
|
||||
XCTAssertEqual(1, YGNodeGetInstanceCount());
|
||||
view = nil;
|
||||
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
}
|
||||
|
||||
- (void)testNodesAreDeallocedCascade
|
||||
{
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
view.yoga.flexBasis = 1;
|
||||
|
||||
for (int i=0; i<10; i++) {
|
||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview.yoga.flexBasis = 1;
|
||||
[view addSubview:subview];
|
||||
}
|
||||
XCTAssertEqual(11, YGNodeGetInstanceCount());
|
||||
view = nil;
|
||||
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)testUsesYoga
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
XCTAssertFalse(view.yoga.isEnabled);
|
||||
|
||||
view.yoga.isEnabled = YES;
|
||||
XCTAssertTrue(view.yoga.isEnabled);
|
||||
|
||||
view.yoga.isEnabled = NO;
|
||||
XCTAssertFalse(view.yoga.isEnabled);
|
||||
}
|
||||
|
||||
- (void)testSizeThatFitsAsserts
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
dispatch_sync(dispatch_queue_create("com.facebook.Yoga.testing", DISPATCH_QUEUE_SERIAL), ^(void){
|
||||
XCTAssertThrows(view.yoga.intrinsicSize);
|
||||
});
|
||||
}
|
||||
|
||||
- (void)testSizeThatFitsSmoke
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
container.yoga.alignItems = YGAlignFlexStart;
|
||||
|
||||
UILabel *longTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
longTextLabel.text = @"This is a very very very very very very very very long piece of text.";
|
||||
longTextLabel.lineBreakMode = NSLineBreakByTruncatingTail;
|
||||
longTextLabel.numberOfLines = 1;
|
||||
longTextLabel.yoga.isEnabled = YES;
|
||||
longTextLabel.yoga.flexShrink = 1;
|
||||
[container addSubview:longTextLabel];
|
||||
|
||||
UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
textBadgeView.yoga.isEnabled = YES;
|
||||
textBadgeView.yoga.marginLeft = 3.0;
|
||||
textBadgeView.yoga.width = 10;
|
||||
textBadgeView.yoga.height = 10;
|
||||
[container addSubview:textBadgeView];
|
||||
|
||||
const CGSize containerSize = container.yoga.intrinsicSize;
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(514,21), containerSize), @"Size is actually %@", NSStringFromCGSize(containerSize));
|
||||
}
|
||||
|
||||
- (void)testThatMarkingLeafsAsDirtyWillTriggerASizeRecalculation
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 50)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
container.yoga.alignItems = YGAlignFlexStart;
|
||||
|
||||
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
label.text = @"This is a short text.";
|
||||
label.numberOfLines = 1;
|
||||
label.yoga.isEnabled = YES;
|
||||
[container addSubview:label];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(146,21), label.bounds.size), @"Size is actually %@", NSStringFromCGSize(label.bounds.size));
|
||||
|
||||
label.text = @"This is a slightly longer text.";
|
||||
[label.yoga markDirty];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(213,21), label.bounds.size), @"Size is actually %@", NSStringFromCGSize(label.bounds.size));
|
||||
}
|
||||
|
||||
- (void)testFrameAndOriginPlacement
|
||||
{
|
||||
const CGSize containerSize = CGSizeMake(320, 50);
|
||||
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview.yoga.isEnabled = YES;
|
||||
subview.yoga.flexGrow = 1;
|
||||
|
||||
[container addSubview:subview];
|
||||
}
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:1].frame));
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:1].frame, [container.subviews objectAtIndex:2].frame));
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:2].frame));
|
||||
|
||||
CGFloat totalWidth = 0;
|
||||
for (UIView *view in container.subviews) {
|
||||
totalWidth += view.bounds.size.width;
|
||||
}
|
||||
|
||||
XCTAssertEqual(containerSize.width, totalWidth, @"The container's width is %.6f, the subviews take up %.6f", containerSize.width, totalWidth);
|
||||
}
|
||||
|
||||
- (void)testThatLayoutIsCorrectWhenWeSwapViewOrder
|
||||
{
|
||||
const CGSize containerSize = CGSizeMake(300, 50);
|
||||
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.yoga.flexGrow = 1;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.flexGrow = 1;
|
||||
[container addSubview:subview2];
|
||||
|
||||
UIView *subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview3.yoga.isEnabled = YES;
|
||||
subview3.yoga.flexGrow = 1;
|
||||
[container addSubview:subview3];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGRectEqualToRect(subview1.frame, CGRectMake(0, 0, 100, 50)));
|
||||
XCTAssertTrue(CGRectEqualToRect(subview2.frame, CGRectMake(100, 0, 100, 50)), @"It's actually %@", NSStringFromCGRect(subview2.frame));
|
||||
XCTAssertTrue(CGRectEqualToRect(subview3.frame, CGRectMake(200, 0, 100, 50)));
|
||||
|
||||
[container exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
|
||||
subview2.yoga.isIncludedInLayout = NO;
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGRectEqualToRect(subview3.frame, CGRectMake(0, 0, 150, 50)));
|
||||
XCTAssertTrue(CGRectEqualToRect(subview1.frame, CGRectMake(150, 0, 150, 50)));
|
||||
|
||||
// this frame shouldn't have been modified since last time.
|
||||
XCTAssertTrue(CGRectEqualToRect(subview2.frame, CGRectMake(100, 0, 100, 50)));
|
||||
}
|
||||
|
||||
- (void)testThatWeRespectIncludeInLayoutFlag
|
||||
{
|
||||
const CGSize containerSize = CGSizeMake(300, 50);
|
||||
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.yoga.flexGrow = 1;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.flexGrow = 1;
|
||||
[container addSubview:subview2];
|
||||
|
||||
UIView *subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview3.yoga.isEnabled = YES;
|
||||
subview3.yoga.flexGrow = 1;
|
||||
[container addSubview:subview3];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
|
||||
for (UIView *view in container.subviews) {
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
}
|
||||
|
||||
subview3.yoga.isIncludedInLayout = NO;
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
||||
|
||||
// We don't set the frame to zero, so, it should be set to what it was previously at.
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview3.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview3.bounds.size));
|
||||
}
|
||||
|
||||
- (void)testThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.yoga.isIncludedInLayout = NO;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.isIncludedInLayout = NO;
|
||||
[container addSubview:subview2];
|
||||
|
||||
UIView *subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview3.yoga.isEnabled = YES;
|
||||
subview3.yoga.isIncludedInLayout = YES;
|
||||
[container addSubview:subview3];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertEqual(1, container.yoga.numberOfChildren);
|
||||
|
||||
subview2.yoga.isIncludedInLayout = YES;
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertEqual(2, container.yoga.numberOfChildren);
|
||||
}
|
||||
|
||||
- (void)testThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.yoga.flexGrow = 1;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.flexGrow = 1;
|
||||
[container addSubview:subview2];
|
||||
|
||||
UIView *subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview3.yoga.isEnabled = YES;
|
||||
subview3.yoga.flexGrow = 1;
|
||||
subview3.yoga.isIncludedInLayout = NO;
|
||||
[container addSubview:subview3];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeZero, subview3.bounds.size), @"Actual size %@", NSStringFromCGSize(subview3.bounds.size));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testyg_isLeafFlag
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
XCTAssertTrue(view.yoga.isLeaf);
|
||||
|
||||
for (int i=0; i<10; i++) {
|
||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
[view addSubview:subview];
|
||||
}
|
||||
XCTAssertTrue(view.yoga.isLeaf);
|
||||
|
||||
view.yoga.isEnabled = YES;
|
||||
view.yoga.width = 50.0;
|
||||
XCTAssertTrue(view.yoga.isLeaf);
|
||||
|
||||
UIView *const subview = view.subviews[0];
|
||||
subview.yoga.isEnabled = YES;
|
||||
subview.yoga.width = 50.0;
|
||||
XCTAssertFalse(view.yoga.isLeaf);
|
||||
}
|
||||
|
||||
- (void)testThatWeCorrectlyAttachNestedViews
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)];
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionColumn;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.yoga.width = 100;
|
||||
subview1.yoga.flexGrow = 1;
|
||||
subview1.yoga.flexDirection = YGFlexDirectionColumn;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.width = 150;
|
||||
subview2.yoga.flexGrow = 1;
|
||||
subview2.yoga.flexDirection = YGFlexDirectionColumn;
|
||||
[container addSubview:subview2];
|
||||
|
||||
for (UIView *view in @[subview1, subview2]) {
|
||||
UIView *someView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
someView.yoga.isEnabled = YES;
|
||||
someView.yoga.flexGrow = 1;
|
||||
[view addSubview:someView];
|
||||
}
|
||||
[container.yoga applyLayout];
|
||||
|
||||
// Add the same amount of new views, reapply layout.
|
||||
for (UIView *view in @[subview1, subview2]) {
|
||||
UIView *someView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
someView.yoga.isEnabled = YES;
|
||||
someView.yoga.flexGrow = 1;
|
||||
[view addSubview:someView];
|
||||
}
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 25), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
||||
for (UIView *subview in subview1.subviews) {
|
||||
const CGSize subviewSize = subview.bounds.size;
|
||||
XCTAssertFalse(CGSizeEqualToSize(CGSizeZero, subviewSize));
|
||||
XCTAssertFalse(isnan(subviewSize.height));
|
||||
XCTAssertFalse(isnan(subviewSize.width));
|
||||
}
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 25), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
||||
for (UIView *subview in subview2.subviews) {
|
||||
const CGSize subviewSize = subview.bounds.size;
|
||||
XCTAssertFalse(CGSizeEqualToSize(CGSizeZero, subview.bounds.size));
|
||||
XCTAssertFalse(isnan(subviewSize.height));
|
||||
XCTAssertFalse(isnan(subviewSize.width));
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testThatANonLeafNodeCanBecomeALeafNode
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)];
|
||||
container.yoga.isEnabled = YES;
|
||||
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
[subview1 addSubview:subview2];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
[subview2 removeFromSuperview];
|
||||
[container.yoga applyLayout];
|
||||
}
|
||||
|
||||
@end
|
17
YogaKit/UIView+Yoga.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "YGLayout.h"
|
||||
|
||||
@interface UIView (Yoga)
|
||||
|
||||
@property (nonatomic, readonly, strong) YGLayout *yoga;
|
||||
|
||||
@end
|
30
YogaKit/UIView+Yoga.m
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.
|
||||
*/
|
||||
|
||||
#import "UIView+Yoga.h"
|
||||
#import "YGLayout+Private.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
static const void *kYGYogaAssociatedKey = &kYGYogaAssociatedKey;
|
||||
|
||||
@implementation UIView (YogaKit)
|
||||
|
||||
- (YGLayout *)yoga
|
||||
{
|
||||
YGLayout *yoga = objc_getAssociatedObject(self, kYGYogaAssociatedKey);
|
||||
if (!yoga) {
|
||||
yoga = [[YGLayout alloc] initWithView:self];
|
||||
objc_setAssociatedObject(self, kYGYogaAssociatedKey, yoga, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
return yoga;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -1,17 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* 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.csslayout;
|
||||
|
||||
public enum CSSAlign {
|
||||
AUTO,
|
||||
FLEX_START,
|
||||
CENTER,
|
||||
FLEX_END,
|
||||
STRETCH,
|
||||
}
|
||||
#import "YGLayout.h"
|
||||
|
||||
@interface YGLayout (Private)
|
||||
|
||||
- (instancetype)initWithView:(UIView *)view;
|
||||
|
||||
@end
|
114
YogaKit/YGLayout.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <yoga/YGEnums.h>
|
||||
|
||||
@interface YGLayout : NSObject
|
||||
|
||||
/**
|
||||
The property that decides if we should include this view when calculating layout. Defaults to YES.
|
||||
*/
|
||||
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
|
||||
|
||||
/**
|
||||
The property that decides during layout/sizing whether or not styling properties should be applied. Defaults to NO.
|
||||
*/
|
||||
@property (nonatomic, readwrite, assign, setter=setEnabled:) BOOL isEnabled;
|
||||
|
||||
@property (nonatomic, readwrite, assign) YGDirection direction;
|
||||
@property (nonatomic, readwrite, assign) YGFlexDirection flexDirection;
|
||||
@property (nonatomic, readwrite, assign) YGJustify justifyContent;
|
||||
@property (nonatomic, readwrite, assign) YGAlign alignContent;
|
||||
@property (nonatomic, readwrite, assign) YGAlign alignItems;
|
||||
@property (nonatomic, readwrite, assign) YGAlign alignSelf;
|
||||
@property (nonatomic, readwrite, assign) YGPositionType position;
|
||||
@property (nonatomic, readwrite, assign) YGWrap flexWrap;
|
||||
@property (nonatomic, readwrite, assign) YGOverflow overflow;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat flexGrow;
|
||||
@property (nonatomic, readwrite, assign) CGFloat flexShrink;
|
||||
@property (nonatomic, readwrite, assign) CGFloat flexBasis;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat left;
|
||||
@property (nonatomic, readwrite, assign) CGFloat top;
|
||||
@property (nonatomic, readwrite, assign) CGFloat right;
|
||||
@property (nonatomic, readwrite, assign) CGFloat bottom;
|
||||
@property (nonatomic, readwrite, assign) CGFloat start;
|
||||
@property (nonatomic, readwrite, assign) CGFloat end;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginLeft;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginTop;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginRight;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginBottom;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginStart;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginEnd;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginHorizontal;
|
||||
@property (nonatomic, readwrite, assign) CGFloat marginVertical;
|
||||
@property (nonatomic, readwrite, assign) CGFloat margin;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingLeft;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingTop;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingRight;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingBottom;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingStart;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingEnd;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingHorizontal;
|
||||
@property (nonatomic, readwrite, assign) CGFloat paddingVertical;
|
||||
@property (nonatomic, readwrite, assign) CGFloat padding;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderLeftWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderTopWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderRightWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderBottomWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderStartWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderEndWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat borderWidth;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat width;
|
||||
@property (nonatomic, readwrite, assign) CGFloat height;
|
||||
@property (nonatomic, readwrite, assign) CGFloat minWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat minHeight;
|
||||
@property (nonatomic, readwrite, assign) CGFloat maxWidth;
|
||||
@property (nonatomic, readwrite, assign) CGFloat maxHeight;
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
@property (nonatomic, readwrite, assign) CGFloat aspectRatio;
|
||||
|
||||
/**
|
||||
Get the resolved direction of this node. This won't be YGDirectionInherit
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) YGDirection resolvedDirection;
|
||||
|
||||
/**
|
||||
Perform a layout calculation and update the frames of the views in the hierarchy with the results
|
||||
*/
|
||||
- (void)applyLayout NS_SWIFT_NAME(applyLayout());
|
||||
|
||||
/**
|
||||
Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) CGSize intrinsicSize;
|
||||
|
||||
/**
|
||||
Returns the number of children that are using Flexbox.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) NSUInteger numberOfChildren;
|
||||
|
||||
/**
|
||||
Return a BOOL indiciating whether or not we this node contains any subviews that are included in Yoga's layout.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) BOOL isLeaf;
|
||||
|
||||
/**
|
||||
Mark that a view's layout needs to be recalculated. Only works for leaf views.
|
||||
*/
|
||||
- (void)markDirty;
|
||||
|
||||
@end
|
380
YogaKit/YGLayout.m
Normal file
@@ -0,0 +1,380 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "YGLayout+Private.h"
|
||||
#import "UIView+Yoga.h"
|
||||
#import <yoga/Yoga.h>
|
||||
|
||||
#define YG_STYLE_PROPERTY_IMPL(type, lowercased_name, capitalized_name) \
|
||||
- (type)lowercased_name \
|
||||
{ \
|
||||
return YGNodeStyleGet##capitalized_name(self.node); \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(type)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_EDGE_PROPERTY_IMPL(lowercased_name, capitalized_name, property, edge) \
|
||||
- (CGFloat)lowercased_name { \
|
||||
return YGNodeStyleGet##property(self.node, edge); \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name { \
|
||||
YGNodeStyleSet##property(self.node, edge, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_VALUE_PROPERTY_IMPL(lowercased_name, capitalized_name) \
|
||||
- (CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##capitalized_name(self.node); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, edge, edge_suffix) \
|
||||
- (CGFloat)lowercased_name##edge_suffix \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##capitalized_name(self.node, edge); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name##edge_suffix:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, edge, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeLeft, Left) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeTop, Top) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeRight, Right) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeBottom, Bottom) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeStart, Start) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeEnd, End) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeHorizontal, Horizontal) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeVertical, Vertical) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeAll, )
|
||||
|
||||
@interface YGLayout ()
|
||||
|
||||
@property (nonatomic, weak, readonly) UIView *view;
|
||||
@property (nonatomic, assign, readonly) YGNodeRef node;
|
||||
|
||||
@end
|
||||
|
||||
@implementation YGLayout
|
||||
|
||||
@synthesize isEnabled=_isEnabled;
|
||||
@synthesize isIncludedInLayout=_isIncludedInLayout;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true);
|
||||
}
|
||||
|
||||
- (instancetype)initWithView:(UIView*)view
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_view = view;
|
||||
_node = YGNodeNew();
|
||||
YGNodeSetContext(_node, (__bridge void *) view);
|
||||
_isEnabled = NO;
|
||||
_isIncludedInLayout = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
YGNodeFree(self.node);
|
||||
}
|
||||
|
||||
- (void)markDirty
|
||||
{
|
||||
if (self.isLeaf) {
|
||||
YGNodeMarkDirty(self.node);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfChildren
|
||||
{
|
||||
return YGNodeGetChildCount(self.node);
|
||||
}
|
||||
|
||||
- (BOOL)isLeaf
|
||||
{
|
||||
NSAssert([NSThread isMainThread], @"This method must be called on the main thread.");
|
||||
if (self.isEnabled) {
|
||||
for (UIView *subview in self.view.subviews) {
|
||||
YGLayout *const yoga = subview.yoga;
|
||||
if (yoga.isEnabled && yoga.isIncludedInLayout) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Style
|
||||
|
||||
- (YGPositionType)position
|
||||
{
|
||||
return YGNodeStyleGetPositionType(self.node);
|
||||
}
|
||||
|
||||
- (void)setPosition:(YGPositionType)position
|
||||
{
|
||||
YGNodeStyleSetPositionType(self.node, position);
|
||||
}
|
||||
|
||||
YG_STYLE_PROPERTY_IMPL(YGDirection, direction, Direction)
|
||||
YG_STYLE_PROPERTY_IMPL(YGFlexDirection, flexDirection, FlexDirection)
|
||||
YG_STYLE_PROPERTY_IMPL(YGJustify, justifyContent, JustifyContent)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignContent, AlignContent)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignItems, AlignItems)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignSelf, AlignSelf)
|
||||
YG_STYLE_PROPERTY_IMPL(YGWrap, flexWrap, FlexWrap)
|
||||
YG_STYLE_PROPERTY_IMPL(YGOverflow, overflow, Overflow)
|
||||
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, flexGrow, FlexGrow)
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, flexShrink, FlexShrink)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(flexBasis, FlexBasis)
|
||||
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeLeft, Left)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeTop, Top)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeRight, Right)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeBottom, Bottom)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeStart, Start)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeEnd, End)
|
||||
YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(margin, Margin)
|
||||
YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(padding, Padding)
|
||||
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderLeftWidth, BorderLeftWidth, Border, YGEdgeLeft)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderTopWidth, BorderTopWidth, Border, YGEdgeTop)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderRightWidth, BorderRightWidth, Border, YGEdgeRight)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderBottomWidth, BorderBottomWidth, Border, YGEdgeBottom)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderStartWidth, BorderStartWidth, Border, YGEdgeStart)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderEndWidth, BorderEndWidth, Border, YGEdgeEnd)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderWidth, BorderWidth, Border, YGEdgeAll)
|
||||
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(width, Width)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(height, Height)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(minWidth, MinWidth)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(minHeight, MinHeight)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(maxWidth, MaxWidth)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(maxHeight, MaxHeight)
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, aspectRatio, AspectRatio)
|
||||
|
||||
#pragma mark - Layout and Sizing
|
||||
|
||||
- (YGDirection)resolvedDirection
|
||||
{
|
||||
return YGNodeLayoutGetDirection(self.node);
|
||||
}
|
||||
|
||||
- (void)applyLayout
|
||||
{
|
||||
[self calculateLayoutWithSize:self.view.bounds.size];
|
||||
YGApplyLayoutToViewHierarchy(self.view);
|
||||
}
|
||||
|
||||
- (CGSize)intrinsicSize
|
||||
{
|
||||
const CGSize constrainedSize = {
|
||||
.width = YGUndefined,
|
||||
.height = YGUndefined,
|
||||
};
|
||||
return [self calculateLayoutWithSize:constrainedSize];
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (CGSize)calculateLayoutWithSize:(CGSize)size
|
||||
{
|
||||
NSAssert([NSThread isMainThread], @"Yoga calculation must be done on main.");
|
||||
NSAssert(self.isEnabled, @"Yoga is not enabled for this view.");
|
||||
|
||||
YGAttachNodesFromViewHierachy(self.view);
|
||||
|
||||
const YGNodeRef node = self.node;
|
||||
YGNodeCalculateLayout(
|
||||
node,
|
||||
size.width,
|
||||
size.height,
|
||||
YGNodeStyleGetDirection(node));
|
||||
|
||||
return (CGSize) {
|
||||
.width = YGNodeLayoutGetWidth(node),
|
||||
.height = YGNodeLayoutGetHeight(node),
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize YGMeasureView(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode)
|
||||
{
|
||||
const CGFloat constrainedWidth = (widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width;
|
||||
const CGFloat constrainedHeight = (heightMode == YGMeasureModeUndefined) ? CGFLOAT_MAX: height;
|
||||
|
||||
UIView *view = (__bridge UIView*) YGNodeGetContext(node);
|
||||
const CGSize sizeThatFits = [view sizeThatFits:(CGSize) {
|
||||
.width = constrainedWidth,
|
||||
.height = constrainedHeight,
|
||||
}];
|
||||
|
||||
return (YGSize) {
|
||||
.width = YGSanitizeMeasurement(constrainedWidth, sizeThatFits.width, widthMode),
|
||||
.height = YGSanitizeMeasurement(constrainedHeight, sizeThatFits.height, heightMode),
|
||||
};
|
||||
}
|
||||
|
||||
static CGFloat YGSanitizeMeasurement(
|
||||
CGFloat constrainedSize,
|
||||
CGFloat measuredSize,
|
||||
YGMeasureMode measureMode)
|
||||
{
|
||||
CGFloat result;
|
||||
if (measureMode == YGMeasureModeExactly) {
|
||||
result = constrainedSize;
|
||||
} else if (measureMode == YGMeasureModeAtMost) {
|
||||
result = MIN(constrainedSize, measuredSize);
|
||||
} else {
|
||||
result = measuredSize;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL YGNodeHasExactSameChildren(const YGNodeRef node, NSArray<UIView *> *subviews)
|
||||
{
|
||||
if (YGNodeGetChildCount(node) != subviews.count) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
for (int i=0; i<subviews.count; i++) {
|
||||
if (YGNodeGetChild(node, i) != subviews[i].yoga.node) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static void YGAttachNodesFromViewHierachy(UIView *const view)
|
||||
{
|
||||
YGLayout *const yoga = view.yoga;
|
||||
const YGNodeRef node = yoga.node;
|
||||
|
||||
// Only leaf nodes should have a measure function
|
||||
if (yoga.isLeaf) {
|
||||
YGRemoveAllChildren(node);
|
||||
YGNodeSetMeasureFunc(node, YGMeasureView);
|
||||
} else {
|
||||
YGNodeSetMeasureFunc(node, NULL);
|
||||
|
||||
NSMutableArray<UIView *> *subviewsToInclude = [[NSMutableArray alloc] initWithCapacity:view.subviews.count];
|
||||
for (UIView *subview in view.subviews) {
|
||||
if (subview.yoga.isIncludedInLayout) {
|
||||
[subviewsToInclude addObject:subview];
|
||||
}
|
||||
}
|
||||
|
||||
if (!YGNodeHasExactSameChildren(node, subviewsToInclude)) {
|
||||
YGRemoveAllChildren(node);
|
||||
for (int i=0; i<subviewsToInclude.count; i++) {
|
||||
YGNodeInsertChild(node, subviewsToInclude[i].yoga.node, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (UIView *const subview in subviewsToInclude) {
|
||||
YGAttachNodesFromViewHierachy(subview);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void YGRemoveAllChildren(const YGNodeRef node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (YGNodeGetChildCount(node) > 0) {
|
||||
YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
static CGFloat YGRoundPixelValue(CGFloat value)
|
||||
{
|
||||
static CGFloat scale;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^(){
|
||||
scale = [UIScreen mainScreen].scale;
|
||||
});
|
||||
|
||||
return round(value * scale) / scale;
|
||||
}
|
||||
|
||||
static void YGApplyLayoutToViewHierarchy(UIView *view)
|
||||
{
|
||||
NSCAssert([NSThread isMainThread], @"Framesetting should only be done on the main thread.");
|
||||
|
||||
const YGLayout *yoga = view.yoga;
|
||||
|
||||
if (!yoga.isIncludedInLayout) {
|
||||
return;
|
||||
}
|
||||
|
||||
YGNodeRef node = yoga.node;
|
||||
const CGPoint topLeft = {
|
||||
YGNodeLayoutGetLeft(node),
|
||||
YGNodeLayoutGetTop(node),
|
||||
};
|
||||
|
||||
const CGPoint bottomRight = {
|
||||
topLeft.x + YGNodeLayoutGetWidth(node),
|
||||
topLeft.y + YGNodeLayoutGetHeight(node),
|
||||
};
|
||||
|
||||
view.frame = (CGRect) {
|
||||
.origin = {
|
||||
.x = YGRoundPixelValue(topLeft.x),
|
||||
.y = YGRoundPixelValue(topLeft.y),
|
||||
},
|
||||
.size = {
|
||||
.width = YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x),
|
||||
.height = YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y),
|
||||
},
|
||||
};
|
||||
|
||||
if (!yoga.isLeaf) {
|
||||
for (NSUInteger i=0; i<view.subviews.count; i++) {
|
||||
YGApplyLayoutToViewHierarchy(view.subviews[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
405
YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,405 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
13687D481DF8748400E7C260 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D471DF8748400E7C260 /* main.m */; };
|
||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4A1DF8748400E7C260 /* AppDelegate.m */; };
|
||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4D1DF8748400E7C260 /* ViewController.m */; };
|
||||
13687D531DF8748400E7C260 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13687D521DF8748400E7C260 /* Assets.xcassets */; };
|
||||
13687D781DF878C600E7C260 /* YGEnums.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D5E1DF8778F00E7C260 /* YGEnums.h */; };
|
||||
13687D791DF878C600E7C260 /* YGMacros.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D5F1DF8778F00E7C260 /* YGMacros.h */; };
|
||||
13687D7A1DF878C600E7C260 /* Yoga.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D631DF8778F00E7C260 /* Yoga.h */; };
|
||||
13687D7C1DF878DD00E7C260 /* UIView+Yoga.h in YogaKit */ = {isa = PBXBuildFile; fileRef = 13687D691DF8778F00E7C260 /* UIView+Yoga.h */; };
|
||||
13687D801DF87CEC00E7C260 /* UIView+Yoga.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */; };
|
||||
13687D811DF87CF200E7C260 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 13687D601DF8778F00E7C260 /* YGNodeList.c */; };
|
||||
13687D821DF87CF200E7C260 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = 13687D621DF8778F00E7C260 /* Yoga.c */; };
|
||||
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D841DF87D1E00E7C260 /* UIKit.framework */; };
|
||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; };
|
||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 638A94411E1EF5D000A726AD /* YGLayout.m */; };
|
||||
638A94451E1EF8A900A726AD /* YGValue.h in yoga */ = {isa = PBXBuildFile; fileRef = 638A94441E1EF89C00A726AD /* YGValue.h */; };
|
||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638A94471E1F06D100A726AD /* SwiftViewController.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
13687D771DF878A000E7C260 /* yoga */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/yoga;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
638A94451E1EF8A900A726AD /* YGValue.h in yoga */,
|
||||
13687D781DF878C600E7C260 /* YGEnums.h in yoga */,
|
||||
13687D791DF878C600E7C260 /* YGMacros.h in yoga */,
|
||||
13687D7A1DF878C600E7C260 /* Yoga.h in yoga */,
|
||||
);
|
||||
name = yoga;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13687D7B1DF878CE00E7C260 /* YogaKit */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/YogaKit;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
13687D7C1DF878DD00E7C260 /* UIView+Yoga.h in YogaKit */,
|
||||
);
|
||||
name = YogaKit;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
13687D431DF8748400E7C260 /* YogaKitSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
13687D471DF8748400E7C260 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
13687D491DF8748400E7C260 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
13687D4A1DF8748400E7C260 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
13687D4C1DF8748400E7C260 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||
13687D4D1DF8748400E7C260 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||
13687D521DF8748400E7C260 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
13687D5E1DF8778F00E7C260 /* YGEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = "<group>"; };
|
||||
13687D5F1DF8778F00E7C260 /* YGMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = "<group>"; };
|
||||
13687D601DF8778F00E7C260 /* YGNodeList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = YGNodeList.c; sourceTree = "<group>"; };
|
||||
13687D611DF8778F00E7C260 /* YGNodeList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNodeList.h; sourceTree = "<group>"; };
|
||||
13687D621DF8778F00E7C260 /* Yoga.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Yoga.c; sourceTree = "<group>"; };
|
||||
13687D631DF8778F00E7C260 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = "<group>"; };
|
||||
13687D691DF8778F00E7C260 /* UIView+Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = "<group>"; };
|
||||
13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Yoga.m"; sourceTree = "<group>"; };
|
||||
13687D841DF87D1E00E7C260 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
13687D861DF87D2400E7C260 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
638A94401E1EF5D000A726AD /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = "<group>"; };
|
||||
638A94411E1EF5D000A726AD /* YGLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YGLayout.m; sourceTree = "<group>"; };
|
||||
638A94421E1EF5D000A726AD /* YGLayout+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YGLayout+Private.h"; sourceTree = "<group>"; };
|
||||
638A94441E1EF89C00A726AD /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = "<group>"; };
|
||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YogaKitSample-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
638A94471E1F06D100A726AD /* SwiftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftViewController.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
13687D401DF8748300E7C260 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */,
|
||||
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
13687D3A1DF8748300E7C260 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D5D1DF8778F00E7C260 /* yoga */,
|
||||
13687D641DF8778F00E7C260 /* YogaKit */,
|
||||
13687D451DF8748400E7C260 /* YogaKitSample */,
|
||||
13687D441DF8748400E7C260 /* Products */,
|
||||
13687D831DF87D1E00E7C260 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D441DF8748400E7C260 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D431DF8748400E7C260 /* YogaKitSample.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D451DF8748400E7C260 /* YogaKitSample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D491DF8748400E7C260 /* AppDelegate.h */,
|
||||
13687D4A1DF8748400E7C260 /* AppDelegate.m */,
|
||||
13687D4C1DF8748400E7C260 /* ViewController.h */,
|
||||
13687D4D1DF8748400E7C260 /* ViewController.m */,
|
||||
638A94471E1F06D100A726AD /* SwiftViewController.swift */,
|
||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */,
|
||||
13687D521DF8748400E7C260 /* Assets.xcassets */,
|
||||
13687D571DF8748400E7C260 /* Info.plist */,
|
||||
13687D461DF8748400E7C260 /* Supporting Files */,
|
||||
);
|
||||
path = YogaKitSample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D461DF8748400E7C260 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D471DF8748400E7C260 /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D5D1DF8778F00E7C260 /* yoga */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
638A94441E1EF89C00A726AD /* YGValue.h */,
|
||||
13687D5E1DF8778F00E7C260 /* YGEnums.h */,
|
||||
13687D5F1DF8778F00E7C260 /* YGMacros.h */,
|
||||
13687D601DF8778F00E7C260 /* YGNodeList.c */,
|
||||
13687D611DF8778F00E7C260 /* YGNodeList.h */,
|
||||
13687D621DF8778F00E7C260 /* Yoga.c */,
|
||||
13687D631DF8778F00E7C260 /* Yoga.h */,
|
||||
);
|
||||
name = yoga;
|
||||
path = ../../yoga;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D641DF8778F00E7C260 /* YogaKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D691DF8778F00E7C260 /* UIView+Yoga.h */,
|
||||
13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */,
|
||||
638A94401E1EF5D000A726AD /* YGLayout.h */,
|
||||
638A94421E1EF5D000A726AD /* YGLayout+Private.h */,
|
||||
638A94411E1EF5D000A726AD /* YGLayout.m */,
|
||||
);
|
||||
name = YogaKit;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D831DF87D1E00E7C260 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D861DF87D2400E7C260 /* Foundation.framework */,
|
||||
13687D841DF87D1E00E7C260 /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
13687D421DF8748300E7C260 /* YogaKitSample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 13687D5A1DF8748400E7C260 /* Build configuration list for PBXNativeTarget "YogaKitSample" */;
|
||||
buildPhases = (
|
||||
13687D771DF878A000E7C260 /* yoga */,
|
||||
13687D7B1DF878CE00E7C260 /* YogaKit */,
|
||||
13687D3F1DF8748300E7C260 /* Sources */,
|
||||
13687D401DF8748300E7C260 /* Frameworks */,
|
||||
13687D411DF8748300E7C260 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = YogaKitSample;
|
||||
productName = YogaKitSample;
|
||||
productReference = 13687D431DF8748400E7C260 /* YogaKitSample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
13687D3B1DF8748300E7C260 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0820;
|
||||
ORGANIZATIONNAME = facebook;
|
||||
TargetAttributes = {
|
||||
13687D421DF8748300E7C260 = {
|
||||
CreatedOnToolsVersion = 8.1;
|
||||
LastSwiftMigration = 0820;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 13687D3E1DF8748300E7C260 /* Build configuration list for PBXProject "YogaKitSample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 13687D3A1DF8748300E7C260;
|
||||
productRefGroup = 13687D441DF8748400E7C260 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
13687D421DF8748300E7C260 /* YogaKitSample */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
13687D411DF8748300E7C260 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
13687D531DF8748400E7C260 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
13687D3F1DF8748300E7C260 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */,
|
||||
13687D801DF87CEC00E7C260 /* UIView+Yoga.m in Sources */,
|
||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */,
|
||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */,
|
||||
13687D821DF87CF200E7C260 /* Yoga.c in Sources */,
|
||||
13687D811DF87CF200E7C260 /* YGNodeList.c in Sources */,
|
||||
13687D481DF8748400E7C260 /* main.m in Sources */,
|
||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
13687D581DF8748400E7C260 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
13687D591DF8748400E7C260 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
13687D5B1DF8748400E7C260 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
INFOPLIST_FILE = YogaKitSample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
13687D5C1DF8748400E7C260 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
INFOPLIST_FILE = YogaKitSample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
13687D3E1DF8748300E7C260 /* Build configuration list for PBXProject "YogaKitSample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
13687D581DF8748400E7C260 /* Debug */,
|
||||
13687D591DF8748400E7C260 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
13687D5A1DF8748400E7C260 /* Build configuration list for PBXNativeTarget "YogaKitSample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
13687D5B1DF8748400E7C260 /* Debug */,
|
||||
13687D5C1DF8748400E7C260 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 13687D3B1DF8748300E7C260 /* Project object */;
|
||||
}
|
7
YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:YogaKitSample.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
16
YogaKit/YogaKitSample/YogaKitSample/AppDelegate.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@end
|
||||
|
27
YogaKit/YogaKitSample/YogaKitSample/AppDelegate.m
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "ViewController.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.window.rootViewController = [ViewController new];
|
||||
self.window.backgroundColor = [UIColor whiteColor];
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"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" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
36
YogaKit/YogaKitSample/YogaKitSample/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>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string></string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
|
||||
class SwiftViewController: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
let root = self.view!
|
||||
root.backgroundColor = .red
|
||||
root.yoga.isEnabled = true
|
||||
root.yoga.width = self.view.bounds.size.width
|
||||
root.yoga.height = self.view.bounds.size.height
|
||||
root.yoga.alignItems = .center
|
||||
root.yoga.justifyContent = .center
|
||||
|
||||
let child1 = UIView()
|
||||
child1.backgroundColor = .blue
|
||||
child1.yoga.isEnabled = true
|
||||
child1.yoga.width = 100
|
||||
child1.yoga.height = 10
|
||||
|
||||
let child2 = UIView()
|
||||
child2.backgroundColor = .green
|
||||
child2.frame = CGRect(x: 0, y: 0, width: 200, height: 100)
|
||||
|
||||
let child3 = UIView()
|
||||
child3.backgroundColor = .yellow
|
||||
child3.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
|
||||
|
||||
child2.addSubview(child3)
|
||||
root.addSubview(child1)
|
||||
root.addSubview(child2)
|
||||
root.yoga.applyLayout()
|
||||
}
|
||||
}
|
15
YogaKit/YogaKitSample/YogaKitSample/ViewController.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
|
||||
@end
|
||||
|
60
YogaKit/YogaKitSample/YogaKitSample/ViewController.m
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "ViewController.h"
|
||||
|
||||
#import <YogaKit/UIView+Yoga.h>
|
||||
|
||||
@interface ViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
UIView *root = self.view;
|
||||
root.backgroundColor = [UIColor redColor];
|
||||
root.yoga.isEnabled = YES;
|
||||
root.yoga.width = self.view.bounds.size.width;
|
||||
root.yoga.height = self.view.bounds.size.height;
|
||||
root.yoga.alignItems = YGAlignCenter;
|
||||
root.yoga.justifyContent = YGJustifyCenter;
|
||||
|
||||
UIView *child1 = [UIView new];
|
||||
child1.backgroundColor = [UIColor blueColor];
|
||||
child1.yoga.isEnabled = YES;
|
||||
child1.yoga.width = 100;
|
||||
child1.yoga.height = 100;
|
||||
|
||||
UIView *child2 = [UIView new];
|
||||
child2.backgroundColor = [UIColor greenColor];
|
||||
child2.frame = (CGRect) {
|
||||
.size = {
|
||||
.width = 200,
|
||||
.height = 100,
|
||||
}
|
||||
};
|
||||
|
||||
UIView *child3 = [UIView new];
|
||||
child3.backgroundColor = [UIColor yellowColor];
|
||||
child3.frame = (CGRect) {
|
||||
.size = {
|
||||
.width = 100,
|
||||
.height = 100,
|
||||
}
|
||||
};
|
||||
|
||||
[child2 addSubview:child3];
|
||||
[root addSubview:child1];
|
||||
[root addSubview:child2];
|
||||
[root.yoga applyLayout];
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "UIView+Yoga.h"
|
||||
#import <yoga/Yoga.h>
|
16
YogaKit/YogaKitSample/YogaKitSample/main.m
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
27
benchmark/BUCK
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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_defs('//YOGA_DEFS')
|
||||
|
||||
cxx_binary(
|
||||
name = 'benchmark',
|
||||
srcs = glob(['*.c']),
|
||||
headers = subdir_glob([('', '*.h')]),
|
||||
header_namespace = '',
|
||||
compiler_flags = [
|
||||
'-fno-omit-frame-pointer',
|
||||
'-fexceptions',
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-O3',
|
||||
'-std=c11',
|
||||
],
|
||||
deps = [
|
||||
yoga_dep(':yoga'),
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
118
benchmark/YGBenchmark.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* 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 "YGBenchmark.h"
|
||||
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static YGSize _measure(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return (YGSize){
|
||||
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
|
||||
};
|
||||
}
|
||||
|
||||
YGBENCHMARKS({
|
||||
|
||||
YGBENCHMARK("Stack with flex", {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
for (uint32_t i = 0; i < 10; i++) {
|
||||
const YGNodeRef child = YGNodeNew();
|
||||
YGNodeSetMeasureFunc(child, _measure);
|
||||
YGNodeStyleSetFlex(child, 1);
|
||||
YGNodeInsertChild(root, child, 0);
|
||||
}
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
YGNodeFreeRecursive(root);
|
||||
});
|
||||
|
||||
YGBENCHMARK("Align stretch in undefined axis", {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
||||
for (uint32_t i = 0; i < 10; i++) {
|
||||
const YGNodeRef child = YGNodeNew();
|
||||
YGNodeStyleSetHeight(child, 20);
|
||||
YGNodeSetMeasureFunc(child, _measure);
|
||||
YGNodeInsertChild(root, child, 0);
|
||||
}
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
YGNodeFreeRecursive(root);
|
||||
});
|
||||
|
||||
YGBENCHMARK("Nested flex", {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
||||
for (uint32_t i = 0; i < 10; i++) {
|
||||
const YGNodeRef child = YGNodeNew();
|
||||
YGNodeStyleSetFlex(child, 1);
|
||||
YGNodeInsertChild(root, child, 0);
|
||||
|
||||
for (uint32_t ii = 0; ii < 10; ii++) {
|
||||
const YGNodeRef grandChild = YGNodeNew();
|
||||
YGNodeSetMeasureFunc(grandChild, _measure);
|
||||
YGNodeStyleSetFlex(grandChild, 1);
|
||||
YGNodeInsertChild(child, grandChild, 0);
|
||||
}
|
||||
}
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
YGNodeFreeRecursive(root);
|
||||
});
|
||||
|
||||
YGBENCHMARK("Huge nested layout", {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
||||
for (uint32_t i = 0; i < 10; i++) {
|
||||
const YGNodeRef child = YGNodeNew();
|
||||
YGNodeStyleSetFlexGrow(child, 1);
|
||||
YGNodeStyleSetWidth(child, 10);
|
||||
YGNodeStyleSetHeight(child, 10);
|
||||
YGNodeInsertChild(root, child, 0);
|
||||
|
||||
for (uint32_t ii = 0; ii < 10; ii++) {
|
||||
const YGNodeRef grandChild = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(grandChild, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlexGrow(grandChild, 1);
|
||||
YGNodeStyleSetWidth(grandChild, 10);
|
||||
YGNodeStyleSetHeight(grandChild, 10);
|
||||
YGNodeInsertChild(child, grandChild, 0);
|
||||
|
||||
for (uint32_t iii = 0; iii < 10; iii++) {
|
||||
const YGNodeRef grandGrandChild = YGNodeNew();
|
||||
YGNodeStyleSetFlexGrow(grandGrandChild, 1);
|
||||
YGNodeStyleSetWidth(grandGrandChild, 10);
|
||||
YGNodeStyleSetHeight(grandGrandChild, 10);
|
||||
YGNodeInsertChild(grandChild, grandGrandChild, 0);
|
||||
|
||||
for (uint32_t iii = 0; iii < 10; iii++) {
|
||||
const YGNodeRef grandGrandGrandChild = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
|
||||
YGNodeStyleSetWidth(grandGrandGrandChild, 10);
|
||||
YGNodeStyleSetHeight(grandGrandGrandChild, 10);
|
||||
YGNodeInsertChild(grandGrandChild, grandGrandGrandChild, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
YGNodeFreeRecursive(root);
|
||||
});
|
||||
|
||||
});
|
73
benchmark/YGBenchmark.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define NUM_REPETITIONS 1000
|
||||
|
||||
#define YGBENCHMARKS(BLOCK) \
|
||||
int main(int argc, char const *argv[]) { \
|
||||
clock_t __start; \
|
||||
clock_t __endTimes[NUM_REPETITIONS]; \
|
||||
{ BLOCK } \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define YGBENCHMARK(NAME, BLOCK) \
|
||||
__start = clock(); \
|
||||
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
||||
{ BLOCK } \
|
||||
__endTimes[__i] = clock(); \
|
||||
} \
|
||||
__printBenchmarkResult(NAME, __start, __endTimes);
|
||||
|
||||
int __compareDoubles(const void *a, const void *b) {
|
||||
double arg1 = *(const double *) a;
|
||||
double arg2 = *(const double *) b;
|
||||
|
||||
if (arg1 < arg2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (arg1 > arg2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __printBenchmarkResult(char *name, clock_t start, clock_t *endTimes) {
|
||||
double timesInMs[NUM_REPETITIONS];
|
||||
double mean = 0;
|
||||
clock_t lastEnd = start;
|
||||
for (uint32_t i = 0; i < NUM_REPETITIONS; i++) {
|
||||
timesInMs[i] = (endTimes[i] - lastEnd) / (double) CLOCKS_PER_SEC * 1000;
|
||||
lastEnd = endTimes[i];
|
||||
mean += timesInMs[i];
|
||||
}
|
||||
mean /= NUM_REPETITIONS;
|
||||
|
||||
qsort(timesInMs, NUM_REPETITIONS, sizeof(double), __compareDoubles);
|
||||
double median = timesInMs[NUM_REPETITIONS / 2];
|
||||
|
||||
double variance = 0;
|
||||
for (uint32_t i = 0; i < NUM_REPETITIONS; i++) {
|
||||
variance += pow(timesInMs[i] - mean, 2);
|
||||
}
|
||||
variance /= NUM_REPETITIONS;
|
||||
double stddev = sqrt(variance);
|
||||
|
||||
printf("%s: median: %lf ms, stddev: %lf ms\n", name, median, stddev);
|
||||
}
|
269
csharp/.gitignore
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
tests/Facebook.Yoga/NUnit-[0-9\.]*/
|
||||
tests/Facebook.Yoga/YogaTest.dll
|
||||
tests/Facebook.Yoga/YogaTest.dll.mdb
|
||||
tests/Facebook.Yoga/libyoga.dylib
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
269
csharp/.hgignore
Normal file
@@ -0,0 +1,269 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
tests/Facebook.Yoga/NUnit-[0-9\.]*/
|
||||
tests/Facebook.Yoga/YogaTest.dll
|
||||
tests/Facebook.Yoga/YogaTest.dll.mdb
|
||||
tests/Facebook.Yoga/libyoga.dylib
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
63
csharp/BUCK
Normal file
@@ -0,0 +1,63 @@
|
||||
# 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_defs('//YOGA_DEFS')
|
||||
|
||||
COMPILER_FLAGS = BASE_COMPILER_FLAGS + ['-std=c++11']
|
||||
|
||||
csharp_library(
|
||||
name = 'yogalibnet46',
|
||||
dll_name = 'Facebook.Yoga.dll',
|
||||
framework_ver = 'net46',
|
||||
srcs = glob(['**/*.cs']),
|
||||
)
|
||||
|
||||
csharp_library(
|
||||
name = 'yogalibnet45',
|
||||
dll_name = 'Facebook.Yoga.dll',
|
||||
framework_ver = 'net45',
|
||||
srcs = glob(['**/*.cs']),
|
||||
)
|
||||
|
||||
cxx_library(
|
||||
name = 'yoganet',
|
||||
soname = 'libyoga.$(ext)',
|
||||
srcs = glob(['Yoga/YGInterop.cpp']),
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
link_style = 'static',
|
||||
link_whole = True,
|
||||
deps = [yoga_dep(':yoga')],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
with allow_unsafe_import():
|
||||
import os
|
||||
|
||||
if os.path.isdir('/Applications/Xcode.app'):
|
||||
yoganet_ios_srcs = []
|
||||
for arch in ['iphonesimulator-x86_64', 'iphoneos-arm64', 'iphoneos-armv7']:
|
||||
name = 'yoganet-' + arch
|
||||
yoganet_ios_srcs.append(':' + name)
|
||||
genrule(
|
||||
name = name,
|
||||
srcs = [
|
||||
yoga_dep(':yoga#%s,static' % arch),
|
||||
yoga_dep('YogaKit:YogaKit#%s,static' % arch),
|
||||
yoga_dep('csharp:yoganet#%s,static' % arch),
|
||||
],
|
||||
out = 'libyoga-%s.a' % arch,
|
||||
cmd = 'libtool -static -o $OUT $SRCS',
|
||||
visibility = [yoga_dep('csharp:yoganet-ios')],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'yoganet-ios',
|
||||
srcs = yoganet_ios_srcs,
|
||||
out = 'libyoga.a',
|
||||
cmd = 'lipo $SRCS -create -output $OUT',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
13
csharp/Facebook.Yoga/BaselineFunction.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public delegate float BaselineFunction(YogaNode node, float width, float height);
|
||||
}
|
32
csharp/Facebook.Yoga/Border.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[System.Obsolete]
|
||||
public class Border
|
||||
{
|
||||
public float? Top;
|
||||
public float? Bottom;
|
||||
public float? Left;
|
||||
public float? Right;
|
||||
|
||||
public Border(
|
||||
float? top = null,
|
||||
float? bottom = null,
|
||||
float? left = null,
|
||||
float? right = null)
|
||||
{
|
||||
Top = top;
|
||||
Bottom = bottom;
|
||||
Left = left;
|
||||
Right = right;
|
||||
}
|
||||
}
|
||||
}
|
43
csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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>91c42d32-291d-4b72-90b4-551663d60b8b</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Facebook.Yoga.Shared</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)BaselineFunction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Border.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureFunction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureOutput.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Native.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Spacing.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaAlign.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaBaselineFunc.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaConstants.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaDimension.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaDirection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaEdge.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaExperimentalFeature.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaFlexDirection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaJustify.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaLogger.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaLogLevel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureFunc.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureMode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Create.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Spacing.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaOverflow.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaPositionType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaPrintOptions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaSize.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaUnit.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaValue.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaValueExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaWrap.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
13
csharp/Facebook.Yoga/Facebook.Yoga.Shared.shproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>91c42d32-291d-4b72-90b4-551663d60b8b</ProjectGuid>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
</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" />
|
||||
<PropertyGroup />
|
||||
<Import Project="Facebook.Yoga.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
18
csharp/Facebook.Yoga/MeasureFunction.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public delegate YogaSize MeasureFunction(
|
||||
YogaNode node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode);
|
||||
}
|
13
src/csharp/Facebook.CSSLayout/Assertions.cs → csharp/Facebook.Yoga/MeasureOutput.cs
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,16 +7,13 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
static class Assertions
|
||||
public class MeasureOutput
|
||||
{
|
||||
public static T assertNotNull<T>(T v) where T : class
|
||||
public static YogaSize Make(float width, float height)
|
||||
{
|
||||
Debug.Assert(v != null);
|
||||
return v;
|
||||
return new YogaSize { width = width, height = height};
|
||||
}
|
||||
}
|
||||
}
|
327
csharp/Facebook.Yoga/Native.cs
Normal file
@@ -0,0 +1,327 @@
|
||||
/**
|
||||
* 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 System.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
internal static class Native
|
||||
{
|
||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||
private const string DllName = "__Internal";
|
||||
#else
|
||||
private const string DllName = "yoga";
|
||||
#endif
|
||||
|
||||
internal class YGNodeHandle : SafeHandle
|
||||
{
|
||||
private YGNodeHandle() : base(IntPtr.Zero, true)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInvalid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.handle == IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
Native.YGNodeFree(this.handle);
|
||||
GC.KeepAlive(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGInteropSetLogger(
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YGNodeHandle YGNodeNew();
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeFree(IntPtr node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeReset(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int YGNodeGetInstanceCount();
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGSetExperimentalFeatureEnabled(
|
||||
YogaExperimentalFeature feature,
|
||||
bool enabled);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool YGIsExperimentalFeatureEnabled(
|
||||
YogaExperimentalFeature feature);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeInsertChild(YGNodeHandle node, YGNodeHandle child, uint index);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeRemoveChild(YGNodeHandle node, YGNodeHandle child);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeCalculateLayout(YGNodeHandle node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
YogaDirection parentDirection);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeMarkDirty(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool YGNodeIsDirty(YGNodeHandle node);
|
||||
|
||||
[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);
|
||||
|
||||
#region YG_NODE_PROPERTY
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeSetMeasureFunc(
|
||||
YGNodeHandle node,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] YogaMeasureFunc measureFunc);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeSetBaselineFunc(
|
||||
YGNodeHandle node,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] YogaBaselineFunc baselineFunc);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeSetHasNewLayout(YGNodeHandle node, [MarshalAs(UnmanagedType.I1)] bool hasNewLayout);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool YGNodeGetHasNewLayout(YGNodeHandle node);
|
||||
|
||||
#endregion
|
||||
|
||||
#region YG_NODE_STYLE_PROPERTY
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetDirection(YGNodeHandle node, YogaDirection direction);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaDirection YGNodeStyleGetDirection(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexDirection(YGNodeHandle node, YogaFlexDirection flexDirection);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaFlexDirection YGNodeStyleGetFlexDirection(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetJustifyContent(YGNodeHandle node, YogaJustify justifyContent);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaJustify YGNodeStyleGetJustifyContent(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetAlignContent(YGNodeHandle node, YogaAlign alignContent);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaAlign YGNodeStyleGetAlignContent(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetAlignItems(YGNodeHandle node, YogaAlign alignItems);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaAlign YGNodeStyleGetAlignItems(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetAlignSelf(YGNodeHandle node, YogaAlign alignSelf);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaAlign YGNodeStyleGetAlignSelf(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetPositionType(YGNodeHandle node, YogaPositionType positionType);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaPositionType YGNodeStyleGetPositionType(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexWrap(YGNodeHandle node, YogaWrap flexWrap);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaWrap YGNodeStyleGetFlexWrap(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetOverflow(YGNodeHandle node, YogaOverflow flexWrap);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaOverflow YGNodeStyleGetOverflow(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlex(YGNodeHandle node, float flex);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexGrow(YGNodeHandle node, float flexGrow);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeStyleGetFlexGrow(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexShrink(YGNodeHandle node, float flexShrink);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeStyleGetFlexShrink(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexBasis(YGNodeHandle node, float flexBasis);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetFlexBasisPercent(YGNodeHandle node, float flexBasis);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetFlexBasis(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetWidthPercent(YGNodeHandle node, float width);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetWidth(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetHeightPercent(YGNodeHandle node, float height);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetHeight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetMinWidth(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetMinHeight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetMaxWidth(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetMaxHeight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeStyleGetAspectRatio(YGNodeHandle node);
|
||||
|
||||
#endregion
|
||||
|
||||
#region YG_NODE_STYLE_EDGE_PROPERTY
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetPosition(YGNodeHandle node, YogaEdge edge, float position);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetMarginPercent(YGNodeHandle node, YogaEdge edge, float margin);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaValue YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeStyleGetBorder(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
#endregion
|
||||
|
||||
#region YG_NODE_LAYOUT_PROPERTY
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetLeft(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetTop(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetRight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetBottom(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetWidth(YGNodeHandle node);
|
||||
|
||||
[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 YGNodeLayoutGetPadding(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaDirection YGNodeLayoutGetDirection(YGNodeHandle node);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
32
csharp/Facebook.Yoga/Spacing.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[System.Obsolete]
|
||||
public class Spacing
|
||||
{
|
||||
public YogaValue? Top;
|
||||
public YogaValue? Bottom;
|
||||
public YogaValue? Left;
|
||||
public YogaValue? Right;
|
||||
|
||||
public Spacing(
|
||||
YogaValue? top = null,
|
||||
YogaValue? bottom = null,
|
||||
YogaValue? left = null,
|
||||
YogaValue? right = null)
|
||||
{
|
||||
Top = top;
|
||||
Bottom = bottom;
|
||||
Left = left;
|
||||
Right = right;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,14 +7,15 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSAlign
|
||||
public enum YogaAlign
|
||||
{
|
||||
Auto,
|
||||
FlexStart,
|
||||
Center,
|
||||
FlexEnd,
|
||||
Stretch,
|
||||
Baseline,
|
||||
}
|
||||
}
|
17
csharp/Facebook.Yoga/YogaBaselineFunc.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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 System.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate float YogaBaselineFunc(IntPtr node, float width, float height);
|
||||
}
|
26
csharp/Facebook.Yoga/YogaConstants.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public static class YogaConstants
|
||||
{
|
||||
public const float Undefined = float.NaN;
|
||||
|
||||
public static bool IsUndefined(float value)
|
||||
{
|
||||
return float.IsNaN(value);
|
||||
}
|
||||
|
||||
public static bool IsUndefined(YogaValue value)
|
||||
{
|
||||
return value.Unit == YogaUnit.Undefined;
|
||||
}
|
||||
}
|
||||
}
|
17
csharp/Facebook.Yoga/YogaDimension.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaDimension
|
||||
{
|
||||
Width,
|
||||
Height,
|
||||
}
|
||||
}
|
8
src/csharp/Facebook.CSSLayout/CSSDirection.cs → csharp/Facebook.Yoga/YogaDirection.cs
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,12 +7,12 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSDirection
|
||||
public enum YogaDirection
|
||||
{
|
||||
Inherit,
|
||||
LTR,
|
||||
RTL
|
||||
RTL,
|
||||
}
|
||||
}
|
24
csharp/Facebook.Yoga/YogaEdge.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaEdge
|
||||
{
|
||||
Left,
|
||||
Top,
|
||||
Right,
|
||||
Bottom,
|
||||
Start,
|
||||
End,
|
||||
Horizontal,
|
||||
Vertical,
|
||||
All,
|
||||
}
|
||||
}
|
17
csharp/Facebook.Yoga/YogaExperimentalFeature.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaExperimentalFeature
|
||||
{
|
||||
Rounding,
|
||||
WebFlexBasis,
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,13 +7,13 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSFlexDirection
|
||||
public enum YogaFlexDirection
|
||||
{
|
||||
Column,
|
||||
ColumnReverse,
|
||||
Row,
|
||||
RowReverse
|
||||
RowReverse,
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,14 +7,14 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSJustify
|
||||
public enum YogaJustify
|
||||
{
|
||||
FlexStart,
|
||||
Center,
|
||||
FlexEnd,
|
||||
SpaceBetween,
|
||||
SpaceAround
|
||||
SpaceAround,
|
||||
}
|
||||
}
|
20
csharp/Facebook.Yoga/YogaLogLevel.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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaLogLevel
|
||||
{
|
||||
Error,
|
||||
Warn,
|
||||
Info,
|
||||
Debug,
|
||||
Verbose,
|
||||
}
|
||||
}
|
45
csharp/Facebook.Yoga/YogaLogger.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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 System.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
internal static class YogaLogger
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void Func(YogaLogLevel level, string message);
|
||||
|
||||
private static bool _initialized;
|
||||
private static Func _managedLogger = null;
|
||||
|
||||
public static Func Logger = null;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
_managedLogger = (level, message) => {
|
||||
if (Logger != null)
|
||||
{
|
||||
Logger(level, message);
|
||||
}
|
||||
|
||||
if (level == YogaLogLevel.Error)
|
||||
{
|
||||
throw new InvalidOperationException(message);
|
||||
}
|
||||
};
|
||||
Native.YGInteropSetLogger(_managedLogger);
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
csharp/Facebook.Yoga/YogaMeasureFunc.cs
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.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate YogaSize YogaMeasureFunc(
|
||||
IntPtr node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode);
|
||||
}
|
18
csharp/Facebook.Yoga/YogaMeasureMode.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaMeasureMode
|
||||
{
|
||||
Undefined,
|
||||
Exactly,
|
||||
AtMost,
|
||||
}
|
||||
}
|
234
csharp/Facebook.Yoga/YogaNode.Create.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public partial class YogaNode
|
||||
{
|
||||
[Obsolete("use Object Initializer")]
|
||||
public static YogaNode Create(
|
||||
YogaDirection? styleDirection = null,
|
||||
YogaFlexDirection? flexDirection = null,
|
||||
YogaJustify? justifyContent = null,
|
||||
YogaAlign? alignContent = null,
|
||||
YogaAlign? alignItems = null,
|
||||
YogaAlign? alignSelf = null,
|
||||
YogaPositionType? positionType = null,
|
||||
YogaWrap? wrap = null,
|
||||
YogaOverflow? overflow = null,
|
||||
float? flex = null,
|
||||
float? flexGrow = null,
|
||||
float? flexShrink = null,
|
||||
YogaValue? flexBasis = null,
|
||||
Spacing position = null,
|
||||
Spacing margin = null,
|
||||
Spacing padding = null,
|
||||
Border border = null,
|
||||
YogaValue? width = null,
|
||||
YogaValue? height = null,
|
||||
YogaValue? maxWidth = null,
|
||||
YogaValue? maxHeight = null,
|
||||
YogaValue? minWidth = null,
|
||||
YogaValue? minHeight = null)
|
||||
{
|
||||
YogaNode node = new YogaNode();
|
||||
|
||||
if (styleDirection.HasValue)
|
||||
{
|
||||
node.StyleDirection = styleDirection.Value;
|
||||
}
|
||||
|
||||
if (flexDirection.HasValue)
|
||||
{
|
||||
node.FlexDirection = flexDirection.Value;
|
||||
}
|
||||
|
||||
if (justifyContent.HasValue)
|
||||
{
|
||||
node.JustifyContent = justifyContent.Value;
|
||||
}
|
||||
|
||||
if (alignContent.HasValue)
|
||||
{
|
||||
node.AlignContent = alignContent.Value;
|
||||
}
|
||||
|
||||
if (alignItems.HasValue)
|
||||
{
|
||||
node.AlignItems = alignItems.Value;
|
||||
}
|
||||
|
||||
if (alignSelf.HasValue)
|
||||
{
|
||||
node.AlignSelf = alignSelf.Value;
|
||||
}
|
||||
|
||||
if (positionType.HasValue)
|
||||
{
|
||||
node.PositionType = positionType.Value;
|
||||
}
|
||||
|
||||
if (wrap.HasValue)
|
||||
{
|
||||
node.Wrap = wrap.Value;
|
||||
}
|
||||
|
||||
if (overflow.HasValue)
|
||||
{
|
||||
node.Overflow = overflow.Value;
|
||||
}
|
||||
|
||||
if (flex.HasValue)
|
||||
{
|
||||
node.Flex = flex.Value;
|
||||
}
|
||||
|
||||
if (flexGrow.HasValue)
|
||||
{
|
||||
node.FlexGrow = flexGrow.Value;
|
||||
}
|
||||
|
||||
if (flexShrink.HasValue)
|
||||
{
|
||||
node.FlexShrink = flexShrink.Value;
|
||||
}
|
||||
|
||||
if (flexBasis.HasValue)
|
||||
{
|
||||
node.FlexBasis = flexBasis.Value;
|
||||
}
|
||||
|
||||
if (position != null)
|
||||
{
|
||||
if (position.Top.HasValue)
|
||||
{
|
||||
node.Top = position.Top.Value;
|
||||
}
|
||||
|
||||
if (position.Bottom.HasValue)
|
||||
{
|
||||
node.Bottom = position.Bottom.Value;
|
||||
}
|
||||
|
||||
if (position.Left.HasValue)
|
||||
{
|
||||
node.Left = position.Left.Value;
|
||||
}
|
||||
|
||||
if (position.Right.HasValue)
|
||||
{
|
||||
node.Right = position.Right.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (margin != null)
|
||||
{
|
||||
if (margin.Top.HasValue)
|
||||
{
|
||||
node.MarginTop = margin.Top.Value;
|
||||
}
|
||||
|
||||
if (margin.Bottom.HasValue)
|
||||
{
|
||||
node.MarginBottom = margin.Bottom.Value;
|
||||
}
|
||||
|
||||
if (margin.Left.HasValue)
|
||||
{
|
||||
node.MarginLeft = margin.Left.Value;
|
||||
}
|
||||
|
||||
if (margin.Right.HasValue)
|
||||
{
|
||||
node.MarginRight = margin.Right.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (padding != null)
|
||||
{
|
||||
if (padding.Top.HasValue)
|
||||
{
|
||||
node.PaddingTop = padding.Top.Value;
|
||||
}
|
||||
|
||||
if (padding.Bottom.HasValue)
|
||||
{
|
||||
node.PaddingBottom = padding.Bottom.Value;
|
||||
}
|
||||
|
||||
if (padding.Left.HasValue)
|
||||
{
|
||||
node.PaddingLeft = padding.Left.Value;
|
||||
}
|
||||
|
||||
if (padding.Right.HasValue)
|
||||
{
|
||||
node.PaddingRight = padding.Right.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (border != null)
|
||||
{
|
||||
if (border.Top.HasValue)
|
||||
{
|
||||
node.BorderTopWidth = border.Top.Value;
|
||||
}
|
||||
|
||||
if (border.Bottom.HasValue)
|
||||
{
|
||||
node.BorderBottomWidth = border.Bottom.Value;
|
||||
}
|
||||
|
||||
if (border.Left.HasValue)
|
||||
{
|
||||
node.BorderLeftWidth = border.Left.Value;
|
||||
}
|
||||
|
||||
if (border.Right.HasValue)
|
||||
{
|
||||
node.BorderRightWidth = border.Right.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (width.HasValue)
|
||||
{
|
||||
node.Width = width.Value;
|
||||
}
|
||||
|
||||
if (height.HasValue)
|
||||
{
|
||||
node.Height = height.Value;
|
||||
}
|
||||
|
||||
if (minWidth.HasValue)
|
||||
{
|
||||
node.MinWidth = minWidth.Value;
|
||||
}
|
||||
|
||||
if (minHeight.HasValue)
|
||||
{
|
||||
node.MinHeight = minHeight.Value;
|
||||
}
|
||||
|
||||
if (maxWidth.HasValue)
|
||||
{
|
||||
node.MaxWidth = maxWidth.Value;
|
||||
}
|
||||
|
||||
if (maxHeight.HasValue)
|
||||
{
|
||||
node.MaxHeight = maxHeight.Value;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
503
csharp/Facebook.Yoga/YogaNode.Spacing.cs
Normal file
@@ -0,0 +1,503 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public partial class YogaNode
|
||||
{
|
||||
public YogaValue Left
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.Left, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Top
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.Top, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Right
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.Right, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Bottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.Bottom, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Start
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.Start, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue End
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePosition(YogaEdge.End, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStylePosition(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Left, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Top, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Right, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Bottom, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Start, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.End, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginHorizontal
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Horizontal, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MarginVertical
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.Vertical, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStyleMargin(YogaEdge.All, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStyleMargin(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Left, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Top, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Right, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Bottom, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Start, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.End, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingHorizontal
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Horizontal, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue PaddingVertical
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.Vertical, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Padding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetStylePadding(YogaEdge.All, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStylePadding(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderLeftWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Left, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderTopWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Top, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderRightWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Right, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderBottomWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Bottom, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderStartWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Start, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderEndWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.End);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.End, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float BorderWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.All);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.All, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Left);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Top);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Right);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Start);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutPaddingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
689
csharp/Facebook.Yoga/YogaNode.cs
Normal file
@@ -0,0 +1,689 @@
|
||||
/**
|
||||
* 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 System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public partial class YogaNode : IEnumerable<YogaNode>
|
||||
{
|
||||
private Native.YGNodeHandle _ygNode;
|
||||
private WeakReference _parent;
|
||||
private List<YogaNode> _children;
|
||||
private MeasureFunction _measureFunction;
|
||||
private YogaMeasureFunc _ygMeasureFunc;
|
||||
private BaselineFunction _baselineFunction;
|
||||
private YogaBaselineFunc _ygBaselineFunc;
|
||||
private object _data;
|
||||
|
||||
public YogaNode()
|
||||
{
|
||||
YogaLogger.Initialize();
|
||||
|
||||
_ygNode = Native.YGNodeNew();
|
||||
if (_ygNode.IsInvalid)
|
||||
{
|
||||
throw new InvalidOperationException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_measureFunction = null;
|
||||
_baselineFunction = null;
|
||||
_data = null;
|
||||
|
||||
Native.YGNodeReset(_ygNode);
|
||||
}
|
||||
|
||||
public bool IsDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeIsDirty(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void MarkDirty()
|
||||
{
|
||||
Native.YGNodeMarkDirty(_ygNode);
|
||||
}
|
||||
|
||||
public bool HasNewLayout
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeGetHasNewLayout(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkHasNewLayout()
|
||||
{
|
||||
Native.YGNodeSetHasNewLayout(_ygNode, true);
|
||||
}
|
||||
|
||||
public YogaNode Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _parent != null ? _parent.Target as YogaNode : null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMeasureDefined
|
||||
{
|
||||
get
|
||||
{
|
||||
return _measureFunction != null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBaselineDefined
|
||||
{
|
||||
get
|
||||
{
|
||||
return _baselineFunction != null;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyStyle(YogaNode srcNode)
|
||||
{
|
||||
Native.YGNodeCopyStyle(_ygNode, srcNode._ygNode);
|
||||
}
|
||||
|
||||
public YogaDirection StyleDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetDirection(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetDirection(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaFlexDirection FlexDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetFlexDirection(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetFlexDirection(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaJustify JustifyContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetJustifyContent(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetJustifyContent(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetAlignItems(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetAlignItems(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignSelf
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetAlignSelf(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetAlignSelf(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaAlign AlignContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetAlignContent(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetAlignContent(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaPositionType PositionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetPositionType(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetPositionType(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaWrap Wrap
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetFlexWrap(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetFlexWrap(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float Flex
|
||||
{
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetFlex(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float FlexGrow
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetFlexGrow(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetFlexGrow(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float FlexShrink
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetFlexShrink(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetFlexShrink(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue FlexBasis
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetFlexBasis(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetFlexBasisPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetFlexBasis(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("use Margin properties")]
|
||||
public YogaValue GetMargin(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeStyleGetMargin(_ygNode, edge);
|
||||
}
|
||||
|
||||
[Obsolete("use Margin properties")]
|
||||
public void SetMargin(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("use Padding properties")]
|
||||
public YogaValue GetPadding(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeStyleGetPadding(_ygNode, edge);
|
||||
}
|
||||
|
||||
[Obsolete("use Padding properties")]
|
||||
public void SetPadding(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("use BorderWidth properties")]
|
||||
public float GetBorder(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeStyleGetBorder(_ygNode, edge);
|
||||
}
|
||||
|
||||
[Obsolete("use BorderWidth properties")]
|
||||
public void SetBorder(YogaEdge edge, float border)
|
||||
{
|
||||
Native.YGNodeStyleSetBorder(_ygNode, edge, border);
|
||||
}
|
||||
|
||||
[Obsolete("use Position properties")]
|
||||
public YogaValue GetPosition(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeStyleGetPosition(_ygNode, edge);
|
||||
}
|
||||
|
||||
[Obsolete("use Position properties")]
|
||||
public void SetPosition(YogaEdge edge, YogaValue value)
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("use LayoutPadding properties")]
|
||||
public float GetLayoutPadding(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, edge);
|
||||
}
|
||||
|
||||
public YogaValue Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetWidth(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetWidthPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetWidth(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetHeight(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetHeightPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetHeight(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MaxWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMaxWidth(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMaxWidthPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMaxWidth(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MaxHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMaxHeight(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMaxHeightPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMaxHeight(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MinWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMinWidth(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMinWidthPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMinWidth(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public YogaValue MinHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetMinHeight(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Unit == YogaUnit.Percent)
|
||||
{
|
||||
Native.YGNodeStyleSetMinHeightPercent(_ygNode, value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Native.YGNodeStyleSetMinHeight(_ygNode, value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float StyleAspectRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetAspectRatio(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetAspectRatio(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutX
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetLeft(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutY
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetTop(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetWidth(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public float LayoutHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetHeight(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaDirection LayoutDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeLayoutGetDirection(_ygNode);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaOverflow Overflow
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeStyleGetOverflow(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeStyleSetOverflow(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public object Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_data = value;
|
||||
}
|
||||
}
|
||||
|
||||
public YogaNode this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return _children[index];
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return _children != null ? _children.Count : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkLayoutSeen()
|
||||
{
|
||||
Native.YGNodeSetHasNewLayout(_ygNode, false);
|
||||
}
|
||||
|
||||
public bool ValuesEqual(float f1, float f2)
|
||||
{
|
||||
if (float.IsNaN(f1) || float.IsNaN(f2))
|
||||
{
|
||||
return float.IsNaN(f1) && float.IsNaN(f2);
|
||||
}
|
||||
|
||||
return Math.Abs(f2 - f1) < float.Epsilon;
|
||||
}
|
||||
|
||||
public void Insert(int index, YogaNode node)
|
||||
{
|
||||
if (_children == null)
|
||||
{
|
||||
_children = new List<YogaNode>(4);
|
||||
}
|
||||
_children.Insert(index, node);
|
||||
node._parent = new WeakReference(this);
|
||||
Native.YGNodeInsertChild(_ygNode, node._ygNode, (uint)index);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
var child = _children[index];
|
||||
child._parent = null;
|
||||
_children.RemoveAt(index);
|
||||
Native.YGNodeRemoveChild(_ygNode, child._ygNode);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if (_children != null)
|
||||
{
|
||||
while (_children.Count > 0)
|
||||
{
|
||||
RemoveAt(_children.Count-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int IndexOf(YogaNode node)
|
||||
{
|
||||
return _children != null ? _children.IndexOf(node) : -1;
|
||||
}
|
||||
|
||||
public void SetMeasureFunction(MeasureFunction measureFunction)
|
||||
{
|
||||
_measureFunction = measureFunction;
|
||||
_ygMeasureFunc = measureFunction != null ? MeasureInternal : (YogaMeasureFunc)null;
|
||||
Native.YGNodeSetMeasureFunc(_ygNode, _ygMeasureFunc);
|
||||
}
|
||||
|
||||
public void SetBaselineFunction(BaselineFunction baselineFunction)
|
||||
{
|
||||
_baselineFunction = baselineFunction;
|
||||
_ygBaselineFunc = baselineFunction != null ? BaselineInternal : (YogaBaselineFunc)null;
|
||||
Native.YGNodeSetBaselineFunc(_ygNode, _ygBaselineFunc);
|
||||
}
|
||||
|
||||
public void CalculateLayout()
|
||||
{
|
||||
Native.YGNodeCalculateLayout(
|
||||
_ygNode,
|
||||
YogaConstants.Undefined,
|
||||
YogaConstants.Undefined,
|
||||
Native.YGNodeStyleGetDirection(_ygNode));
|
||||
}
|
||||
|
||||
private YogaSize MeasureInternal(
|
||||
IntPtr node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode)
|
||||
{
|
||||
if (_measureFunction == null)
|
||||
{
|
||||
throw new InvalidOperationException("Measure function is not defined.");
|
||||
}
|
||||
|
||||
return _measureFunction(this, width, widthMode, height, heightMode);
|
||||
}
|
||||
|
||||
private float BaselineInternal(IntPtr node, float width, float height)
|
||||
{
|
||||
if (_baselineFunction == null)
|
||||
{
|
||||
throw new InvalidOperationException("Baseline function is not defined.");
|
||||
}
|
||||
|
||||
return _baselineFunction(this, width, height);
|
||||
}
|
||||
|
||||
public string Print(YogaPrintOptions options =
|
||||
YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
YogaLogger.Func orig = YogaLogger.Logger;
|
||||
YogaLogger.Logger = (level, message) => {sb.Append(message);};
|
||||
Native.YGNodePrint(_ygNode, options);
|
||||
YogaLogger.Logger = orig;
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public IEnumerator<YogaNode> GetEnumerator()
|
||||
{
|
||||
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
|
||||
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
|
||||
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
|
||||
}
|
||||
|
||||
public static int GetInstanceCount()
|
||||
{
|
||||
return Native.YGNodeGetInstanceCount();
|
||||
}
|
||||
|
||||
public static void SetExperimentalFeatureEnabled(
|
||||
YogaExperimentalFeature feature,
|
||||
bool enabled)
|
||||
{
|
||||
Native.YGSetExperimentalFeatureEnabled(feature, enabled);
|
||||
}
|
||||
|
||||
public static bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature)
|
||||
{
|
||||
return Native.YGIsExperimentalFeatureEnabled(feature);
|
||||
}
|
||||
}
|
||||
}
|
18
csharp/Facebook.Yoga/YogaOverflow.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaOverflow
|
||||
{
|
||||
Visible,
|
||||
Hidden,
|
||||
Scroll,
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -7,11 +7,11 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
namespace Facebook.CSSLayout
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSPositionType
|
||||
public enum YogaPositionType
|
||||
{
|
||||
Relative,
|
||||
Absolute
|
||||
Absolute,
|
||||
}
|
||||
}
|
18
csharp/Facebook.Yoga/YogaPrintOptions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaPrintOptions
|
||||
{
|
||||
Layout = 1,
|
||||
Style = 2,
|
||||
Children = 4,
|
||||
}
|
||||
}
|
20
csharp/Facebook.Yoga/YogaSize.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.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct YogaSize
|
||||
{
|
||||
public float width;
|
||||
public float height;
|
||||
}
|
||||
}
|
18
csharp/Facebook.Yoga/YogaUnit.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum YogaUnit
|
||||
{
|
||||
Undefined,
|
||||
Pixel,
|
||||
Percent,
|
||||
}
|
||||
}
|
87
csharp/Facebook.Yoga/YogaValue.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* 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.Runtime.InteropServices;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct YogaValue
|
||||
{
|
||||
private float value;
|
||||
private YogaUnit unit;
|
||||
|
||||
public YogaUnit Unit
|
||||
{
|
||||
get
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
|
||||
public float Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public static YogaValue Pixel(float value)
|
||||
{
|
||||
return new YogaValue
|
||||
{
|
||||
value = value,
|
||||
unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Pixel
|
||||
};
|
||||
}
|
||||
|
||||
public bool Equals(YogaValue other)
|
||||
{
|
||||
return Unit == other.Unit && (Value.Equals(other.Value) || Unit == YogaUnit.Undefined);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is YogaValue && Equals((YogaValue) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (Value.GetHashCode() * 397) ^ (int) Unit;
|
||||
}
|
||||
}
|
||||
|
||||
public static YogaValue Undefined()
|
||||
{
|
||||
return new YogaValue
|
||||
{
|
||||
value = YogaConstants.Undefined,
|
||||
unit = YogaUnit.Undefined
|
||||
};
|
||||
}
|
||||
|
||||
public static YogaValue Percent(float value)
|
||||
{
|
||||
return new YogaValue
|
||||
{
|
||||
value = value,
|
||||
unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Percent
|
||||
};
|
||||
}
|
||||
|
||||
public static implicit operator YogaValue(float pixelValue)
|
||||
{
|
||||
return Pixel(pixelValue);
|
||||
}
|
||||
}
|
||||
}
|
34
csharp/Facebook.Yoga/YogaValueExtensions.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public static class YogaValueExtensions
|
||||
{
|
||||
public static YogaValue Percent(this float value)
|
||||
{
|
||||
return YogaValue.Percent(value);
|
||||
}
|
||||
|
||||
public static YogaValue Px(this float value)
|
||||
{
|
||||
return YogaValue.Pixel(value);
|
||||
}
|
||||
|
||||
public static YogaValue Percent(this int value)
|
||||
{
|
||||
return YogaValue.Percent(value);
|
||||
}
|
||||
|
||||
public static YogaValue Px(this int value)
|
||||
{
|
||||
return YogaValue.Pixel(value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,16 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* 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.
|
||||
*/
|
||||
namespace Facebook.CSSLayout
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
public enum CSSWrap
|
||||
public enum YogaWrap
|
||||
{
|
||||
NoWrap,
|
||||
Wrap
|
||||
Wrap,
|
||||
}
|
||||
}
|
15
csharp/Facebook.Yoga/project.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"language": "en",
|
||||
"version": "3.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0",
|
||||
"System.Runtime.Handles": "4.3.0"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
2
csharp/Mac/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
libyoga.dylib
|
||||
*.userprefs
|
23
csharp/Mac/ApiDefinition.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 AppKit;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace Facebook.Yoga.Mac
|
||||
{
|
||||
// Xamarin.Mac binding projects allow you to include native libraries inside C# DLLs for easy consumption
|
||||
// later. However, the binding project build files currently assume you are binding some objective-c API
|
||||
// and that you need an ApiDefinition.cs for that. yoga is all C APIs, so just include this "blank" file so
|
||||
// the dylib gets packaged
|
||||
}
|
11
csharp/Mac/CustomBuildAction.targets
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<CompileDependsOn>CopyInNativeLib;$(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>
|
||||
</Project>
|
30
csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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 AppKit;
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : NSApplicationDelegate
|
||||
{
|
||||
public AppDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
public override void DidFinishLaunching(NSNotification notification)
|
||||
{
|
||||
}
|
||||
|
||||
public override void WillTerminate(NSNotification notification)
|
||||
{
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
}
|
||||
}
|
6
csharp/Mac/Facebook.Yoga.Mac.Test/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,84 @@
|
||||
<?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>{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>
|
||||
<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="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.Mac" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</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>
|
||||
<InterfaceDefinition Include="Main.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga.Mac.csproj">
|
||||
<Project>{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}</Project>
|
||||
<Name>Facebook.Yoga.Mac</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
|
||||
</Project>
|
30
csharp/Mac/Facebook.Yoga.Mac.Test/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.Test</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.companyname.facebook-yoga-mac-test</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>
|
21
csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 AppKit;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
{
|
||||
static class MainClass
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
NSApplication.Init();
|
||||
NSApplication.Main(args);
|
||||
}
|
||||
}
|
||||
}
|
681
csharp/Mac/Facebook.Yoga.Mac.Test/Main.storyboard
Normal file
@@ -0,0 +1,681 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="6198" systemVersion="14A297b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6198" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Application-->
|
||||
<scene sceneID="JPo-4y-FX3">
|
||||
<objects>
|
||||
<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">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Facebook.Yoga.Mac.Test" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About Facebook.Yoga.Mac.Test" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH" />
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW" />
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ" />
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<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">
|
||||
<connections>
|
||||
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT" />
|
||||
<menuItem title="Quit Facebook.Yoga.Mac.Test" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="dMs-cI-mzQ">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="Ady-hI-5gd" id="4Si-XN-c54" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="Ady-hI-5gd" id="bVn-NM-KNZ" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Recent" id="tXI-mr-wws">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="vNY-rz-j42">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="Ady-hI-5gd" id="Daa-9d-B3U" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="m54-Is-iLE" />
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="Ady-hI-5gd" id="HmO-Ls-i7Q" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="Ady-hI-5gd" id="teZ-XB-qJY" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="Ady-hI-5gd" id="mDf-zr-I0C" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Revert to Saved" id="KaW-ft-85H">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="revertDocumentToSaved:" target="Ady-hI-5gd" id="iJ3-Pv-kwq" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="aJh-i4-bef" />
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="Ady-hI-5gd" id="Din-rz-gC5" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
|
||||
<connections>
|
||||
<action selector="print:" target="Ady-hI-5gd" id="qaZ-4w-aoO" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="Ady-hI-5gd" id="M6e-cu-g7V" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="Ady-hI-5gd" id="oIA-Rs-6OD" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz" />
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="Ady-hI-5gd" id="YJe-68-I9s" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="Ady-hI-5gd" id="G1f-GL-Joy" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="Ady-hI-5gd" id="UvS-8e-Qdg" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="Ady-hI-5gd" id="cEh-KX-wJQ" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="delete:" target="Ady-hI-5gd" id="0Mk-Ml-PaM" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="Ady-hI-5gd" id="VNm-Mi-diN" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2" />
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="WD3-Gg-5AJ" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="Ady-hI-5gd" id="IOG-6D-g5B" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="Ady-hI-5gd" id="vFj-Ks-hy3" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="Ady-hI-5gd" id="fz7-VC-reM" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5" />
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="Ady-hI-5gd" id="7w6-Qz-0kB" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="Ady-hI-5gd" id="muD-Qn-j4w" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="Ady-hI-5gd" id="2lM-Qi-WAP" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="Ady-hI-5gd" id="oku-mr-iSq" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO" />
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="Ady-hI-5gd" id="3IJ-Se-DZD" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="Ady-hI-5gd" id="ptq-xd-QOA" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="Ady-hI-5gd" id="oCt-pO-9gS" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="Ady-hI-5gd" id="Gip-E3-Fov" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="Ady-hI-5gd" id="R1I-Nq-Kbl" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="Ady-hI-5gd" id="DvP-Fe-Py6" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="Ady-hI-5gd" id="sPh-Tk-edu" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="Ady-hI-5gd" id="iUZ-b5-hil" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="Ady-hI-5gd" id="26H-TL-nsh" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="Ady-hI-5gd" id="654-Ng-kyl" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="Ady-hI-5gd" id="dX8-6p-jy9" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq" />
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27" />
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq" />
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="Ady-hI-5gd" id="FYS-2b-JAY" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO" />
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL" />
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST" />
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B" />
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="Ady-hI-5gd" id="6dk-9l-Ckg" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="Ady-hI-5gd" id="U8a-gz-Maa" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="Ady-hI-5gd" id="hr7-Nz-8ro" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="Ady-hI-5gd" id="8i4-f9-FKE" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="Ady-hI-5gd" id="7uR-wd-Dx6" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="Ady-hI-5gd" id="iX2-gA-Ilz" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="Ady-hI-5gd" id="KcB-kA-TuK" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="unscript:" target="Ady-hI-5gd" id="0vZ-95-Ywn" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="superscript:" target="Ady-hI-5gd" id="3qV-fo-wpU" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="subscript:" target="Ady-hI-5gd" id="Q6W-4W-IGz" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="Ady-hI-5gd" id="4sk-31-7Q9" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="Ady-hI-5gd" id="OF1-bc-KW4" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq" />
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="Ady-hI-5gd" id="mSX-Xz-DV3" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ" />
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="copyFont:" target="Ady-hI-5gd" id="GJO-xA-L4q" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="Ady-hI-5gd" id="JfD-CL-leO" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="Ady-hI-5gd" id="zUv-R1-uAa" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="Ady-hI-5gd" id="spX-mk-kcS" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="Ady-hI-5gd" id="ljL-7U-jND" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="Ady-hI-5gd" id="r48-bG-YeY" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK" />
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="Ady-hI-5gd" id="qtV-5e-UBP" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="S0X-9S-QSf" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="5fk-qB-AqJ" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21" />
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="Ady-hI-5gd" id="lPI-Se-ZHp" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="caW-Bv-w94" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="EXD-6r-ZUu" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm" />
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="Ady-hI-5gd" id="FOx-HJ-KwY" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="Ady-hI-5gd" id="71i-fW-3W2" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="Ady-hI-5gd" id="cSh-wd-qM2" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES" />
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="Ady-hI-5gd" id="BXY-wc-z0C" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="Ady-hI-5gd" id="pQI-g3-MTW" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM" />
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask" />
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<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">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no" />
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m" />
|
||||
</connections>
|
||||
</application>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="" />
|
||||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="75" y="0.0" />
|
||||
</scene>
|
||||
<!--Window Controller - Window-->
|
||||
<scene sceneID="R2V-B0-nI4">
|
||||
<objects>
|
||||
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" />
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES" />
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="270" />
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027" />
|
||||
</window>
|
||||
<connections>
|
||||
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM" />
|
||||
</connections>
|
||||
</windowController>
|
||||
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="75" y="250" />
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="hIz-AP-VOD">
|
||||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270" />
|
||||
<autoresizingMask key="autoresizingMask" />
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="75" y="655" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
137
csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//#define DEBUG_LAYOUT
|
||||
using System;
|
||||
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
{
|
||||
public static class NSViewYogaExtensions
|
||||
{
|
||||
public static void ApplyYogaLayout (this NSView view, YogaNode n, bool root = true)
|
||||
{
|
||||
#if DEBUG_LAYOUT
|
||||
Console.WriteLine ($"ApplyYogaLayout {view.ToolTip}, {n.LayoutX}, {n.LayoutY}, {n.LayoutWidth}, {n.LayoutHeight}");
|
||||
#endif
|
||||
|
||||
// A bit of gross special casing
|
||||
// This really should mostly go away if/when the UIView+Yoga.m magic gets ported to AppKit
|
||||
if (root)
|
||||
view.Frame = new CGRect (n.LayoutX, n.LayoutY, n.LayoutWidth, n.LayoutHeight);
|
||||
#if DEBUG_LAYOUT
|
||||
Console.WriteLine ($"Setting {view.ToolTip} frame to {view.Frame}");
|
||||
#endif
|
||||
|
||||
// This assumes your YogaNode and NSView children were inserted in same order
|
||||
for (int i = 0; i < n.Count; ++i) {
|
||||
YogaNode childNode = n[i];
|
||||
// Cocoa coord space is from bottom left not top left
|
||||
view.Subviews[i].Frame = new CGRect (childNode.LayoutX, n.LayoutHeight - childNode.LayoutY - childNode.LayoutHeight, childNode.LayoutWidth, childNode.LayoutHeight);
|
||||
#if DEBUG_LAYOUT
|
||||
Console.WriteLine ($"Setting {view.Subviews[i].ToolTip} frame to {view.Subviews[i].Frame}");
|
||||
#endif
|
||||
if (childNode.Count > 0){
|
||||
#if DEBUG_LAYOUT
|
||||
Console.WriteLine ($"Calling ApplyYogaLayout recursively on {view.Subviews[i].ToolTip}");
|
||||
#endif
|
||||
ApplyYogaLayout (view.Subviews[i], childNode, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ViewController : NSViewController
|
||||
{
|
||||
public ViewController(IntPtr handle) : base(handle)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
NSImage image = NSImage.ImageNamed (NSImageName.TrashFull);
|
||||
|
||||
NSView root = CreateViewHierarchy (image);
|
||||
var rootNode = CalculateLayout (View.Frame, image.Size);
|
||||
|
||||
root.ApplyYogaLayout (rootNode);
|
||||
|
||||
View.AddSubview (root);
|
||||
}
|
||||
|
||||
static NSView CreateViewHierarchy (NSImage image)
|
||||
{
|
||||
var root = new NSView () {
|
||||
WantsLayer = true,
|
||||
ToolTip = "Root"
|
||||
};
|
||||
root.Layer.BackgroundColor = NSColor.Red.CGColor;
|
||||
|
||||
NSView child1 = new NSView () {
|
||||
WantsLayer = true,
|
||||
ToolTip = "Child 1"
|
||||
};
|
||||
child1.Layer.BackgroundColor = NSColor.Blue.CGColor;
|
||||
|
||||
NSView child2 = new NSView () {
|
||||
WantsLayer = true,
|
||||
ToolTip = "Child 2"
|
||||
};
|
||||
child2.Layer.BackgroundColor = NSColor.Green.CGColor;
|
||||
|
||||
NSView child3 = new NSView () {
|
||||
WantsLayer = true,
|
||||
ToolTip = "Child 3"
|
||||
};
|
||||
child3.Layer.BackgroundColor = NSColor.Yellow.CGColor;
|
||||
|
||||
root.AddSubview (child1);
|
||||
root.AddSubview (child2);
|
||||
child2.AddSubview (child3);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
static YogaNode CalculateLayout (CGRect rootFrame, CGSize imageSize)
|
||||
{
|
||||
var rootNode = new YogaNode () {
|
||||
Width = (float)rootFrame.Width,
|
||||
Height = (float)rootFrame.Height,
|
||||
AlignItems = YogaAlign.Center,
|
||||
JustifyContent = YogaJustify.Center
|
||||
};
|
||||
|
||||
var child1Node = new YogaNode () {
|
||||
Width = 100,
|
||||
Height = 100
|
||||
};
|
||||
|
||||
var child2Node = new YogaNode () {
|
||||
Width = 200,
|
||||
Height = 100
|
||||
};
|
||||
|
||||
var child3Node = new YogaNode () {
|
||||
Width = 100,
|
||||
Height = 100
|
||||
};
|
||||
|
||||
rootNode.Insert (0, child1Node);
|
||||
rootNode.Insert (1, child2Node);
|
||||
child2Node.Insert (0, child3Node);
|
||||
rootNode.CalculateLayout ();
|
||||
|
||||
return rootNode;
|
||||
}
|
||||
}
|
||||
}
|
18
csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.designer.cs
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically by Xamarin Studio to store outlets and
|
||||
// actions made in the UI designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.Yoga.Mac.Test
|
||||
{
|
||||
[Register("ViewController")]
|
||||
partial class ViewController
|
||||
{
|
||||
void ReleaseDesignerOutlets()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
51
csharp/Mac/Facebook.Yoga.Mac.csproj
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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>{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}</ProjectGuid>
|
||||
<ProjectTypeGuids>{810C163F-4746-4721-8B8E-88A3673A62EA};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Facebook.Yoga.Mac</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.Mac</AssemblyName>
|
||||
<MacResourcePrefix>Resources</MacResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>__UNIFIED__;DEBUG;MONOMAC</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants>__UNIFIED__;MONOMAC</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.Mac" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CustomBuildAction.targets" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NativeReference Include="libyoga.dylib">
|
||||
<Kind>Dynamic</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\Mac\Xamarin.Mac.ObjcBinding.CSharp.targets" />
|
||||
<Import Project="CustomBuildAction.targets" />
|
||||
</Project>
|
25
csharp/Mac/Facebook.Yoga.Mac.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
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
|
||||
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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
3
csharp/Unity/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Yoga
|
||||
yoga.dll
|
||||
yoga.unitypackage
|
64
csharp/Unity/pack.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
cd "$( dirname "$0" )"
|
||||
|
||||
if [ \! -f yoga.dll ]; then
|
||||
echo "Launch win.bat on Windows and copy yoga.dll to here"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function build {
|
||||
buck build $1
|
||||
echo "$root/`buck targets --show-output $1|tail -1|awk '{print $2}'`"
|
||||
}
|
||||
|
||||
function copy {
|
||||
mkdir -p $3
|
||||
cp $1 $3/$2
|
||||
}
|
||||
|
||||
rm -rf Yoga yoga.unitypackage
|
||||
|
||||
root=`buck root|tail -f`
|
||||
mac=$(build '//csharp:yoganet#default,shared')
|
||||
armv7=$(build '//csharp:yoganet#android-armv7,shared')
|
||||
ios=$(build '//csharp:yoganet-ios')
|
||||
win=yoga.dll
|
||||
|
||||
Unity -quit -batchMode -createProject Yoga
|
||||
|
||||
copy $win ${win##*/} Yoga/Assets/Facebook.Yoga/Plugins/x86_64
|
||||
copy $mac yoga Yoga/Assets/Facebook.Yoga/Plugins/x86_64/yoga.bundle/Contents/MacOS
|
||||
armv7path=Assets/Plugins/Android/libs/armeabi-v7a
|
||||
copy $armv7 ${armv7##*/} Yoga/$armv7path
|
||||
iospath=Assets/Plugins/iOS
|
||||
copy $ios ${ios##*/} Yoga/$iospath
|
||||
libs="$armv7path/${armv7##*/} $iospath/${ios##*/}"
|
||||
|
||||
scripts=Yoga/Assets/Facebook.Yoga/Scripts/Facebook.Yoga
|
||||
mkdir -p $scripts
|
||||
(cd ../Facebook.Yoga; tar cf - *.cs)|tar -C $scripts -xf -
|
||||
|
||||
tests=Yoga/Assets/Facebook.Yoga/Editor/Facebook.Yoga.Tests
|
||||
mkdir -p $tests
|
||||
(cd ../tests/Facebook.Yoga; tar cf - *.cs)|tar -C $tests -xf -
|
||||
|
||||
function onerror {
|
||||
local xml=Yoga/EditorTestResults.xml
|
||||
if [ -f $xml ]; then cat $xml|grep 'success="False"'; fi
|
||||
}
|
||||
trap onerror EXIT
|
||||
Unity -quit -batchMode -projectPath `pwd`/Yoga -runEditorTests
|
||||
|
||||
pkg="`pwd`/yoga.unitypackage"
|
||||
Unity -quit -batchMode -projectPath `pwd`/Yoga -exportPackage Assets/Facebook.Yoga $libs $pkg
|
||||
|
||||
echo "Success: $pkg"
|
2
csharp/Unity/win.bat
Executable file
@@ -0,0 +1,2 @@
|
||||
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" ..\Yoga\Yoga.vcxproj /p:configuration=Release /property:Platform=x64
|
||||
xcopy "..\Yoga\bin\x64\Release\yoga.dll" %~dp0 /s /d /y
|
131
csharp/Windows/Build/Facebook.Yoga.NativeInterop.targets
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<NativeRootPath>$(SolutionDir)..\Yoga\bin\</NativeRootPath>
|
||||
<NativeX86Path>$(NativeRootPath)x86\</NativeX86Path>
|
||||
<NativeX64Path>$(NativeRootPath)x64\</NativeX64Path>
|
||||
<NativeARMPath>$(NativeRootPath)ARM\</NativeARMPath>
|
||||
<NativeDLLMoniker>Yoga</NativeDLLMoniker>
|
||||
<CurrentPlatform Condition="$(PROCESSOR_ARCHITECTURE) =='AMD64' or $(PROCESSOR_ARCHITECTURE) == 'IA64' or $(PROCESSOR_ARCHITEW6432) == 'AMD64'">AMD64</CurrentPlatform>
|
||||
<CurrentPlatform Condition="$(PROCESSOR_ARCHITECTURE) =='ARM'">ARM</CurrentPlatform>
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="$(Platform) == 'AnyCPU'">
|
||||
<Choose>
|
||||
<When Condition="$(Prefer32Bit) == 'true'">
|
||||
<ItemGroup Condition="$(CurrentPlatform) == 'x86' Or $(CurrentPlatform) == 'AMD64'">
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(CurrentPlatform) == 'ARM'">
|
||||
<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup Condition="$(CurrentPlatform) == 'x86'">
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(CurrentPlatform) == 'AMD64'">
|
||||
<Content Include="$(NativeX64Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX64Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(CurrentPlatform) == 'ARM'">
|
||||
<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup Condition="$(PlatformTarget) == 'x86'">
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(PlatformTarget) == 'x64'">
|
||||
<Content Include="$(NativeX64Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX64Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(PlatformTarget) == 'ARM'">
|
||||
<!--<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeARMPath)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>-->
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).dll">
|
||||
<Link>$(NativeDLLMoniker).dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(NativeX86Path)$(Configuration)\$(NativeDLLMoniker).pdb">
|
||||
<Link>$(NativeDLLMoniker).pdb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</Project>
|
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Facebook.Yoga</RootNamespace>
|
||||
<AssemblyName>Facebook.Yoga.Desktop.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga\Facebook.Yoga.csproj">
|
||||
<Project>{3aace384-fdec-4d91-a3b2-eeb21b46c9ad}</Project>
|
||||
<Name>Facebook.Yoga</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)Build\Facebook.Yoga.NativeInterop.targets" Condition="Exists('$(SolutionDir)Build\Facebook.Yoga.NativeInterop.targets')" Label="ImportNativeInteropTargets" />
|
||||
<Target Name="EnsureNativeInteropImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references a native interop target that is missing. The missing build target is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)Build\Facebook.Yoga.NativeInterop.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)Build\Facebook.Yoga.NativeInterop.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
@@ -8,20 +8,21 @@
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Facebook.CSSLayout.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyTitle("Facebook.Yoga.Desktop.Tests")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Facebook.CSSLayout.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © Facebook 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyCompany("Facebook, Inc.")]
|
||||
[assembly: AssemblyProduct("Facebook.Yoga")]
|
||||
[assembly: AssemblyCopyright("Copyright (c) 2014-present, Facebook, Inc.")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("c186053a-741f-477d-b031-4d343fb20d1d")]
|
||||
[assembly: Guid("ac23f444-5545-4196-8b9f-5c1f6b3e7fb3")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||
</packages>
|
102
csharp/Windows/Facebook.Yoga.Desktop.sln
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5289E508-8386-45A1-A12B-258A5899CD45}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NETStandard", "NETStandard", "{DCF7899B-A487-49C0-BCDE-DC088B6750C2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga", "..\Yoga\Yoga.vcxproj", "{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{39A2FFDA-C093-4FA6-8143-45B5019E7DAC}"
|
||||
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", "Facebook.Yoga\Facebook.Yoga.csproj", "{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}
|
||||
EndProjectSection
|
||||
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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Desktop.Tests", "Facebook.Yoga.Desktop.Tests\Facebook.Yoga.Desktop.Tests.csproj", "{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{3aace384-fdec-4d91-a3b2-eeb21b46c9ad}*SharedItemsImports = 4
|
||||
..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13
|
||||
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13
|
||||
..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{ac23f444-5545-4196-8b9f-5c1f6b3e7fb3}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.Build.0 = Debug|x64
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.Build.0 = Debug|Win32
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.Build.0 = Release|ARM
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.ActiveCfg = Release|x64
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.Build.0 = Release|x64
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.Build.0 = Release|Win32
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.Build.0 = Debug|x64
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.Build.0 = Debug|x86
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.Build.0 = Release|ARM
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.ActiveCfg = Release|x64
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.Build.0 = Release|x64
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.ActiveCfg = Release|x86
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.Build.0 = Release|x86
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.Build.0 = Debug|x86
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x64.Build.0 = Release|x64
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x86.ActiveCfg = Release|x86
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {51A8E803-C084-431F-9130-F277481C2BB2}
|
||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD} = {DCF7899B-A487-49C0-BCDE-DC088B6750C2}
|
||||
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
||||
{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3} = {5289E508-8386-45A1-A12B-258A5899CD45}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.1 KiB |