diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..64fe33bbae --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://EditorConfig.org + +root = true + +[*] +end_of_line = CRLF + +[*.cs] +indent_style = space +indent_size = 4 diff --git a/.gitmodules b/.gitmodules index 63bc5f5de3..93467688c1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,10 @@ [submodule "src/Perspex.ReactiveUI/src"] path = src/Perspex.ReactiveUI/src url = https://github.com/reactiveui/ReactiveUI.git +[submodule "src/Perspex.HtmlRenderer/external"] + path = src/Perspex.HtmlRenderer/external + url = https://github.com/Perspex/HTML-Renderer.git + branch = perspex-pcl +[submodule "src/Markup/Perspex.Markup.Xaml/OmniXAML"] + path = src/Markup/Perspex.Markup.Xaml/OmniXAML + url = https://github.com/SuperJMN/OmniXAML.git diff --git a/Perspex.sln b/Perspex.sln index 4952c2b257..22b196d2c8 100644 --- a/Perspex.sln +++ b/Perspex.sln @@ -3,18 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Win32", "src\Windows\Perspex.Win32\Perspex.Win32.csproj", "{811A76CF-1CF6-440F-963B-BBE31BD72A82}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication", "samples\TestApplication\TestApplication.csproj", "{E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}" - ProjectSection(ProjectDependencies) = postProject - {3E908F67-5543-4879-A1DC-08EACE79B3CD} = {3E908F67-5543-4879-A1DC-08EACE79B3CD} - {FB05AC90-89BA-4F2F-A924-F37875FB547C} = {FB05AC90-89BA-4F2F-A924-F37875FB547C} - {811A76CF-1CF6-440F-963B-BBE31BD72A82} = {811A76CF-1CF6-440F-963B-BBE31BD72A82} - {54F237D5-A70A-4752-9656-0C70B1A7B047} = {54F237D5-A70A-4752-9656-0C70B1A7B047} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Direct2D1", "src\Windows\Perspex.Direct2D1\Perspex.Direct2D1.csproj", "{3E908F67-5543-4879-A1DC-08EACE79B3CD}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Base", "src\Perspex.Base\Perspex.Base.csproj", "{B09B78D8-9B26-48B0-9149-D64A2F120F3F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.SceneGraph", "src\Perspex.SceneGraph\Perspex.SceneGraph.csproj", "{EB582467-6ABB-43A1-B052-E981BA910E3A}" @@ -23,6 +11,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Layout", "src\Persp EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windows", "Windows", "{B39A8919-9F95-48FE-AD7B-76E08B509888}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Win32", "src\Windows\Perspex.Win32\Perspex.Win32.csproj", "{811A76CF-1CF6-440F-963B-BBE31BD72A82}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Direct2D1", "src\Windows\Perspex.Direct2D1\Perspex.Direct2D1.csproj", "{3E908F67-5543-4879-A1DC-08EACE79B3CD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Designer", "src\Windows\Perspex.Designer\Perspex.Designer.csproj", "{EC42600F-049B-43FF-AED1-8314D61B2749}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Input", "src\Perspex.Input\Perspex.Input.csproj", "{62024B2D-53EB-4638-B26B-85EEAA54866E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Interactivity", "src\Perspex.Interactivity\Perspex.Interactivity.csproj", "{6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B}" @@ -31,29 +25,25 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Controls", "src\Per EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Styling", "src\Perspex.Styling\Perspex.Styling.csproj", "{F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Styling.UnitTests", "tests\Perspex.Styling.UnitTests\Perspex.Styling.UnitTests.csproj", "{47ECDF59-DEF8-4C53-87B1-2098A3429059}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Controls.UnitTests", "tests\Perspex.Controls.UnitTests\Perspex.Controls.UnitTests.csproj", "{5CCB5571-7C30-4E7D-967D-0E2158EBD91F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Themes.Default", "src\Perspex.Themes.Default\Perspex.Themes.Default.csproj", "{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.SceneGraph.UnitTests", "tests\Perspex.SceneGraph.UnitTests\Perspex.SceneGraph.UnitTests.csproj", "{76716382-3159-460E-BDA6-C5715CF606D7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Application", "src\Perspex.Application\Perspex.Application.csproj", "{799A7BB5-3C2C-48B6-85A7-406A12C420DA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Diagnostics", "src\Perspex.Diagnostics\Perspex.Diagnostics.csproj", "{7062AE20-5DCC-4442-9645-8195BDECE63E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Base.UnitTests", "tests\Perspex.Base.UnitTests\Perspex.Base.UnitTests.csproj", "{2905FF23-53FB-45E6-AA49-6AF47A172056}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Animation", "src\Perspex.Animation\Perspex.Animation.csproj", "{D211E587-D8BC-45B9-95A4-F297C8FA5200}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{2BAFBE53-7FA4-4BB9-976F-9AFCC4F9847D}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NGenerics", "src\NGenerics\NGenerics.csproj", "{415E048E-4611-4815-9CF2-D774E29079AC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Styling.UnitTests", "tests\Perspex.Styling.UnitTests\Perspex.Styling.UnitTests.csproj", "{47ECDF59-DEF8-4C53-87B1-2098A3429059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Layout.UnitTests", "tests\Perspex.Layout.UnitTests\Perspex.Layout.UnitTests.csproj", "{DB070A10-BF39-4752-8456-86E9D5928478}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Controls.UnitTests", "tests\Perspex.Controls.UnitTests\Perspex.Controls.UnitTests.csproj", "{5CCB5571-7C30-4E7D-967D-0E2158EBD91F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Animation", "src\Perspex.Animation\Perspex.Animation.csproj", "{D211E587-D8BC-45B9-95A4-F297C8FA5200}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.SceneGraph.UnitTests", "tests\Perspex.SceneGraph.UnitTests\Perspex.SceneGraph.UnitTests.csproj", "{76716382-3159-460E-BDA6-C5715CF606D7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Base.UnitTests", "tests\Perspex.Base.UnitTests\Perspex.Base.UnitTests.csproj", "{2905FF23-53FB-45E6-AA49-6AF47A172056}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Layout.UnitTests", "tests\Perspex.Layout.UnitTests\Perspex.Layout.UnitTests.csproj", "{DB070A10-BF39-4752-8456-86E9D5928478}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Interactivity.UnitTests", "tests\Perspex.Interactivity.UnitTests\Perspex.Interactivity.UnitTests.csproj", "{08478EF5-44E8-42E9-92D6-15E00EC038D8}" EndProject @@ -63,9 +53,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Input.UnitTests", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Direct2D1.UnitTests", "tests\Perspex.Direct2D1.UnitTests\Perspex.Direct2D1.UnitTests.csproj", "{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Cairo.RenderTests", "tests\Perspex.RenderTests\Perspex.Cairo.RenderTests.csproj", "{E106CF37-4066-4615-B684-172A6D30B058}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Markup.Xaml.UnitTests", "tests\Perspex.Markup.Xaml.UnitTests\Perspex.Markup.Xaml.UnitTests.csproj", "{99135EAB-653D-47E4-A378-C96E1278CA44}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markup", "Markup", "{8B6A8209-894F-4BA1-B880-965FD453982C}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Markup.Xaml", "src\Markup\Perspex.Markup.Xaml\Perspex.Markup.Xaml.csproj", "{3E53A01A-B331-47F3-B828-4A5717E77A24}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlTestApplication", "samples\XamlTestApplication\XamlTestApplication.csproj", "{78CAFE33-DBEB-4132-8A28-81CFE8A4933C}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{9B9E3891-2366-4253-A952-D08BCEB71098}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication", "samples\TestApplication\TestApplication.csproj", "{E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}" ProjectSection(ProjectDependencies) = postProject {3E908F67-5543-4879-A1DC-08EACE79B3CD} = {3E908F67-5543-4879-A1DC-08EACE79B3CD} {FB05AC90-89BA-4F2F-A924-F37875FB547C} = {FB05AC90-89BA-4F2F-A924-F37875FB547C} @@ -73,9 +71,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlTestApplication", "samp {54F237D5-A70A-4752-9656-0C70B1A7B047} = {54F237D5-A70A-4752-9656-0C70B1A7B047} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markup", "Markup", "{8B6A8209-894F-4BA1-B880-965FD453982C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{9B9E3891-2366-4253-A952-D08BCEB71098}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlTestApplication", "samples\XamlTestApplication\XamlTestApplication.csproj", "{78CAFE33-DBEB-4132-8A28-81CFE8A4933C}" + ProjectSection(ProjectDependencies) = postProject + {3E908F67-5543-4879-A1DC-08EACE79B3CD} = {3E908F67-5543-4879-A1DC-08EACE79B3CD} + {FB05AC90-89BA-4F2F-A924-F37875FB547C} = {FB05AC90-89BA-4F2F-A924-F37875FB547C} + {811A76CF-1CF6-440F-963B-BBE31BD72A82} = {811A76CF-1CF6-440F-963B-BBE31BD72A82} + {54F237D5-A70A-4752-9656-0C70B1A7B047} = {54F237D5-A70A-4752-9656-0C70B1A7B047} + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A689DEF5-D50F-4975-8B72-124C9EB54066}" ProjectSection(SolutionItems) = preProject @@ -90,24 +92,21 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Cairo", "src\Gtk\Pe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.ReactiveUI", "src\Perspex.ReactiveUI\Perspex.ReactiveUI.csproj", "{6417B24E-49C2-4985-8DB2-3AB9D898EC91}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.HtmlRenderer", "src\Perspex.HtmlRenderer\Perspex.HtmlRenderer.csproj", "{5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlatformSupport", "src\Shared\PlatformSupport\PlatformSupport.shproj", "{E4D9629C-F168-4224-3F51-A5E482FFBC42}" +EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + src\Shared\PlatformSupport\PlatformSupport.projitems*{e4d9629c-f168-4224-3f51-a5e482ffbc42}*SharedItemsImports = 13 + src\Shared\PlatformSupport\PlatformSupport.projitems*{54f237d5-a70a-4752-9656-0c70b1a7b047}*SharedItemsImports = 4 + src\Shared\PlatformSupport\PlatformSupport.projitems*{811a76cf-1cf6-440f-963b-bbe31bd72a82}*SharedItemsImports = 4 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.Build.0 = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.Build.0 = Release|Any CPU - {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Release|Any CPU.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.Build.0 = Release|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -120,6 +119,18 @@ Global {42472427-4774-4C81-8AFF-9F27B8E31721}.Debug|Any CPU.Build.0 = Debug|Any CPU {42472427-4774-4C81-8AFF-9F27B8E31721}.Release|Any CPU.ActiveCfg = Release|Any CPU {42472427-4774-4C81-8AFF-9F27B8E31721}.Release|Any CPU.Build.0 = Release|Any CPU + {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.Build.0 = Release|Any CPU + {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.Build.0 = Release|Any CPU + {EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC42600F-049B-43FF-AED1-8314D61B2749}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC42600F-049B-43FF-AED1-8314D61B2749}.Release|Any CPU.Build.0 = Release|Any CPU {62024B2D-53EB-4638-B26B-85EEAA54866E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62024B2D-53EB-4638-B26B-85EEAA54866E}.Debug|Any CPU.Build.0 = Debug|Any CPU {62024B2D-53EB-4638-B26B-85EEAA54866E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -136,22 +147,10 @@ Global {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}.Release|Any CPU.Build.0 = Release|Any CPU - {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Debug|Any CPU.Build.0 = Debug|Any CPU - {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Release|Any CPU.ActiveCfg = Release|Any CPU - {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Release|Any CPU.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.Build.0 = Release|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.Build.0 = Release|Any CPU - {76716382-3159-460E-BDA6-C5715CF606D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76716382-3159-460E-BDA6-C5715CF606D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76716382-3159-460E-BDA6-C5715CF606D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76716382-3159-460E-BDA6-C5715CF606D7}.Release|Any CPU.Build.0 = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -160,22 +159,30 @@ Global {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|Any CPU.Build.0 = Debug|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.ActiveCfg = Release|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.Build.0 = Release|Any CPU + {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Release|Any CPU.Build.0 = Release|Any CPU + {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47ECDF59-DEF8-4C53-87B1-2098A3429059}.Release|Any CPU.Build.0 = Release|Any CPU + {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.Build.0 = Release|Any CPU + {76716382-3159-460E-BDA6-C5715CF606D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76716382-3159-460E-BDA6-C5715CF606D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76716382-3159-460E-BDA6-C5715CF606D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76716382-3159-460E-BDA6-C5715CF606D7}.Release|Any CPU.Build.0 = Release|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|Any CPU.Build.0 = Debug|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|Any CPU.ActiveCfg = Release|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|Any CPU.Build.0 = Release|Any CPU - {415E048E-4611-4815-9CF2-D774E29079AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {415E048E-4611-4815-9CF2-D774E29079AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {415E048E-4611-4815-9CF2-D774E29079AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {415E048E-4611-4815-9CF2-D774E29079AC}.Release|Any CPU.Build.0 = Release|Any CPU {DB070A10-BF39-4752-8456-86E9D5928478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DB070A10-BF39-4752-8456-86E9D5928478}.Debug|Any CPU.Build.0 = Debug|Any CPU {DB070A10-BF39-4752-8456-86E9D5928478}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB070A10-BF39-4752-8456-86E9D5928478}.Release|Any CPU.Build.0 = Release|Any CPU - {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D211E587-D8BC-45B9-95A4-F297C8FA5200}.Release|Any CPU.Build.0 = Release|Any CPU {08478EF5-44E8-42E9-92D6-15E00EC038D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {08478EF5-44E8-42E9-92D6-15E00EC038D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {08478EF5-44E8-42E9-92D6-15E00EC038D8}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -192,10 +199,22 @@ Global {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|Any CPU.Build.0 = Release|Any CPU + {E106CF37-4066-4615-B684-172A6D30B058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E106CF37-4066-4615-B684-172A6D30B058}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E106CF37-4066-4615-B684-172A6D30B058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E106CF37-4066-4615-B684-172A6D30B058}.Release|Any CPU.Build.0 = Release|Any CPU + {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|Any CPU.Build.0 = Release|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|Any CPU.Build.0 = Release|Any CPU + {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}.Release|Any CPU.Build.0 = Release|Any CPU {78CAFE33-DBEB-4132-8A28-81CFE8A4933C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78CAFE33-DBEB-4132-8A28-81CFE8A4933C}.Debug|Any CPU.Build.0 = Debug|Any CPU {78CAFE33-DBEB-4132-8A28-81CFE8A4933C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -212,27 +231,34 @@ Global {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|Any CPU.Build.0 = Debug|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|Any CPU.ActiveCfg = Release|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|Any CPU.Build.0 = Release|Any CPU + {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {811A76CF-1CF6-440F-963B-BBE31BD72A82} = {B39A8919-9F95-48FE-AD7B-76E08B509888} - {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72} = {9B9E3891-2366-4253-A952-D08BCEB71098} {3E908F67-5543-4879-A1DC-08EACE79B3CD} = {B39A8919-9F95-48FE-AD7B-76E08B509888} + {EC42600F-049B-43FF-AED1-8314D61B2749} = {B39A8919-9F95-48FE-AD7B-76E08B509888} {47ECDF59-DEF8-4C53-87B1-2098A3429059} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {5CCB5571-7C30-4E7D-967D-0E2158EBD91F} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {76716382-3159-460E-BDA6-C5715CF606D7} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {2905FF23-53FB-45E6-AA49-6AF47A172056} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} - {415E048E-4611-4815-9CF2-D774E29079AC} = {2BAFBE53-7FA4-4BB9-976F-9AFCC4F9847D} {DB070A10-BF39-4752-8456-86E9D5928478} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {08478EF5-44E8-42E9-92D6-15E00EC038D8} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {DABFD304-D6A4-4752-8123-C2CCF7AC7831} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {AC18926A-E784-40FE-B09D-BB0FE2B599F0} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} + {E106CF37-4066-4615-B684-172A6D30B058} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} + {99135EAB-653D-47E4-A378-C96E1278CA44} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {3E53A01A-B331-47F3-B828-4A5717E77A24} = {8B6A8209-894F-4BA1-B880-965FD453982C} + {E3A1060B-50D0-44E8-88B6-F44EF2E5BD72} = {9B9E3891-2366-4253-A952-D08BCEB71098} {78CAFE33-DBEB-4132-8A28-81CFE8A4933C} = {9B9E3891-2366-4253-A952-D08BCEB71098} {54F237D5-A70A-4752-9656-0C70B1A7B047} = {B9894058-278A-46B5-B6ED-AD613FCC03B3} {FB05AC90-89BA-4F2F-A924-F37875FB547C} = {B9894058-278A-46B5-B6ED-AD613FCC03B3} + {E4D9629C-F168-4224-3F51-A5E482FFBC42} = {A689DEF5-D50F-4975-8B72-124C9EB54066} EndGlobalSection EndGlobal diff --git a/Perspex.sln.DotSettings b/Perspex.sln.DotSettings new file mode 100644 index 0000000000..bf98899847 --- /dev/null +++ b/Perspex.sln.DotSettings @@ -0,0 +1,17 @@ + + ExplicitlyExcluded + ExplicitlyExcluded + HINT + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="I" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="s_" Suffix="" Style="aaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="T" Suffix="" Style="AaBb" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> \ No newline at end of file diff --git a/Perspex.v2.ncrunchsolution b/Perspex.v2.ncrunchsolution index 11389bd8d2..fe4feb2cb6 100644 Binary files a/Perspex.v2.ncrunchsolution and b/Perspex.v2.ncrunchsolution differ diff --git a/Tests/Perspex.Controls.UnitTests/DockPanelTests/AlignerTests.cs b/Tests/Perspex.Controls.UnitTests/DockPanelTests/AlignerTests.cs new file mode 100644 index 0000000000..4e9c087381 --- /dev/null +++ b/Tests/Perspex.Controls.UnitTests/DockPanelTests/AlignerTests.cs @@ -0,0 +1,44 @@ +namespace Perspex.Controls.UnitTests.DockPanelTests +{ + using Xunit; + + + public class AlignerTests + { + [Fact] + public void ToStartTest() + { + Segment container = new Segment(2, 5); + + var aligned = container.AlignToStart(2); + Assert.Equal(new Segment(2, 4), aligned); + } + + [Fact] + public void ToEndTest() + { + Segment container = new Segment(2, 5); + + var aligned = container.AlignToEnd(2); + Assert.Equal(new Segment(3, 5), aligned); + } + + [Fact] + public void ToMiddleTest() + { + Segment container = new Segment(2, 5); + + var aligned = container.AlignToMiddle(2); + Assert.Equal(new Segment(2.5, 4.5), aligned); + } + + [Fact] + public void ToMiddleTest2() + { + Segment container = new Segment(0, 500); + + var aligned = container.AlignToMiddle(200); + Assert.Equal(new Segment(150, 350), aligned); + } + } +} \ No newline at end of file diff --git a/Tests/Perspex.Controls.UnitTests/DockPanelTests/LeftDockerTests.cs b/Tests/Perspex.Controls.UnitTests/DockPanelTests/LeftDockerTests.cs new file mode 100644 index 0000000000..38e12490eb --- /dev/null +++ b/Tests/Perspex.Controls.UnitTests/DockPanelTests/LeftDockerTests.cs @@ -0,0 +1,38 @@ +namespace Perspex.Controls.UnitTests.DockPanelTests +{ + using System.Collections.Generic; + using Layout; + using Moq; + using Xunit; + + public class LeftDockerTests + { + private readonly ILayoutable _layoutable; + + public LeftDockerTests() + { + var layoutableMock = new Mock(); + layoutableMock.Setup(l => l.DesiredSize).Returns(new Size(40, 30)); + _layoutable = layoutableMock.Object; + } + + [Theory] + [MemberData("Source")] + public void Dock(Margins margins, Rect expectedRect) + { + var sut = new LeftDocker(new Size(100, 50)); + var actualRect = sut.GetDockingRect(_layoutable.DesiredSize, margins, new Alignments(Alignment.Middle, Alignment.Stretch)); + + Assert.Equal(expectedRect, actualRect); + } + + // ReSharper disable once UnusedMember.Global + public static IEnumerable Source => new[] + { + new object[] { new Margins(), new Rect(0, 0, 40, 50)}, + new object[] { new Margins { VerticalMargin = new Segment(15, 0) }, new Rect(0, 15, 40, 35)}, + new object[] { new Margins { VerticalMargin = new Segment(0, 15) }, new Rect(0, 0, 40, 35)}, + new object[] { new Margins { VerticalMargin = new Segment(20, 15) }, new Rect(0, 20, 40, 15)}, + }; + } +} \ No newline at end of file diff --git a/Tests/Perspex.Controls.UnitTests/DockPanelTests/RectAlignerTests.cs b/Tests/Perspex.Controls.UnitTests/DockPanelTests/RectAlignerTests.cs new file mode 100644 index 0000000000..33e18b1c8b --- /dev/null +++ b/Tests/Perspex.Controls.UnitTests/DockPanelTests/RectAlignerTests.cs @@ -0,0 +1,40 @@ +namespace Perspex.Controls.UnitTests.DockPanelTests +{ + using Layout; + using Xunit; + + public class RectAlignerTests + { + private readonly Rect _container = new Rect(0, 0, 40, 40); + private readonly Size _child = new Size(20, 20); + + [Theory] + [MemberData("TestData")] + public void LefTopTest(Alignment horz, Alignment vert, Rect expectedRect) + { + var actualRect = _container.AlignChild(_child, horz, vert); + Assert.Equal(expectedRect, actualRect); + } + + // ReSharper disable once UnusedMember.Global + public static object[] TestData => new object[] + { + new object[] {Alignment.Start, Alignment.Start, new Rect(0, 0, 20, 20)}, + new object[] {Alignment.Middle, Alignment.Start, new Rect(10, 0, 20, 20)}, + new object[] {Alignment.End, Alignment.Start, new Rect(20, 0, 20, 20)}, + new object[] {Alignment.Stretch, Alignment.Start, new Rect(0, 0, 40, 20)}, + + new object[] {Alignment.Start, Alignment.Middle, new Rect(0, 10, 20, 20)}, + new object[] {Alignment.Middle, Alignment.Middle, new Rect(10, 10, 20, 20)}, + new object[] {Alignment.End, Alignment.Middle, new Rect(20, 10, 20, 20)}, + new object[] {Alignment.Stretch, Alignment.Middle, new Rect(0, 10, 40, 20)}, + + new object[] {Alignment.Start, VerticalAlignment.Bottom, new Rect(0, 20, 20, 20)}, + new object[] {Alignment.Middle, VerticalAlignment.Bottom, new Rect(10, 20, 20, 20)}, + new object[] {Alignment.End, VerticalAlignment.Bottom, new Rect(20, 20, 20, 20)}, + new object[] {Alignment.Stretch, VerticalAlignment.Bottom, new Rect(0, 20, 40, 20)}, + + new object[] {Alignment.Stretch, VerticalAlignment.Stretch, new Rect(0, 0, 40, 40)}, + }; + } +} \ No newline at end of file diff --git a/Tests/Perspex.Controls.UnitTests/DockPanelTests/RightDockerTests.cs b/Tests/Perspex.Controls.UnitTests/DockPanelTests/RightDockerTests.cs new file mode 100644 index 0000000000..b08676dd71 --- /dev/null +++ b/Tests/Perspex.Controls.UnitTests/DockPanelTests/RightDockerTests.cs @@ -0,0 +1,38 @@ +namespace Perspex.Controls.UnitTests.DockPanelTests +{ + using System.Collections.Generic; + using Layout; + using Moq; + using Xunit; + + public class RightDockerTests + { + private readonly ILayoutable _layoutable; + + public RightDockerTests() + { + var layoutableMock = new Mock(); + layoutableMock.Setup(l => l.DesiredSize).Returns(new Size(40, 30)); + _layoutable = layoutableMock.Object; + } + + [Theory] + [MemberData("Source")] + public void Dock(Margins margins, Rect expectedRect) + { + var sut = new RightDocker(new Size(100, 50)); + var actualRect = sut.GetDockingRect(_layoutable.DesiredSize, margins, new Alignments(Alignment.Middle, Alignment.Stretch)); + + Assert.Equal(expectedRect, actualRect); + } + + // ReSharper disable once UnusedMember.Global + public static IEnumerable Source => new[] + { + new object[] { new Margins(), new Rect(60, 0, 40, 50)}, + new object[] { new Margins { VerticalMargin = new Segment(0, 15) }, new Rect(60, 0, 40, 35)}, + new object[] { new Margins { VerticalMargin = new Segment(15, 0) }, new Rect(60, 15, 40, 35)}, + new object[] { new Margins { VerticalMargin = new Segment(20, 15) }, new Rect(60, 20, 40, 15)}, + }; + } +} \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 9c83b1f9d1..25a2ba5b7b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,20 @@ os: Visual Studio 2015 before_build: - git submodule update --init - nuget restore Perspex.sln + +environment: + myget_key: + secure: XOgD5bJUKNOS2kDDgb+affS4pDcslxALh+xvvnr1Koy0PjXlhILsBdNhxRe0KcNm + +configuration: + - Release + +after_test: +- ps: nuget\build-appveyor.ps1 + +artifacts: + - path: nuget\*.nupkg + build: project: Perspex.sln - verbosity: minimal \ No newline at end of file + verbosity: minimal diff --git a/docs/add-dialogs.png b/docs/add-dialogs.png new file mode 100644 index 0000000000..c89d025e01 Binary files /dev/null and b/docs/add-dialogs.png differ diff --git a/docs/add-packages.png b/docs/add-packages.png new file mode 100644 index 0000000000..4f7e57ad68 Binary files /dev/null and b/docs/add-packages.png differ diff --git a/docs/build.md b/docs/build.md index d62f285f89..41d8f965f3 100644 --- a/docs/build.md +++ b/docs/build.md @@ -6,7 +6,7 @@ Perspex requires Visual Studio 2015 to build on Windows. ### Install GTK Sharp -To compile the full project under windows, you must have gtk-sharp installed. However, if you're +To compile the full project under windows, you must have [gtk-sharp](http://www.mono-project.com/download/#download-win) installed. However, if you're not interested in building the cross-platform bits you can simply unload the Perspex.Cairo and Perspex.Gtk project in Visual Studio. @@ -27,8 +27,7 @@ please submit a PR if you have anything to add. ### Install Latest Mono That the time of writing, mono 4.2 aplha was needed to build. Add mono package sources by following -instructions below for the stable channel, and then add the alpha channel to -`/etc/apt/sources.list.d/mono-xamarin-alpha.list` as well. +instructions below for the stable channel and then add the alpha channel as well. http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives diff --git a/docs/contributing.md b/docs/contributing.md index a8dd7cf6bb..6b10297a3a 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,24 +1,16 @@ # Contributing # -## Style ## +## Before You Start ## -The codebase uses StyleCop with default settings[1] to enforce coding style. Yes, some of the -decisions it makes are downright bizarre, and are certainly not what I would've personally chosen -but the less time spent debating coding style the more time left for coding. +Drop into our [gitter chat room](https://gitter.im/Perspex/Perspex) and let us know what you're thinking of doing. We might be able to give you guidance or let you know if someone else is already working on the feature. -StyleCop should run on each build and give warnings for any violations. So please, follow the style; -you'll get used to it in the end (I know I have). +## Style ## -If the .NET core team decide on a style and write an automatic checker/tidy tool for that style, -I'll gladly adopt it! I'm certainly not tied to the current style, I'm just tired of endless coding -style debates. Someone decide for me goddammit! +The codebase uses [.net core](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) coding style. Try to keep lines of code around 100 characters in length or less, though this is not a hard limit. If you're a few characters over then don't worry too much. -Documentation comments should also be formatted to a 100 character length to help keep them -readable. - **DO NOT USE #REGIONS** full stop. ## Pull requests ## @@ -45,8 +37,7 @@ unless you see something that is obviously wrong or that could be written in a m idiomatic style. It takes time to review each pull request - time that I'd prefer to spend writing new features! -Prefer terseness to verbosity (yes I know that StyleCop will often be working against you here -:weary:) but don't try to be too clever. +Prefer terseness to verbosity but don't try to be too clever. ## Tests ## @@ -67,6 +58,3 @@ English what the test is testing, e.g. Render tests should describe what the produced image is: void Rectangle_2px_Stroke_Filled() - ----- -[1] Documentation rules are disabled because there's currently so much missing documentation, sorry! diff --git a/docs/gettingstarted.md b/docs/gettingstarted.md new file mode 100644 index 0000000000..21f85a7088 --- /dev/null +++ b/docs/gettingstarted.md @@ -0,0 +1,15 @@ +# Getting Started + +## Windows + +![](add-dialogs.png) + +The easiest way to try out Perspex is to install the Visual Studio Extension. + +This will add a Perspex project template and a Window template to the standard Visual Studo “Add” dialog (yes, icons still to come :) ): + +## OSX / Linux + +It is a little more manual on non-Windows platforms, but using Xamarin Studio you can install the Perspex NuGet package. + +![](add-packages.png) diff --git a/docs/perspex-video.png b/docs/perspex-video.png new file mode 100644 index 0000000000..2af3fd4c91 Binary files /dev/null and b/docs/perspex-video.png differ diff --git a/docs/screen.png b/docs/screen.png index 45914f87fc..a321a8d6e3 100644 Binary files a/docs/screen.png and b/docs/screen.png differ diff --git a/docs/styles.md b/docs/styles.md new file mode 100644 index 0000000000..755f097295 --- /dev/null +++ b/docs/styles.md @@ -0,0 +1,93 @@ +# Styling in Perspex + +The main difference between Perspex and existing XAML toolkits such as WPF and +UWP is in styling. Styling in Perspex uses a CSS-like system that aims to be +more powerful and flexible than existing XAML styling systems. For convenience +for the rest of this document we'll refer to existing XAML toolkit's styling as +"WPF styling" as that's where it originated. + +## Basics + +- Styles are defined on the `Control.Styles` collection (as opposed to in +`ResourceDictionaries` in WPF). +- Styles have a `Selector` and a collection of `Setter`s +- Selector works like a CSS selector. +- Setters function like WPF's setters. +- Styles are applied to a control and all its descendants, depending on whether + the selector matches. + +## Simple example + +Make all `Button`s in a `StackPanel` have a blue `Background`: + + + + + + + + +This is very similar to WPF, except `TargetType` is replaced by `Selector`. + +*Note that currently (as of Alpha 2) you **always** need to specify the fully +qualified property name (i.e. `Button.Background` instead of simply +`Background`). This restriction will be lifted in future.* + +## Style Classes + +As in CSS, controls can be given *style classes* which can be used in selectors: + + + + + + + + + +## Pseudoclasses + +Also as in CSS, controls can have pseudoclasses; these are classes that are +defined by the control itself rather than by the user. Pseudoclasses start +with a `:` character. + +One example of a pseudoclass is the `:pointerover` +pseudoclass (`:hover` in CSS - we may change to that in future). + +Pseudoclasses provide the functionality of `Triggers` in WPF and +`VisualStateManager` in UWP: + + + + + + + + +Other pseudoclasses include `:focus`, `:disabled`, `:pressed` for buttons, +`:checked` for checkboxes etc. + +## Named Controls + +Named controls can be selected using `#` as in CSS, e.g. `Button#Name`. + +## Children + +As with CSS, you can select children and descendants: + +- `StackPanel > Button#Foo` selects a `Button` named `"Foo"` that is the child + of a `StackPanel`. +- `StackPanel Button.foo` selects all `Button`s with the `foo` class that are + descendants of a `StackPanel`. + +## Templates + +You can select controls in the template of a lookless control by using the +`/template/` selector, so `Button /template/ Border#outline` selects `Border` +controls named `"outline"` in the template of a `Button`. diff --git a/fileheader.txt b/fileheader.txt new file mode 100644 index 0000000000..47603a79b1 --- /dev/null +++ b/fileheader.txt @@ -0,0 +1,2 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. \ No newline at end of file diff --git a/nuget/.gitignore b/nuget/.gitignore index 93a9893778..d1dab00f5b 100644 --- a/nuget/.gitignore +++ b/nuget/.gitignore @@ -1,7 +1,2 @@ -- build/ - -**/lib/**/*.dll -**/lib/**/*.xml -**/build/**/*.dll -**/build/**/*.xml +Perspex *.nupkg \ No newline at end of file diff --git a/nuget/build-appveyor.ps1 b/nuget/build-appveyor.ps1 new file mode 100644 index 0000000000..d74216def0 --- /dev/null +++ b/nuget/build-appveyor.ps1 @@ -0,0 +1,33 @@ +$scriptpath = $MyInvocation.MyCommand.Path +$dir = Split-Path $scriptpath +Push-Location $dir + + +sv version $env:APPVEYOR_BUILD_NUMBER +#sv version "1-debug" + +sv version 9999.0.$version-nightly +sv key $env:myget_key + +sv file Perspex.$version.nupkg + +.\build-version.ps1 $version + + +sv reponame $env:APPVEYOR_REPO_NAME +sv repobranch $env:APPVEYOR_REPO_BRANCH +sv pullreq $env:APPVEYOR_PULL_REQUEST_NUMBER + +echo "Checking for publishing" +echo $reponame $repobranch $pullreq +if ($reponame -eq "Perspex/Perspex") +{ + echo Repo name matched + if($repobranch -eq "master") + { + echo Repo branch matched + nuget.exe push $file $key -Source https://www.myget.org/F/perspex-nightly/api/v2/package + } +} + + diff --git a/nuget/build-version.ps1 b/nuget/build-version.ps1 new file mode 100644 index 0000000000..1cce68564d --- /dev/null +++ b/nuget/build-version.ps1 @@ -0,0 +1,47 @@ +rm -Force -Recurse .\Perspex -ErrorAction SilentlyContinue +rm -Force -Recurse *.nupkg -ErrorAction SilentlyContinue +Copy-Item template Perspex -Recurse +sv lib "Perspex\lib\portable-windows8+net45" +sv build "Perspex\build\net45" +mkdir $lib -ErrorAction SilentlyContinue +mkdir $build -ErrorAction SilentlyContinue + +Copy-Item ..\src\Perspex.Animation\bin\Release\Perspex.Animation.dll $lib +Copy-Item ..\src\Perspex.Animation\bin\Release\Perspex.Animation.xml $lib +Copy-Item ..\src\Perspex.Application\bin\Release\Perspex.Application.dll $lib +Copy-Item ..\src\Perspex.Application\bin\Release\Perspex.Application.xml $lib +Copy-Item ..\src\Perspex.Base\bin\Release\Perspex.Base.dll $lib +Copy-Item ..\src\Perspex.Base\bin\Release\Perspex.Base.xml $lib +Copy-Item ..\src\Perspex.Controls\bin\Release\Perspex.Controls.dll $lib +Copy-Item ..\src\Perspex.Controls\bin\Release\Perspex.Controls.xml $lib +Copy-Item ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.dll $lib +Copy-Item ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.xml $lib +Copy-Item ..\src\Perspex.Input\bin\Release\Perspex.Input.dll $lib +Copy-Item ..\src\Perspex.Input\bin\Release\Perspex.Input.xml $lib +Copy-Item ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.dll $lib +Copy-Item ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.xml $lib +Copy-Item ..\src\Perspex.Layout\bin\Release\Perspex.Layout.dll $lib +Copy-Item ..\src\Perspex.Layout\bin\Release\Perspex.Layout.xml $lib +Copy-Item ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.dll $lib +Copy-Item ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.xml $lib +Copy-Item ..\src\Perspex.Styling\bin\Release\Perspex.Styling.dll $lib +Copy-Item ..\src\Perspex.Styling\bin\Release\Perspex.Styling.xml $lib +Copy-Item ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.dll $lib +Copy-Item ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.xml $lib +Copy-Item ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.dll $lib +Copy-Item ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.xml $lib +Copy-Item ..\src\Perspex.HtmlRenderer\bin\Release\Perspex.HtmlRenderer.dll $lib +Copy-Item ..\src\Perspex.ReactiveUI\bin\Release\Perspex.ReactiveUI.dll $lib + +Copy-Item ..\src\Windows\Perspex.Direct2D1\bin\Release\Perspex.Direct2D1.dll $build +Copy-Item ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.dll $build +Copy-Item ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.Direct2D1.dll $build +Copy-Item ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.DXGI.dll $build +Copy-Item ..\src\Windows\Perspex.Win32\bin\Release\Perspex.Win32.dll $build +Copy-Item ..\src\Gtk\Perspex.Gtk\bin\Release\Perspex.Gtk.dll $build +Copy-Item ..\src\Gtk\Perspex.Cairo\bin\Release\Perspex.Cairo.dll $build + +(gc Perspex\Perspex.nuspec).replace('#VERSION#', $args[0]) | sc Perspex\Perspex.nuspec + +nuget.exe pack Perspex\Perspex.nuspec +rm -Force -Recurse .\Perspex \ No newline at end of file diff --git a/nuget/build.bat b/nuget/build.bat deleted file mode 100644 index 8ef89045de..0000000000 --- a/nuget/build.bat +++ /dev/null @@ -1,39 +0,0 @@ -SET lib="Perspex\lib\portable-windows8+net45" -SET build="Perspex\build\net45" - -mkdir %lib% -mkdir %build% - -copy ..\src\Perspex.Animation\bin\Release\Perspex.Animation.dll %lib% -copy ..\src\Perspex.Animation\bin\Release\Perspex.Animation.xml %lib% -copy ..\src\Perspex.Application\bin\Release\Perspex.Application.dll %lib% -copy ..\src\Perspex.Application\bin\Release\Perspex.Application.xml %lib% -copy ..\src\Perspex.Base\bin\Release\Perspex.Base.dll %lib% -copy ..\src\Perspex.Base\bin\Release\Perspex.Base.xml %lib% -copy ..\src\Perspex.Controls\bin\Release\Perspex.Controls.dll %lib% -copy ..\src\Perspex.Controls\bin\Release\Perspex.Controls.xml %lib% -copy ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.dll %lib% -copy ..\src\Perspex.Diagnostics\bin\Release\\Perspex.Diagnostics.xml %lib% -copy ..\src\Perspex.Input\bin\Release\Perspex.Input.dll %lib% -copy ..\src\Perspex.Input\bin\Release\Perspex.Input.xml %lib% -copy ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.dll %lib% -copy ..\src\Perspex.Interactivity\bin\Release\Perspex.Interactivity.xml %lib% -copy ..\src\Perspex.Layout\bin\Release\Perspex.Layout.dll %lib% -copy ..\src\Perspex.Layout\bin\Release\Perspex.Layout.xml %lib% -copy ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.dll %lib% -copy ..\src\Perspex.SceneGraph\bin\Release\Perspex.SceneGraph.xml %lib% -copy ..\src\Perspex.Styling\bin\Release\Perspex.Styling.dll %lib% -copy ..\src\Perspex.Styling\bin\Release\Perspex.Styling.xml %lib% -copy ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.dll %lib% -copy ..\src\Perspex.Themes.Default\bin\Release\Perspex.Themes.Default.xml %lib% -copy ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.dll %lib% -copy ..\src\Markup\Perspex.Markup.Xaml\bin\Release\Perspex.Markup.Xaml.xml %lib% -copy ..\src\NGenerics\bin\Release\NGenerics.dll %lib% - -copy ..\src\Windows\Perspex.Direct2D1\bin\Release\Perspex.Direct2D1.dll %build% -copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.dll %build% -copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.Direct2D1.dll %build% -copy ..\src\Windows\Perspex.Direct2D1\bin\Release\SharpDX.DXGI.dll %build% -copy ..\src\Windows\Perspex.Win32\bin\Release\Perspex.Win32.dll %build% - -nuget.exe pack Perspex\Perspex.nuspec \ No newline at end of file diff --git a/nuget/build.ps1 b/nuget/build.ps1 new file mode 100644 index 0000000000..a26fe74706 --- /dev/null +++ b/nuget/build.ps1 @@ -0,0 +1 @@ +.\build-version.ps1 0.1.1-alpha2 \ No newline at end of file diff --git a/nuget/Perspex/Perspex.nuspec b/nuget/template/Perspex.nuspec similarity index 63% rename from nuget/Perspex/Perspex.nuspec rename to nuget/template/Perspex.nuspec index 432f210f05..45490d310e 100644 --- a/nuget/Perspex/Perspex.nuspec +++ b/nuget/template/Perspex.nuspec @@ -1,8 +1,8 @@ - + Perspex - 0.0.1-alpha + #VERSION# stevenk stevenk http://opensource.org/licenses/MIT @@ -13,12 +13,14 @@ Copyright 2015 Perspex - - - - + + + + + + \ No newline at end of file diff --git a/nuget/Perspex/build/net45/perspex.targets b/nuget/template/build/net45/perspex.targets similarity index 100% rename from nuget/Perspex/build/net45/perspex.targets rename to nuget/template/build/net45/perspex.targets diff --git a/readme.md b/readme.md index 03f69f235e..4a5d3556c7 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,16 @@ A multi-platform .NET UI framework. ![](docs/screen.png) +![](docs/perspex-video.png) + +## NuGet + +Perspex is delivered as a NuGet package. +You can find the packages here: ([stable(ish)](https://www.nuget.org/packages/Perspex/), [nightly](https://github.com/Perspex/Perspex/wiki/Using-nightly-build-feed)) + +You can install the package like this: +`Install-Package Perspex -Pre` + ## Background Perspex is a multi-platform windowing toolkit - somewhat like WPF - that is intended to be multi- @@ -17,7 +27,7 @@ using Direct2D and other operating systems using Gtk & Cairo. Perspex is now in alpha. What does "alpha mean? Well, it means that it's now at a stage where you can have a play and hopefully create simple applications. There's now a [Visual -Studio Extension](https://visualstudiogallery.msdn.microsoft.com/87db356c-cec9-4a07-b7db-a4ed8a921ac9) +Studio Extension](https://visualstudiogallery.msdn.microsoft.com/a4542e8a-b56c-4295-8df1-7e220178b873) containing project and item templates that will help you get started, and there's an initial complement of controls. There's still a lot missing, and you *will* find bugs, and the API *will* change, but this represents the first time @@ -26,8 +36,8 @@ framework. ## Documentation -As mentioned above, Perspex is still in alpha and as such there's not much documentation yet. You can -take a look at the [alpha release announcement](http://grokys.github.io/perspex/perspex-alpha/) for an +As mentioned above, Perspex is still in alpha and as such there's not much documentation yet. You can +take a look at the [getting started page](docs/gettingstarted.md) for an overview of how to get started but probably the best thing to do for now is to already know a little bit about WPF/Silverlight/UWP/XAML and ask questions in our [Gitter room](https://gitter.im/grokys/Perspex). diff --git a/samples/TestApplication/App.cs b/samples/TestApplication/App.cs index b56a87f190..6c3ae2f2b7 100644 --- a/samples/TestApplication/App.cs +++ b/samples/TestApplication/App.cs @@ -1,16 +1,20 @@ -namespace TestApplication -{ - using System; - using Perspex; - using Perspex.Themes.Default; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex; +using Perspex.Themes.Default; +namespace TestApplication +{ public class App : Application { public App() { - this.RegisterServices(); - this.InitializeSubsystems((int)Environment.OSVersion.Platform); - this.Styles = new DefaultTheme(); + RegisterServices(); + InitializeSubsystems((int)Environment.OSVersion.Platform); + Styles = new DefaultTheme(); + Styles.Add(new SampleTabStyle()); } } } diff --git a/samples/TestApplication/GalleryStyle.cs b/samples/TestApplication/GalleryStyle.cs new file mode 100644 index 0000000000..15cbb5749b --- /dev/null +++ b/samples/TestApplication/GalleryStyle.cs @@ -0,0 +1,123 @@ +using Perspex; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TestApplication +{ + internal class SampleTabStyle : Styles + { + public SampleTabStyle() + { + this.AddRange(new[] + { + new Style (s => s.Class(":container").OfType ()) + { + Setters = new[] + { + new Setter (TemplatedControl.TemplateProperty, new ControlTemplate (TabControlTemplate)) + } + }, + + new Style(s => s.Class(":container").OfType().Child().Child().Child().Child().Child().OfType()) + { + Setters = new[] + { + new Setter (TemplatedControl.TemplateProperty, new ControlTemplate (TabItemTemplate)), + } + }, + + new Style(s => s.Name("internalStrip").OfType().Child().OfType()) + { + Setters = new[] + { + new Setter(TemplatedControl.FontSizeProperty, 14.0), + new Setter(TemplatedControl.ForegroundProperty, Brushes.White) + } + }, + + new Style(s => s.Name("internalStrip").OfType().Child().OfType().Class("selected")) + { + Setters = new[] + { + new Setter(TemplatedControl.ForegroundProperty, Brushes.White), + new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(Colors.White) { Opacity = 0.1 }), + }, + }, + }); + } + + public static Control TabItemTemplate(TabItem control) + { + return new ContentPresenter + { + DataTemplates = new DataTemplates + { + new DataTemplate(x => new Border + { + [~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], + Padding = new Thickness(10), + Child = new TextBlock + { + VerticalAlignment = Perspex.Layout.VerticalAlignment.Center, + Text = x + } + }) + }, + Name = "headerPresenter", + [~ContentPresenter.ContentProperty] = control[~HeaderedContentControl.HeaderProperty], + }; + } + + public static Control TabControlTemplate(TabControl control) + { + return new Grid + { + ColumnDefinitions = new ColumnDefinitions + { + new ColumnDefinition(GridLength.Auto), + new ColumnDefinition(new GridLength(1, GridUnitType.Star)), + }, + Children = new Controls + { + new Border + { + Width = 190, + Background = SolidColorBrush.Parse("#1976D2"), + Child = new ScrollViewer + { + Content = new TabStrip + { + ItemsPanel = new FuncTemplate(() => new StackPanel { Orientation = Orientation.Vertical, Gap = 4 }), + Margin = new Thickness(0, 10, 0, 0), + Name = "internalStrip", + [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty], + [!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty], + } + } + }, + new Deck + { + Name = "deck", + DataTemplates = new DataTemplates + { + new DataTemplate(x => (Control)control.MaterializeDataTemplate(x.Content)), + }, + [~Deck.TransitionProperty] = control[~TabControl.TransitionProperty], + [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty], + [!SelectingItemsControl.SelectedItemProperty] = control[!SelectingItemsControl.SelectedItemProperty], + [Grid.ColumnProperty] = 1, + } + } + }; + } + } +} \ No newline at end of file diff --git a/samples/TestApplication/Item.cs b/samples/TestApplication/Item.cs new file mode 100644 index 0000000000..4898274686 --- /dev/null +++ b/samples/TestApplication/Item.cs @@ -0,0 +1,8 @@ +namespace TestApplication +{ + internal class Item + { + public string Name { get; set; } + public string Value { get; set; } + } +} diff --git a/samples/TestApplication/Node.cs b/samples/TestApplication/Node.cs new file mode 100644 index 0000000000..2856598ad6 --- /dev/null +++ b/samples/TestApplication/Node.cs @@ -0,0 +1,16 @@ +using Perspex.Collections; + +namespace TestApplication +{ + internal class Node + { + public Node() + { + Children = new PerspexList(); + } + + public string Name { get; set; } + public PerspexList Children { get; set; } + } + +} diff --git a/samples/TestApplication/Program.cs b/samples/TestApplication/Program.cs index 9eceafc90f..bfbb8a17ce 100644 --- a/samples/TestApplication/Program.cs +++ b/samples/TestApplication/Program.cs @@ -1,9 +1,15 @@ -using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using System.IO; using System.Reactive.Linq; using Perspex; using Perspex.Animation; using Perspex.Collections; using Perspex.Controls; +using Perspex.Controls.Html; using Perspex.Controls.Primitives; using Perspex.Controls.Shapes; using Perspex.Controls.Templates; @@ -18,26 +24,9 @@ using ReactiveUI; namespace TestApplication { - class Item - { - public string Name { get; set; } - public string Value { get; set; } - } - - class Node - { - public Node() - { - this.Children = new PerspexList(); - } - - public string Name { get; set; } - public PerspexList Children { get; set; } - } - - class Program + internal class Program { - private static PerspexList treeData = new PerspexList + private static readonly PerspexList s_treeData = new PerspexList { new Node { @@ -75,7 +64,7 @@ namespace TestApplication }, }; - private static PerspexList listBoxData = new PerspexList + private static readonly PerspexList s_listBoxData = new PerspexList { new Item { Name = "Item 1", Value = "Item 1 Value" }, new Item { Name = "Item 2", Value = "Item 2 Value" }, @@ -87,19 +76,13 @@ namespace TestApplication new Item { Name = "Item 8", Value = "Item 8 Value" }, }; - static void Main(string[] args) + private static void Main(string[] args) { - //Log.Logger = new LoggerConfiguration() - // .Filter.ByIncludingOnly(Matching.WithProperty("Area", "Layout")) - // .MinimumLevel.Verbose() - // .WriteTo.Trace(outputTemplate: "[{Id:X8}] [{SourceContext}] {Message}") - // .CreateLogger(); - // The version of ReactiveUI currently included is for WPF and so expects a WPF // dispatcher. This makes sure it's initialized. System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher; - App application = new App + new App { DataTemplates = new DataTemplates { @@ -110,15 +93,13 @@ namespace TestApplication }, }; - TextBlock fps; - - var testCommand = ReactiveCommand.Create(); - testCommand.Subscribe(_ => System.Diagnostics.Debug.WriteLine("Test command executed.")); + TabControl container; Window window = new Window { Title = "Perspex Test Application", - SizeToContent = SizeToContent.WidthAndHeight, + Width = 900, + Height = 480, Content = new Grid { ColumnDefinitions = new ColumnDefinitions @@ -134,125 +115,28 @@ namespace TestApplication }, Children = new Controls { - new Menu - { - Items = new[] - { - new MenuItem - { - Header = "_File", - Items = new[] - { - new MenuItem - { - Header = "_Open...", - Icon = new Image - { - Source = new Bitmap("github_icon.png"), - }, - }, - new MenuItem - { - Header = "_Save", - Items = new[] - { - new MenuItem - { - Header = "Sub Item _1", - }, - new MenuItem - { - Header = "Sub Item _2", - }, - } - }, - new MenuItem - { - Header = "Save _As", - Items = new[] - { - new MenuItem - { - Header = "Sub Item _1", - }, - new MenuItem - { - Header = "Sub Item _2", - }, - } - }, - new MenuItem - { - Header = "E_xit", - Command = testCommand, - }, - } - }, - new MenuItem - { - Header = "_Edit", - Items = new[] - { - new MenuItem - { - Header = "Cu_t", - }, - new MenuItem - { - Header = "_Copy", - }, - new MenuItem - { - Header = "_Paste", - }, - } - } - }, - [Grid.ColumnSpanProperty] = 2, - }, - new TabControl + (container = new TabControl { + Padding = new Thickness(5), Items = new[] { ButtonsTab(), TextTab(), - ImagesTab(), + HtmlTab(), + ImagesTab(), ListsTab(), LayoutTab(), AnimationsTab(), }, - Transition = new PageSlide(TimeSpan.FromSeconds(0.25)), + Transition = new CrossFade(TimeSpan.FromSeconds(0.25)), [Grid.RowProperty] = 1, [Grid.ColumnSpanProperty] = 2, - }, - (fps = new TextBlock - { - HorizontalAlignment = HorizontalAlignment.Left, - Margin = new Thickness(2), - [Grid.RowProperty] = 2, - }), - new TextBlock - { - Text = "Press F12 for Dev Tools", - HorizontalAlignment = HorizontalAlignment.Right, - Margin = new Thickness(2), - [Grid.ColumnProperty] = 1, - [Grid.RowProperty] = 2, - }, + }) } }, }; - DevTools.Attach(window); - - //var renderer = ((IRenderRoot)window).Renderer; - //var last = renderer.RenderCount; - //DispatcherTimer.Run(() => - //{ - // fps.Text = "FPS: " + (renderer.RenderCount - last); - // last = renderer.RenderCount; - // return true; - //}, TimeSpan.FromSeconds(1)); + container.Classes.Add(":container"); window.Show(); Application.Current.Run(window); @@ -260,295 +144,580 @@ namespace TestApplication private static TabItem ButtonsTab() { - Button defaultButton; - - var showDialog = ReactiveCommand.Create(); - Button showDialogButton; - var result = new TabItem { - Header = "Buttons", - Content = new StackPanel - { - Orientation = Orientation.Vertical, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Gap = 8, - MinWidth = 120, - Children = new Controls - { - (showDialogButton = new Button - { - Content = "Button", - Command = showDialog, - [ToolTip.TipProperty] = "Hello World!", - }), - new Button - { - Content = "Button", - Background = new SolidColorBrush(0xcc119eda), - [ToolTip.TipProperty] = "Goodbye Cruel World!", - }, - (defaultButton = new Button - { - Content = "Default", - IsDefault = true, - }), - new Button - { - Content = "Disabled", - IsEnabled = false, - }, - new Button - { - Content = "Disabled", - IsEnabled = false, - Background = new SolidColorBrush(0xcc119eda), - }, - new ToggleButton - { - Content = "Toggle", - }, - new ToggleButton - { - Content = "Disabled", - IsEnabled = false, - }, - new CheckBox - { - Content = "Checkbox", - }, - new RadioButton - { - Content = "RadioButton 1", - IsChecked = true, - }, - new RadioButton - { - Content = "RadioButton 2", - }, - } + Header = "Button", + Content = new ScrollViewer() + { + CanScrollHorizontally = false, + Content = new StackPanel + { + Margin = new Thickness(10), + Orientation = Orientation.Vertical, + Gap = 4, + Children = new Controls + { + new TextBlock + { + Text = "Button", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A button control", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new Button + { + Width = 150, + Content = "Button" + }, + new Button + { + Width = 150, + Content = "Disabled", + IsEnabled = false, + }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "ToggleButton", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A toggle button control", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new ToggleButton + { + Width = 150, + IsChecked = true, + Content = "On" + }, + new ToggleButton + { + Width = 150, + IsChecked = false, + Content = "Off" + }, + } + } }, }; - - defaultButton.Click += (s, e) => - { - defaultButton.Content = ((string)defaultButton.Content == "Default") ? "Clicked" : "Default"; - }; - - showDialog.Subscribe(async _ => - { - var close = ReactiveCommand.Create(); - - var dialog = new Window - { - Content = new StackPanel - { - Width = 200, - Height = 200, - Children = new Controls - { - new Button { Content = "Yes", Command = close, CommandParameter = "Yes" }, - new Button { Content = "No", Command = close, CommandParameter = "No" }, - } - } - }; - - close.Subscribe(x => dialog.Close(x)); - - showDialogButton.Content = await dialog.ShowDialog(); - }); + return result; } - private static TabItem TextTab() + private static TabItem HtmlTab() { return new TabItem { Header = "Text", - Content = new StackPanel - { - Orientation = Orientation.Vertical, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Gap = 8, - Width = 120, - Children = new Controls - { - new TextBlock - { - Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.", - TextWrapping = TextWrapping.Wrap, - TextAlignment = TextAlignment.Center, - }, - new TextBlock - { - Text = "Italic text.", - FontStyle = FontStyle.Italic, - TextAlignment = TextAlignment.Left, - }, - new TextBlock - { - Text = "Bold text.", - FontWeight = FontWeight.Bold, - TextAlignment = TextAlignment.Right, - }, - new TextBox - { - Text = "A non-wrapping text box. Lorem ipsum dolor sit amet.", - TextWrapping = TextWrapping.NoWrap, - }, - new TextBox - { - AcceptsReturn = true, - Text = "A wrapping text box. " + - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt. " + - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.", - TextWrapping = TextWrapping.Wrap, - MaxHeight = 100, - }, - } - }, + Content = new ScrollViewer() + { + CanScrollHorizontally = false, + Content = new StackPanel() + { + Margin = new Thickness(10), + Orientation = Orientation.Vertical, + Gap = 4, + Children = new Controls + { + new TextBlock + { + Text = "TextBlock", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A control for displaying text.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new TextBlock + { + Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", + FontSize = 11 + }, + new TextBlock + { + Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", + FontSize = 11, + FontWeight = FontWeight.Medium + }, + new TextBlock + { + Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", + FontSize = 11, + FontWeight = FontWeight.Bold + }, + new TextBlock + { + Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", + FontSize = 11, + FontStyle = FontStyle.Italic, + }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "HtmlLabel", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A label capable of displaying HTML content", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new HtmlLabel + { + Background = SolidColorBrush.Parse("#CCCCCC"), + Padding = new Thickness(5), + Text = @"

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

+

Header Level 2

+ +
    +
  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  2. +
  3. Aliquam tincidunt mauris eu risus.
  4. +
+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.

+ +

Header Level 3

+ +
    +
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • +
  • Aliquam tincidunt mauris eu risus.
  • +
" + } + } + } + } }; } - private static TabItem ImagesTab() + private static TabItem TextTab() { - ScrollBar size; - return new TabItem { - Header = "Images", - Content = new StackPanel - { - Orientation = Orientation.Vertical, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Gap = 8, - Children = new Controls - { - (size = new ScrollBar - { - Minimum = 100, - Maximum = 400, - Value = 100, - Orientation = Orientation.Horizontal, - }), - new ScrollViewer - { - Width = 200, - Height = 200, - CanScrollHorizontally = true, - Content = new Image - { - Source = new Bitmap("github_icon.png"), - [!Image.WidthProperty] = size[!ScrollBar.ValueProperty], - [!Image.HeightProperty] = size[!ScrollBar.ValueProperty], - }, - }, - new ProgressBar - { - [!ProgressBar.MinimumProperty] = size[!ScrollBar.MinimumProperty], - [!ProgressBar.MaximumProperty] = size[!ScrollBar.MaximumProperty], - [!ProgressBar.ValueProperty] = size[!ScrollBar.ValueProperty], - } - } - }, + Header = "Input", + Content = new ScrollViewer() + { + Content = new StackPanel + { + Margin = new Thickness(10), + Orientation = Orientation.Vertical, + Gap = 4, + Children = new Controls + { + new TextBlock + { + Text = "TextBox", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A text box control", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new TextBox { Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", Width = 200 }, + new TextBox { AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Width = 200, Height = 150, Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "CheckBox", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A check box control", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new CheckBox { IsChecked = true, Margin = new Thickness(0, 0, 0, 5), Content = "Checked" }, + new CheckBox { IsChecked = false, Content = "Unchecked" }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "RadioButton", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A radio button control", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new RadioButton { IsChecked = true, Content = "Option 1" }, + new RadioButton { IsChecked = false, Content = "Option 2" }, + new RadioButton { IsChecked = false, Content = "Option 3" }, + } + } + } }; } + private static TabItem ListsTab() { - ListBox listBox; - return new TabItem { Header = "Lists", - Content = new StackPanel - { - DataTemplates = new DataTemplates - { - new DataTemplate(x => - new StackPanel - { - Children = new Controls - { - new TextBlock { Text = x.Name, FontSize = 24 }, - new TextBlock { Text = x.Value }, - } - }) - }, - Orientation = Orientation.Horizontal, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Gap = 8, - Children = new Controls - { - new TreeView - { - Name = "treeView", - Items = treeData, - }, - (listBox = new ListBox - { - Items = listBoxData, - MaxHeight = 300, - }), - new DropDown - { - Items = listBoxData, - SelectedItem = listBoxData[0], - VerticalAlignment = VerticalAlignment.Center, - } - } - }, + Content = new ScrollViewer() + { + CanScrollHorizontally = false, + Content = new StackPanel + { + HorizontalAlignment = HorizontalAlignment.Left, + Orientation = Orientation.Vertical, + VerticalAlignment = VerticalAlignment.Top, + Gap = 4, + Margin = new Thickness(10), + DataTemplates = new DataTemplates + { + new DataTemplate(x => + new StackPanel + { + Gap = 4, + Orientation = Orientation.Horizontal, + Children = new Controls + { + new Image { Width = 50, Height = 50, Source = new Bitmap("github_icon.png") }, + new TextBlock { Text = x.Name, FontSize = 18 } + } + }) + }, + Children = new Controls + { + new TextBlock + { + Text = "ListBox", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A list box control.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new ListBox + { + BorderThickness = 2, + Items = s_listBoxData, + Height = 300, + Width = 300, + }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "TreeView", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A tree view control.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new TreeView + { + Name = "treeView", + Items = s_treeData, + Height = 300, + BorderThickness = 2, + Width = 300, + } + } + }, + } }; } + private static TabItem ImagesTab() + { + var imageDeck = new Deck + { + Width = 400, + Height = 400, + Transition = new PageSlide(TimeSpan.FromSeconds(0.25)), + Items = new[] + { + new Image { Source = new Bitmap("github_icon.png"), Width = 400, Height = 400 }, + new Image { Source = new Bitmap("pattern.jpg"), Width = 400, Height = 400 }, + } + }; + + imageDeck.AutoSelect = true; + + var next = new Button + { + VerticalAlignment = VerticalAlignment.Center, + Padding = new Thickness(20), + Content = new Perspex.Controls.Shapes.Path + { + Data = StreamGeometry.Parse("M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"), + Fill = Brushes.Black + } + }; + + var prev = new Button + { + VerticalAlignment = VerticalAlignment.Center, + Padding = new Thickness(20), + Content = new Perspex.Controls.Shapes.Path + { + Data = StreamGeometry.Parse("M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"), + Fill = Brushes.Black + } + }; + + prev.Click += (s, e) => + { + if (imageDeck.SelectedIndex == 0) + imageDeck.SelectedIndex = 1; + else + imageDeck.SelectedIndex--; + }; + + next.Click += (s, e) => + { + if (imageDeck.SelectedIndex == 1) + imageDeck.SelectedIndex = 0; + else + imageDeck.SelectedIndex++; + }; + + return new TabItem + { + Header = "Images", + Content = new ScrollViewer + { + Content = new StackPanel + { + HorizontalAlignment = HorizontalAlignment.Left, + Orientation = Orientation.Vertical, + VerticalAlignment = VerticalAlignment.Top, + Gap = 4, + Margin = new Thickness(10), + Children = new Controls + { + new TextBlock + { + Text = "Deck", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "An items control that displays its items as pages that fill the controls.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new StackPanel + { + Name = "deckVisual", + Orientation = Orientation.Horizontal, + Gap = 4, + Children = new Controls + { + prev, + imageDeck, + next + } + } + } + } + } + }; + } + private static TabItem LayoutTab() { return new TabItem { Header = "Layout", - Content = new Grid - { - ColumnDefinitions = new ColumnDefinitions - { - new ColumnDefinition(1, GridUnitType.Star), - new ColumnDefinition(1, GridUnitType.Star), - }, - Margin = new Thickness(50), - Children = new Controls - { - new StackPanel - { - Orientation = Orientation.Vertical, - Gap = 8, - Children = new Controls + Content = new ScrollViewer + { + Content = new StackPanel + { + HorizontalAlignment = HorizontalAlignment.Left, + Orientation = Orientation.Vertical, + VerticalAlignment = VerticalAlignment.Top, + Gap = 4, + Margin = new Thickness(10), + Children = new Controls + { + new TextBlock + { + Text = "Grid", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "Lays out child controls according to a grid.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new Grid + { + Width = 600, + ColumnDefinitions = new ColumnDefinitions + { + new ColumnDefinition(1, GridUnitType.Star), + new ColumnDefinition(1, GridUnitType.Star), + }, + + RowDefinitions = new RowDefinitions + { + new RowDefinition(1, GridUnitType.Auto), + new RowDefinition(1, GridUnitType.Auto) + }, + Children = new Controls + { + + new Rectangle + { + Fill = SolidColorBrush.Parse("#FF5722"), + [Grid.ColumnSpanProperty] = 2, + Height = 200, + Margin = new Thickness(2.5) + }, + new Rectangle + { + Fill = SolidColorBrush.Parse("#FF5722"), + [Grid.RowProperty] = 1, + Height = 100, + Margin = new Thickness(2.5) + }, + new Rectangle + { + Fill = SolidColorBrush.Parse("#FF5722"), + [Grid.RowProperty] = 1, + [Grid.ColumnProperty] = 1, + Height = 100, + Margin = new Thickness(2.5) + }, + }, + }, + new TextBlock + { + Margin = new Thickness(0, 40, 0, 0), + Text = "StackPanel", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A panel which lays out its children horizontally or vertically.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + new StackPanel + { + Orientation = Orientation.Vertical, + Gap = 4, + Width = 300, + Children = new Controls + { + new Rectangle + { + Fill = SolidColorBrush.Parse("#FFC107"), + Height = 50, + }, + new Rectangle + { + Fill = SolidColorBrush.Parse("#FFC107"), + Height = 50, + }, + new Rectangle + { + Fill = SolidColorBrush.Parse("#FFC107"), + Height = 50, + }, + } + }, + new TextBlock { - new Button { HorizontalAlignment = HorizontalAlignment.Left, Content = "Left Aligned" }, - new Button { HorizontalAlignment = HorizontalAlignment.Center, Content = "Center Aligned" }, - new Button { HorizontalAlignment = HorizontalAlignment.Right, Content = "Right Aligned" }, - new Button { HorizontalAlignment = HorizontalAlignment.Stretch, Content = "Stretch" }, + Margin = new Thickness(0, 40, 0, 0), + Text = "Canvas", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), }, - [Grid.ColumnProperty] = 0, - }, - new StackPanel - { - Orientation = Orientation.Horizontal, - Gap = 8, - Children = new Controls + new TextBlock { - new Button { VerticalAlignment = VerticalAlignment.Top, Content = "Top Aligned" }, - new Button { VerticalAlignment = VerticalAlignment.Center, Content = "Center Aligned" }, - new Button { VerticalAlignment = VerticalAlignment.Bottom, Content = "Bottom Aligned" }, - new Button { VerticalAlignment = VerticalAlignment.Stretch, Content = "Stretch" }, + Text = "A panel which lays out its children by explicit coordinates.", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) }, - [Grid.ColumnProperty] = 1, - }, - }, - } + new Canvas + { + Background = Brushes.Yellow, + Width = 300, + Height = 400, + Children = new Controls + { + new Rectangle + { + Fill = Brushes.Blue, + Width = 63, + Height = 41, + [Canvas.LeftProperty] = 40, + [Canvas.TopProperty] = 31, + }, + new Ellipse + { + Fill = Brushes.Green, + Width = 58, + Height = 58, + [Canvas.LeftProperty] = 130, + [Canvas.TopProperty] = 79, + }, + } + }, + } + } + } }; } @@ -562,70 +731,88 @@ namespace TestApplication var result = new TabItem { Header = "Animations", - Content = new Grid + Content = new StackPanel { - ColumnDefinitions = new ColumnDefinitions - { - new ColumnDefinition(1, GridUnitType.Star), - new ColumnDefinition(1, GridUnitType.Star), - }, - RowDefinitions = new RowDefinitions - { - new RowDefinition(1, GridUnitType.Star), - new RowDefinition(GridLength.Auto), - }, + HorizontalAlignment = HorizontalAlignment.Left, + Orientation = Orientation.Vertical, + VerticalAlignment = VerticalAlignment.Top, + Gap = 4, + Margin = new Thickness(10), Children = new Controls { - (border1 = new Border - { - Width = 100, - Height = 100, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Background = Brushes.Crimson, - RenderTransform = new RotateTransform(), - Child = new TextBox - { - Background = Brushes.White, - Text = "Hello!", - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - }, - }), - (border2 = new Border - { - Width = 100, - Height = 100, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - Background = Brushes.Coral, - Child = new Image - { - Source = new Bitmap("github_icon.png"), - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - }, - RenderTransform = (rotate = new RotateTransform - { - PropertyTransitions = new PropertyTransitions - { - RotateTransform.AngleProperty.Transition(500), - } - }), - PropertyTransitions = new PropertyTransitions - { - Rectangle.WidthProperty.Transition(300), - Rectangle.HeightProperty.Transition(1000), - }, - [Grid.ColumnProperty] = 1, - }), - (button1 = new Button - { - HorizontalAlignment = HorizontalAlignment.Center, - Content = "Animate", - [Grid.ColumnProperty] = 1, - [Grid.RowProperty] = 1, - }), + new TextBlock + { + Text = "Animations", + FontWeight = FontWeight.Medium, + FontSize = 20, + Foreground = SolidColorBrush.Parse("#212121"), + }, + new TextBlock + { + Text = "A few animations showcased below", + FontSize = 13, + Foreground = SolidColorBrush.Parse("#727272"), + Margin = new Thickness(0, 0, 0, 10) + }, + (button1 = new Button + { + Content = "Animate", + Width = 120, + [Grid.ColumnProperty] = 1, + [Grid.RowProperty] = 1, + }), + new Canvas + { + Children = new Controls + { + (border1 = new Border + { + Width = 100, + Height = 100, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Background = Brushes.Crimson, + RenderTransform = new RotateTransform(), + Child = new TextBox + { + Background = Brushes.White, + Text = "Hello!", + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + }, + [Canvas.LeftProperty] = 100, + [Canvas.TopProperty] = 100, + }), + (border2 = new Border + { + Width = 100, + Height = 100, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Background = Brushes.Coral, + Child = new Image + { + Source = new Bitmap("github_icon.png"), + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + }, + RenderTransform = (rotate = new RotateTransform + { + PropertyTransitions = new PropertyTransitions + { + RotateTransform.AngleProperty.Transition(500), + } + }), + PropertyTransitions = new PropertyTransitions + { + Layoutable.WidthProperty.Transition(300), + Layoutable.HeightProperty.Transition(1000), + }, + [Canvas.LeftProperty] = 400, + [Canvas.TopProperty] = 100, + }), + } + } }, }, }; diff --git a/samples/TestApplication/Properties/AssemblyInfo.cs b/samples/TestApplication/Properties/AssemblyInfo.cs index 5e8029017d..4560d26d17 100644 --- a/samples/TestApplication/Properties/AssemblyInfo.cs +++ b/samples/TestApplication/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,7 +13,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestApplication")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright \u00A9 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/samples/TestApplication/TestApplication.csproj b/samples/TestApplication/TestApplication.csproj index 1a3a6287fc..4ccecb2cd0 100644 --- a/samples/TestApplication/TestApplication.csproj +++ b/samples/TestApplication/TestApplication.csproj @@ -35,18 +35,6 @@ 4 - - ..\..\packages\Serilog.1.5.9\lib\net45\Serilog.dll - True - - - ..\..\packages\Serilog.1.5.9\lib\net45\Serilog.FullNetFx.dll - True - - - ..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll - True - @@ -72,9 +60,21 @@ ..\..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll + + ..\..\packages\Serilog.1.5.9\lib\net45\Serilog.dll + + + ..\..\packages\Serilog.1.5.9\lib\net45\Serilog.FullNetFx.dll + + + ..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll + + + + @@ -83,8 +83,12 @@ + + {FB05AC90-89BA-4F2F-A924-F37875FB547C} + Perspex.Cairo + - {d211e587-d8bc-45b9-95a4-f297c8fa5200} + {D211E587-D8BC-45B9-95A4-F297C8FA5200} Perspex.Animation @@ -103,6 +107,10 @@ {7062AE20-5DCC-4442-9645-8195BDECE63E} Perspex.Diagnostics + + {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D} + Perspex.HtmlRenderer + {62024B2D-53EB-4638-B26B-85EEAA54866E} Perspex.Input @@ -132,11 +140,11 @@ Perspex.Themes.Default - {3e908f67-5543-4879-a1dc-08eace79b3cd} + {3E908F67-5543-4879-A1DC-08EACE79B3CD} Perspex.Direct2D1 - {811a76cf-1cf6-440f-963b-bbe31bd72a82} + {811A76CF-1CF6-440F-963B-BBE31BD72A82} Perspex.Win32 @@ -144,6 +152,10 @@ PreserveNewest + + + PreserveNewest + diff --git a/samples/TestApplication/html.htm b/samples/TestApplication/html.htm new file mode 100644 index 0000000000..85da0cdb87 --- /dev/null +++ b/samples/TestApplication/html.htm @@ -0,0 +1,128 @@ + + + Intro + + + +

+ HTML Renderer Project - Perspex port +
+ Beta support +

+
+

+ + +
  • Lightweight (~300K).
  • +
  • High performance and low memory footprint.
  • +
  • Extendable and configurable.
  • + +

    + Limitations +

    +
      +
    • All HTML end tags marked as + optional should be there. No problem with tags marked as forbidden.
    • +
    +
    +

    + On the roadmap

    + Of course it's not quite finished yet. Here are some of the important things to + do. +
      +
    • Better performance
    • +
    • Support of position CSS property
    • +
    • Support of height and min-height CSS property
    • +
    • Better tables support, especially layouts
    • +
    • Support image align
    • +
    • Handle :hover selector
    • +
    • Selection by shift+arrows
    • +
    • Better HTML tag parsing (optional closing tags)
    • +
    • More styles support
    • +
    +

    + Vision +

    +
      +
    • Most complete static HTML Renderer (no java script).
    • +
    • Commercial web browser performance level.
    • +
    +
    +

    + 2015 - Nikita Tsukanov (Perspex Port) + +

    +
    + https://perspex.github.io/ +
    + +

    + 2012 - Arthur Teplitzki +

    +
    + http://TheArtOfDev.com +
    +

    + 2009 - Jose Manuel Menendez Poo +

    +
    + www.menendezpoo.com +
    + + + \ No newline at end of file diff --git a/samples/TestApplication/pattern.jpg b/samples/TestApplication/pattern.jpg new file mode 100644 index 0000000000..72b35e0692 Binary files /dev/null and b/samples/TestApplication/pattern.jpg differ diff --git a/samples/XamlTestApplication/App.config b/samples/XamlTestApplication/App.config index bfc5697e01..5ce331f23a 100644 --- a/samples/XamlTestApplication/App.config +++ b/samples/XamlTestApplication/App.config @@ -1,7 +1,7 @@ - + diff --git a/samples/XamlTestApplication/App.cs b/samples/XamlTestApplication/App.cs index 4762a4892e..d0c6f59040 100644 --- a/samples/XamlTestApplication/App.cs +++ b/samples/XamlTestApplication/App.cs @@ -1,16 +1,19 @@ -namespace XamlTestApplication -{ - using System; - using Perspex; - using Perspex.Themes.Default; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex; +using Perspex.Themes.Default; +namespace XamlTestApplication +{ public class App : Application { public App() { - this.RegisterServices(); - this.InitializeSubsystems((int)Environment.OSVersion.Platform); - this.Styles = new DefaultTheme(); + RegisterServices(); + InitializeSubsystems((int)Environment.OSVersion.Platform); + Styles = new DefaultTheme(); } } } diff --git a/samples/XamlTestApplication/MainViewModel.cs b/samples/XamlTestApplication/MainViewModel.cs index 57db4848c1..450c8f422f 100644 --- a/samples/XamlTestApplication/MainViewModel.cs +++ b/samples/XamlTestApplication/MainViewModel.cs @@ -1,15 +1,18 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using ReactiveUI; + namespace XamlTestApplication { - using System.Collections.Generic; - using ReactiveUI; - public class MainViewModel : ReactiveObject { - private string name; + private string _name; public MainViewModel() { - Name = "Jos Manuel"; + Name = "Jos\u00E9 Manuel"; People = new List { new Person("a little bit of Monica in my life"), @@ -24,8 +27,8 @@ namespace XamlTestApplication public string Name { - get { return name; } - set { this.RaiseAndSetIfChanged(ref name, value); } + get { return _name; } + set { this.RaiseAndSetIfChanged(ref _name, value); } } public List People { get; set; } @@ -33,17 +36,17 @@ namespace XamlTestApplication public class Person { - private string name; + private string _name; public Person(string name) { - this.name = name; + _name = name; } public string Name { - get { return name; } - set { name = value; } + get { return _name; } + set { _name = value; } } } } \ No newline at end of file diff --git a/samples/XamlTestApplication/Program.cs b/samples/XamlTestApplication/Program.cs index e24f228086..d115b67809 100644 --- a/samples/XamlTestApplication/Program.cs +++ b/samples/XamlTestApplication/Program.cs @@ -1,35 +1,38 @@ -namespace XamlTestApplication +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Diagnostics; +using System.Windows.Threading; +using Perspex; +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Controls.Templates; +using ReactiveUI; +using XamlTestApplication.Views; + +namespace XamlTestApplication { - using System; - using System.Diagnostics; - using System.Windows.Threading; - using Perspex; - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Controls.Templates; - using ReactiveUI; - using Views; - - class Item + internal class Item { public string Name { get; set; } public string Value { get; set; } } - class Node + internal class Node { public Node() { - this.Children = new PerspexList(); + Children = new PerspexList(); } public string Name { get; set; } public PerspexList Children { get; set; } } - class Program + internal class Program { - static void Main() + private static void Main() { var foo = Dispatcher.CurrentDispatcher; @@ -46,10 +49,10 @@ var testCommand = ReactiveCommand.Create(); testCommand.Subscribe(_ => Debug.WriteLine("Test command executed.")); - + var window = new MainWindow(); window.Show(); Application.Current.Run(window); - } + } } } diff --git a/samples/XamlTestApplication/Properties/AssemblyInfo.cs b/samples/XamlTestApplication/Properties/AssemblyInfo.cs index 5e8029017d..4560d26d17 100644 --- a/samples/XamlTestApplication/Properties/AssemblyInfo.cs +++ b/samples/XamlTestApplication/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,7 +13,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestApplication")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright \u00A9 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/samples/XamlTestApplication/Views/MainWindow.cs b/samples/XamlTestApplication/Views/MainWindow.cs index 18760d9601..dc218641bf 100644 --- a/samples/XamlTestApplication/Views/MainWindow.cs +++ b/samples/XamlTestApplication/Views/MainWindow.cs @@ -1,20 +1,23 @@ -namespace XamlTestApplication.Views -{ - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - using System.Resources; - using OmniXaml; - using Perspex.Controls; - using Perspex.Diagnostics; - using Perspex.Markup.Xaml; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Resources; +using OmniXaml; +using Perspex.Controls; +using Perspex.Diagnostics; +using Perspex.Markup.Xaml; +namespace XamlTestApplication.Views +{ public class MainWindow : Window { public MainWindow() { - this.InitializeComponent(); + InitializeComponent(); DevTools.Attach(this); } diff --git a/samples/XamlTestApplication/Views/MainWindow.xaml b/samples/XamlTestApplication/Views/MainWindow.paml similarity index 84% rename from samples/XamlTestApplication/Views/MainWindow.xaml rename to samples/XamlTestApplication/Views/MainWindow.paml index 3294edb8b0..2c4525eb13 100644 --- a/samples/XamlTestApplication/Views/MainWindow.xaml +++ b/samples/XamlTestApplication/Views/MainWindow.paml @@ -1,19 +1,21 @@  - - - - - + Title="Perspex Test Application" Height="350" Width="525" SizeToContent="WidthAndHeight" > + + + + +