Browse Source

Everything compiling now.

But not working, obviously.
pull/4/head
Steven Kirk 12 years ago
parent
commit
3f24d2f6ef
  1. 6
      Perspex.Application/Application.cs
  2. 15
      Perspex.Application/ICloseable.cs
  3. 3
      Perspex.Application/Perspex.Application.csproj
  4. 49
      Perspex.Controls.UnitTests/ContentControlTests.cs
  5. 38
      Perspex.Controls/Control.cs
  6. 8
      Perspex.Controls/ControlExtensions.cs
  7. 3
      Perspex.Controls/IGlobalDataTemplates.cs
  8. 19
      Perspex.Controls/TemplatedControl.cs
  9. 30
      Perspex.Direct2D1.RenderTests/Perspex.Direct2D1.RenderTests.csproj
  10. 2
      Perspex.Direct2D1.RenderTests/Shapes/PathTests.cs
  11. 2
      Perspex.Direct2D1.RenderTests/Shapes/RectangleTests.cs
  12. 5
      Perspex.Direct2D1/Media/DrawingContext.cs
  13. 14
      Perspex.Direct2D1/Perspex.Direct2D1.csproj
  14. 2
      Perspex.Direct2D1/Renderer.cs
  15. 1
      Perspex.Input/Perspex.Input.csproj
  16. 4
      Perspex.SceneGraph/Media/Imaging/IBitmap.cs
  17. 1
      Perspex.Styling.UnitTests/Perspex.Styling.UnitTests.csproj
  18. 83
      Perspex.Styling.UnitTests/SelectorTests_Descendent.cs
  19. 29
      Perspex.Styling.UnitTests/TestLogical.cs
  20. 5
      Perspex.Styling/IGlobalStyles.cs
  21. 17
      Perspex.Styling/ILogical.cs
  22. 3
      Perspex.Styling/Perspex.Styling.csproj
  23. 5
      Perspex.Styling/Selectors.cs
  24. 4
      Perspex.Styling/Styler.cs
  25. 34
      Perspex.Windows/Perspex.Windows.csproj
  26. 2
      Perspex.Windows/Window.cs
  27. 6
      Perspex.sln
  28. 2
      TestApplication/App.cs
  29. 26
      TestApplication/Program.cs
  30. 40
      TestApplication/TestApplication.csproj

6
Perspex.Application/Application.cs

@ -13,7 +13,7 @@ namespace Perspex
using Perspex.Threading;
using Splat;
public class Application
public class Application : IGlobalDataTemplates, IGlobalStyles
{
private DataTemplates dataTemplates;
@ -77,8 +77,8 @@ namespace Perspex
protected virtual void RegisterServices()
{
Locator.CurrentMutable.Register(() => this.DataTemplates, typeof(IGlobalDataTemplates));
Locator.CurrentMutable.Register(() => this.Styles, typeof(IGlobalStyle));
Locator.CurrentMutable.Register(() => this, typeof(IGlobalDataTemplates));
Locator.CurrentMutable.Register(() => this, typeof(IGlobalStyles));
Locator.CurrentMutable.Register(() => this.FocusManager, typeof(IFocusManager));
Locator.CurrentMutable.Register(() => this.InputManager, typeof(IInputManager));
Locator.CurrentMutable.Register(() => this.styler, typeof(IStyler));

15
Perspex.Application/ICloseable.cs

@ -1,15 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="ICloseable.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex
{
using System;
public interface ICloseable
{
event EventHandler Closed;
}
}

3
Perspex.Application/Perspex.Application.csproj

@ -86,9 +86,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\StyleCop.MSBuild.4.7.49.0\build\StyleCop.MSBuild.Targets" Condition="Exists('..\packages\StyleCop.MSBuild.4.7.49.0\build\StyleCop.MSBuild.Targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

49
Perspex.Controls.UnitTests/ContentControlTests.cs

@ -6,6 +6,7 @@
namespace Perspex.Controls.UnitTests
{
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@ -58,51 +59,55 @@ namespace Perspex.Controls.UnitTests
[TestMethod]
public void Setting_Content_To_Control_Should_Set_Parent()
{
var target = new ContentControl();
var child = new Border();
throw new NotImplementedException();
////var target = new ContentControl();
////var child = new Border();
target.Content = child;
////target.Content = child;
Assert.AreEqual(child.Parent, target);
Assert.AreEqual(((IVisual)child).VisualParent, target);
Assert.AreEqual(((ILogical)child).LogicalParent, target);
////Assert.AreEqual(child.Parent, target);
////Assert.AreEqual(((IVisual)child).VisualParent, target);
////Assert.AreEqual(((ILogical)child).LogicalParent, target);
}
[TestMethod]
public void Setting_Content_To_Control_Should_Set_Logical_Child()
{
var target = new ContentControl();
var child = new Border();
throw new NotImplementedException();
////var target = new ContentControl();
////var child = new Border();
target.Content = child;
////target.Content = child;
Assert.AreEqual(child, ((ILogical)target).LogicalChildren.Single());
////Assert.AreEqual(child, ((ILogical)target).LogicalChildren.Single());
}
[TestMethod]
public void Removing_Control_From_Content_Should_Clear_Parent()
{
var target = new ContentControl();
var child = new Border();
throw new NotImplementedException();
////var target = new ContentControl();
////var child = new Border();
target.Content = child;
target.Content = "foo";
////target.Content = child;
////target.Content = "foo";
Assert.IsNull(child.Parent);
Assert.IsNull(((IVisual)child).VisualParent);
Assert.IsNull(((ILogical)child).LogicalParent);
////Assert.IsNull(child.Parent);
////Assert.IsNull(((IVisual)child).VisualParent);
////Assert.IsNull(((ILogical)child).LogicalParent);
}
[TestMethod]
public void Removing_Control_From_Content_Should_Clear_Logical_Child()
{
var target = new ContentControl();
var child = new Border();
throw new NotImplementedException();
////var target = new ContentControl();
////var child = new Border();
target.Content = child;
target.Content = "foo";
////target.Content = child;
////target.Content = "foo";
Assert.IsFalse(((ILogical)target).LogicalChildren.Any());
////Assert.IsFalse(((ILogical)target).LogicalChildren.Any());
}
[TestMethod]

38
Perspex.Controls/Control.cs

@ -16,7 +16,7 @@ namespace Perspex.Controls
using Perspex.Styling;
using Splat;
public class Control : InputElement, ILogical, IStyleable, IStyleHost
public class Control : InputElement, IStyleable, IStyleHost
{
public static readonly PerspexProperty<Brush> BackgroundProperty =
PerspexProperty.Register<Control, Brush>("Background", inherits: true);
@ -180,17 +180,6 @@ namespace Perspex.Controls
internal set { this.SetValue(TemplatedParentProperty, value); }
}
ILogical ILogical.LogicalParent
{
get { return this.Parent; }
set { this.Parent = (Control)value; }
}
IEnumerable<ILogical> ILogical.LogicalChildren
{
get { return Enumerable.Empty<ILogical>(); }
}
protected override void OnAttachedToVisualTree(IRenderRoot root)
{
IStyler styler = Locator.Current.GetService<IStyler>();
@ -221,36 +210,23 @@ namespace Perspex.Controls
return new DataTemplate(x => control);
}
ILogical node = this;
while (node != null)
// TODO: This needs to traverse the logical tree, not the visual.
foreach (var i in this.GetVisualAncestors().OfType<Control>())
{
control = node as Control;
if (control != null)
foreach (DataTemplate dt in control.DataTemplates.Reverse())
{
foreach (DataTemplate dt in control.DataTemplates.Reverse())
if (dt.Match(content))
{
if (dt.Match(content))
{
return dt;
}
return dt;
}
}
node = node.LogicalParent;
if (node == null && control != null)
{
node = control.TemplatedParent as ILogical;
}
}
IGlobalDataTemplates global = Locator.Current.GetService<IGlobalDataTemplates>();
if (global != null)
{
foreach (DataTemplate dt in global.Reverse())
foreach (DataTemplate dt in global.DataTemplates.Reverse())
{
if (dt.Match(content))
{

8
Perspex.Controls/ControlExtensions.cs

@ -14,6 +14,14 @@ namespace Perspex.Controls
public static class ControlExtensions
{
// TODO: This needs to traverse the logical tree, not the visual.
public static T FindControl<T>(this Control control, string id) where T : Control
{
return control.GetVisualDescendents()
.OfType<T>()
.FirstOrDefault(x => x.Id == id);
}
public static IEnumerable<Control> GetTemplateControls(this ITemplatedControl control)
{
return GetTemplateControls(control, (IVisual)control);

3
Perspex.Controls/IGlobalDataTemplates.cs

@ -8,7 +8,8 @@ namespace Perspex.Controls
{
using System.Collections.Generic;
public interface IGlobalDataTemplates : IEnumerable<DataTemplate>
public interface IGlobalDataTemplates
{
DataTemplates DataTemplates { get; }
}
}

19
Perspex.Controls/TemplatedControl.cs

@ -58,13 +58,20 @@ namespace Perspex.Controls
protected override IEnumerable<Visual> CreateVisualChildren()
{
this.Log().Debug(string.Format(
"Creating template for {0} (#{1:x8})",
this.GetType().Name,
this.GetHashCode()));
if (this.Template != null)
{
this.Log().Debug(string.Format(
"Creating template for {0} (#{1:x8})",
this.GetType().Name,
this.GetHashCode()));
var child = this.Template.Build(this);
return Enumerable.Repeat(child, 1);
var child = this.Template.Build(this);
return Enumerable.Repeat(child, 1);
}
else
{
return Enumerable.Empty<Visual>();
}
}
protected virtual void OnTemplateApplied()

30
Perspex.Direct2D1.RenderTests/Perspex.Direct2D1.RenderTests.csproj

@ -66,13 +66,37 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Controls\Perspex.Controls.csproj">
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project>
<Name>Perspex.Controls</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Direct2D1\Perspex.Direct2D1.csproj">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Perspex.Direct2D1</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex\Perspex.csproj">
<Project>{3c9f40da-d2a5-43a1-a272-e965876c6d46}</Project>
<Name>Perspex</Name>
<ProjectReference Include="..\Perspex.Input\Perspex.Input.csproj">
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
<Name>Perspex.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Interactivity\Perspex.Interactivity.csproj">
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
<Name>Perspex.Interactivity</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Layout\Perspex.Layout.csproj">
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Perspex.Layout</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.SceneGraph\Perspex.SceneGraph.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Perspex.SceneGraph</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Styling\Perspex.Styling.csproj">
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
<Name>Perspex.Styling</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

2
Perspex.Direct2D1.RenderTests/Shapes/PathTests.cs

@ -10,7 +10,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
using Perspex.Controls;
using Perspex.Layout;
using Perspex.Media;
using Perspex.Shapes;
using Perspex.Controls.Shapes;
[TestClass]
public class PathTests : TestBase

2
Perspex.Direct2D1.RenderTests/Shapes/RectangleTests.cs

@ -9,7 +9,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Perspex.Controls;
using Perspex.Media;
using Perspex.Shapes;
using Perspex.Controls.Shapes;
[TestClass]
public class RectangleTests : TestBase

5
Perspex.Direct2D1/Media/DrawingContext.cs

@ -12,7 +12,8 @@ namespace Perspex.Direct2D1.Media
using Perspex.Media;
using SharpDX;
using SharpDX.Direct2D1;
using Matrix = Perspex.Media.Matrix;
using IBitmap = Perspex.Media.Imaging.IBitmap;
using Matrix = Perspex.Matrix;
/// <summary>
/// Draws using Direct2D1.
@ -57,7 +58,7 @@ namespace Perspex.Direct2D1.Media
this.renderTarget.EndDraw();
}
public void DrawImage(Perspex.Media.Imaging.Bitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
{
BitmapImpl impl = (BitmapImpl)bitmap.PlatformImpl;
Bitmap d2d = impl.GetDirect2DBitmap(this.renderTarget);

14
Perspex.Direct2D1/Perspex.Direct2D1.csproj

@ -76,13 +76,17 @@
<Compile Include="TextService.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Perspex\Perspex.csproj">
<Project>{3c9f40da-d2a5-43a1-a272-e965876c6d46}</Project>
<Name>Perspex</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.SceneGraph\Perspex.SceneGraph.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Perspex.SceneGraph</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

2
Perspex.Direct2D1/Renderer.cs

@ -15,7 +15,7 @@ namespace Perspex.Direct2D1
using SharpDX.Direct2D1;
using Splat;
using DwFactory = SharpDX.DirectWrite.Factory;
using Matrix = Perspex.Media.Matrix;
using Matrix = Perspex.Matrix;
using Point = Perspex.Point;
/// <summary>

1
Perspex.Input/Perspex.Input.csproj

@ -54,6 +54,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="FocusManager.cs" />
<Compile Include="ICloseable.cs" />
<Compile Include="IFocusManager.cs" />
<Compile Include="IInputDevice.cs" />
<Compile Include="IInputElement.cs" />

4
Perspex.SceneGraph/Media/Imaging/IBitmap.cs

@ -6,12 +6,16 @@
namespace Perspex.Media.Imaging
{
using Perspex.Platform;
public interface IBitmap
{
int PixelWidth { get; }
int PixelHeight { get; }
IBitmapImpl PlatformImpl { get; }
void Save(string fileName);
}
}

1
Perspex.Styling.UnitTests/Perspex.Styling.UnitTests.csproj

@ -75,7 +75,6 @@
<Compile Include="StyleActivatorTests.cs" />
<Compile Include="StyleTests.cs" />
<Compile Include="TestControlBase.cs" />
<Compile Include="TestLogical.cs" />
<Compile Include="TestObservable.cs" />
<Compile Include="TestObserver.cs" />
<Compile Include="TestSelectors.cs" />

83
Perspex.Styling.UnitTests/SelectorTests_Descendent.cs

@ -6,6 +6,7 @@
namespace Perspex.Styling.UnitTests
{
using System;
using System.Linq;
using System.Reactive.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -18,63 +19,67 @@ namespace Perspex.Styling.UnitTests
[TestMethod]
public void Descendent_Matches_Control_When_It_Is_Child_OfType()
{
var parent = new Mock<TestLogical1>();
var child = new Mock<TestLogical2>();
throw new NotImplementedException();
////var parent = new Mock<TestLogical1>();
////var child = new Mock<TestLogical2>();
child.Setup(x => x.LogicalParent).Returns(parent.Object);
////child.Setup(x => x.LogicalParent).Returns(parent.Object);
var selector = new Selector().OfType(parent.Object.GetType()).Descendent().OfType(child.Object.GetType());
////var selector = new Selector().OfType(parent.Object.GetType()).Descendent().OfType(child.Object.GetType());
Assert.IsTrue(ActivatorValue(selector, child.Object));
////Assert.IsTrue(ActivatorValue(selector, child.Object));
}
[TestMethod]
public void Descendent_Matches_Control_When_It_Is_Descendent_OfType()
{
var grandparent = new Mock<TestLogical1>();
var parent = new Mock<TestLogical2>();
var child = new Mock<TestLogical3>();
throw new NotImplementedException();
////var grandparent = new Mock<TestLogical1>();
////var parent = new Mock<TestLogical2>();
////var child = new Mock<TestLogical3>();
parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
child.Setup(x => x.LogicalParent).Returns(parent.Object);
////parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
////child.Setup(x => x.LogicalParent).Returns(parent.Object);
var selector = new Selector().OfType(grandparent.Object.GetType()).Descendent().OfType(child.Object.GetType());
////var selector = new Selector().OfType(grandparent.Object.GetType()).Descendent().OfType(child.Object.GetType());
Assert.IsTrue(ActivatorValue(selector, child.Object));
////Assert.IsTrue(ActivatorValue(selector, child.Object));
}
[TestMethod]
public void Descendent_Matches_Control_When_It_Is_Descendent_OfType_And_Class()
{
var grandparent = new Mock<TestLogical1>();
var parent = new Mock<TestLogical2>();
var child = new Mock<TestLogical3>();
throw new NotImplementedException();
////var grandparent = new Mock<TestLogical1>();
////var parent = new Mock<TestLogical2>();
////var child = new Mock<TestLogical3>();
grandparent.Setup(x => x.Classes).Returns(new Classes("foo"));
parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
parent.Setup(x => x.Classes).Returns(new Classes());
child.Setup(x => x.LogicalParent).Returns(parent.Object);
////grandparent.Setup(x => x.Classes).Returns(new Classes("foo"));
////parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
////parent.Setup(x => x.Classes).Returns(new Classes());
////child.Setup(x => x.LogicalParent).Returns(parent.Object);
var selector = new Selector().OfType(grandparent.Object.GetType()).Class("foo").Descendent().OfType(child.Object.GetType());
////var selector = new Selector().OfType(grandparent.Object.GetType()).Class("foo").Descendent().OfType(child.Object.GetType());
Assert.IsTrue(ActivatorValue(selector, child.Object));
////Assert.IsTrue(ActivatorValue(selector, child.Object));
}
[TestMethod]
public void Descendent_Doesnt_Match_Control_When_It_Is_Descendent_OfType_But_Wrong_Class()
{
var grandparent = new Mock<TestLogical1>();
var parent = new Mock<TestLogical2>();
var child = new Mock<TestLogical3>();
throw new NotImplementedException();
////var grandparent = new Mock<TestLogical1>();
////var parent = new Mock<TestLogical2>();
////var child = new Mock<TestLogical3>();
grandparent.Setup(x => x.Classes).Returns(new Classes("bar"));
parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
parent.Setup(x => x.Classes).Returns(new Classes("foo"));
child.Setup(x => x.LogicalParent).Returns(parent.Object);
////grandparent.Setup(x => x.Classes).Returns(new Classes("bar"));
////parent.Setup(x => x.LogicalParent).Returns(grandparent.Object);
////parent.Setup(x => x.Classes).Returns(new Classes("foo"));
////child.Setup(x => x.LogicalParent).Returns(parent.Object);
var selector = new Selector().OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
////var selector = new Selector().OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
Assert.IsFalse(ActivatorValue(selector, child.Object));
////Assert.IsFalse(ActivatorValue(selector, child.Object));
}
private static bool ActivatorValue(Selector selector, IStyleable control)
@ -82,16 +87,16 @@ namespace Perspex.Styling.UnitTests
return selector.GetActivator(control).Take(1).ToEnumerable().Single();
}
public abstract class TestLogical1 : TestLogical
{
}
////public abstract class TestLogical1 : TestLogical
////{
////}
public abstract class TestLogical2 : TestLogical
{
}
////public abstract class TestLogical2 : TestLogical
////{
////}
public abstract class TestLogical3 : TestLogical
{
}
////public abstract class TestLogical3 : TestLogical
////{
////}
}
}

29
Perspex.Styling.UnitTests/TestLogical.cs

@ -1,29 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="SubscribeCheck.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Styling.UnitTests
{
using System.Collections.Generic;
using Perspex.Styling;
public abstract class TestLogical : TestControlBase, ILogical
{
public TestLogical()
{
}
public abstract ILogical LogicalParent
{
get;
set;
}
public abstract IEnumerable<ILogical> LogicalChildren
{
get;
}
}
}

5
Perspex.Styling/IGlobalStyle.cs → Perspex.Styling/IGlobalStyles.cs

@ -1,12 +1,13 @@
// -----------------------------------------------------------------------
// <copyright file="IGlobalStyle.cs" company="Steven Kirk">
// <copyright file="IGlobalStyles.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Styling
{
public interface IGlobalStyle : IStyle
public interface IGlobalStyles
{
Styles Styles { get; }
}
}

17
Perspex.Styling/ILogical.cs

@ -1,17 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="ILogical.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Styling
{
using System.Collections.Generic;
public interface ILogical
{
ILogical LogicalParent { get; set; }
IEnumerable<ILogical> LogicalChildren { get; }
}
}

3
Perspex.Styling/Perspex.Styling.csproj

@ -37,8 +37,7 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Classes.cs" />
<Compile Include="IGlobalStyle.cs" />
<Compile Include="ILogical.cs" />
<Compile Include="IGlobalStyles.cs" />
<Compile Include="IStyle.cs" />
<Compile Include="IStyleable.cs" />
<Compile Include="IStyleHost.cs" />

5
Perspex.Styling/Selectors.cs

@ -33,12 +33,13 @@ namespace Perspex.Styling
SelectorString = " ",
GetObservable = control =>
{
ILogical c = (ILogical)control;
// TODO: This needs to traverse the logical tree, not the visual.
IVisual c = (IVisual)control;
List<IObservable<bool>> descendentMatches = new List<IObservable<bool>>();
while (c != null)
{
c = c.LogicalParent;
c = c.VisualParent;
if (c is IStyleable)
{

4
Perspex.Styling/Styler.cs

@ -19,11 +19,11 @@ namespace Perspex.Styling
.GetSelfAndVisualAncestors()
.OfType<IStyleHost>()
.FirstOrDefault();
IGlobalStyle global = Locator.Current.GetService<IGlobalStyle>();
IGlobalStyles global = Locator.Current.GetService<IGlobalStyles>();
if (global != null)
{
global.Attach(control);
global.Styles.Attach(control);
}
if (styleContainer != null)

34
Perspex.Windows/Perspex.Windows.csproj

@ -67,13 +67,37 @@
<Compile Include="WindowsPlatform.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Perspex\Perspex.csproj">
<Project>{3c9f40da-d2a5-43a1-a272-e965876c6d46}</Project>
<Name>Perspex</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Controls\Perspex.Controls.csproj">
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project>
<Name>Perspex.Controls</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Input\Perspex.Input.csproj">
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
<Name>Perspex.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Interactivity\Perspex.Interactivity.csproj">
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
<Name>Perspex.Interactivity</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Layout\Perspex.Layout.csproj">
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Perspex.Layout</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.SceneGraph\Perspex.SceneGraph.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Perspex.SceneGraph</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Styling\Perspex.Styling.csproj">
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
<Name>Perspex.Styling</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

2
Perspex.Windows/Window.cs

@ -43,7 +43,7 @@ namespace Perspex.Windows
this.CreateWindow();
Size clientSize = this.ClientSize;
this.LayoutManager = new LayoutManager();
this.LayoutManager = new LayoutManager(this);
this.RenderManager = new RenderManager();
this.renderer = factory.CreateRenderer(this.Handle, (int)clientSize.Width, (int)clientSize.Height);
this.inputManager = Locator.Current.GetService<IInputManager>();

6
Perspex.sln

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex", "Perspex\Perspex.csproj", "{3C9F40DA-D2A5-43A1-A272-E965876C6D46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Windows", "Perspex.Windows\Perspex.Windows.csproj", "{811A76CF-1CF6-440F-963B-BBE31BD72A82}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication", "TestApplication\TestApplication.csproj", "{E3A1060B-50D0-44E8-88B6-F44EF2E5BD72}"
@ -47,10 +45,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3C9F40DA-D2A5-43A1-A272-E965876C6D46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C9F40DA-D2A5-43A1-A272-E965876C6D46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C9F40DA-D2A5-43A1-A272-E965876C6D46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C9F40DA-D2A5-43A1-A272-E965876C6D46}.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

2
TestApplication/App.cs

@ -8,11 +8,11 @@
public class App : Application
{
public App()
: base(new DefaultTheme())
{
this.RegisterServices();
Direct2D1Platform.Initialize();
WindowsPlatform.Initialize();
this.Styles = new DefaultTheme();
}
}
}

26
TestApplication/Program.cs

@ -218,20 +218,20 @@ namespace TestApplication
}
};
var treeView = window.FindControl<TreeView>("treeView");
var newTreeViewItemText = window.FindControl<TextBox>("newTreeViewItemText");
var addTreeViewItem = window.FindControl<Button>("addTreeViewItem");
////var treeView = window.FindControl<TreeView>("treeView");
////var newTreeViewItemText = window.FindControl<TextBox>("newTreeViewItemText");
////var addTreeViewItem = window.FindControl<Button>("addTreeViewItem");
addTreeViewItem.Click += (s, e) =>
{
if (treeView.SelectedItem != null)
{
((Node)treeView.SelectedItem).Children.Add(new Node
{
Name = newTreeViewItemText.Text,
});
}
};
////addTreeViewItem.Click += (s, e) =>
////{
//// if (treeView.SelectedItem != null)
//// {
//// ((Node)treeView.SelectedItem).Children.Add(new Node
//// {
//// Name = newTreeViewItemText.Text,
//// });
//// }
////};
window.Show();
Application.Current.Run(window);

40
TestApplication/TestApplication.csproj

@ -86,18 +86,50 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Perspex.Application\Perspex.Application.csproj">
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project>
<Name>Perspex.Application</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Controls\Perspex.Controls.csproj">
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project>
<Name>Perspex.Controls</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Direct2D1\Perspex.Direct2D1.csproj">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Perspex.Direct2D1</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Input\Perspex.Input.csproj">
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
<Name>Perspex.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Interactivity\Perspex.Interactivity.csproj">
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
<Name>Perspex.Interactivity</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Layout\Perspex.Layout.csproj">
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Perspex.Layout</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.SceneGraph\Perspex.SceneGraph.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Perspex.SceneGraph</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Styling\Perspex.Styling.csproj">
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
<Name>Perspex.Styling</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Themes.Default\Perspex.Themes.Default.csproj">
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project>
<Name>Perspex.Themes.Default</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Windows\Perspex.Windows.csproj">
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
<Name>Perspex.Windows</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex\Perspex.csproj">
<Project>{3c9f40da-d2a5-43a1-a272-e965876c6d46}</Project>
<Name>Perspex</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="github_icon.png">

Loading…
Cancel
Save