Browse Source

More stylecoping.

pull/72/merge
Steven Kirk 11 years ago
parent
commit
aa147f0423
  1. 4
      Perspex.Animation/Properties/AssemblyInfo.cs
  2. 2
      Perspex.Base/Diagnostics/PerspexObjectExtensions.cs
  3. 2
      Perspex.Base/Diagnostics/PerspexPropertyValue.cs
  4. 2
      Perspex.Base/PerspexProperty.cs
  5. 2
      Perspex.Base/PriorityValue.cs
  6. 6
      Perspex.Base/Properties/AssemblyInfo.cs
  7. 36
      Perspex.Base/Threading/DispatcherTimer.cs
  8. 4
      Perspex.Base/Threading/PerspexScheduler.cs
  9. 2
      Perspex.Base/Utilities/MathUtilities.cs
  10. 2
      Perspex.Controls/Button.cs
  11. 6
      Perspex.Controls/GridLength.cs
  12. 2
      Perspex.Controls/GridSplitter.cs
  13. 8
      Perspex.Controls/ISelectable.cs
  14. 4
      Perspex.Controls/Menu.cs
  15. 2
      Perspex.Controls/MenuItem.cs
  16. 4
      Perspex.Controls/Mixins/SelectableMixin.cs
  17. 1
      Perspex.Controls/Parsers/GridLengthsParser.cs
  18. 2
      Perspex.Controls/Presenters/ContentPresenter.cs
  19. 3
      Perspex.Controls/Presenters/DeckPresenter.cs
  20. 4
      Perspex.Controls/Presenters/IContentPresenter.cs
  21. 2
      Perspex.Controls/Presenters/IItemsPresenter.cs
  22. 1
      Perspex.Controls/Presenters/IPresenter.cs
  23. 2
      Perspex.Controls/Presenters/ItemsPresenter.cs
  24. 4
      Perspex.Controls/Presenters/TextPresenter.cs
  25. 2
      Perspex.Controls/Primitives/AccessText.cs
  26. 27
      Perspex.Controls/Primitives/AdornerLayer.cs
  27. 1
      Perspex.Controls/Primitives/SelectingItemsControl.cs
  28. 4
      Perspex.Controls/Primitives/Track.cs
  29. 6
      Perspex.Controls/Properties/AssemblyInfo.cs
  30. 2
      Perspex.Controls/Shapes/Shape.cs
  31. 4
      Perspex.Controls/TabControl.cs
  32. 2
      Perspex.Controls/Templates/TemplateExtensions.cs
  33. 4
      Perspex.Controls/TextBox.cs
  34. 6
      Perspex.Controls/ToolTip.cs
  35. 42
      Perspex.Controls/TopLevel.cs
  36. 2
      Perspex.Controls/Utils/StringUtils.cs
  37. 2
      Perspex.Controls/Window.cs
  38. 4
      Perspex.Diagnostics/DevTools.cs
  39. 6
      Perspex.Diagnostics/Properties/AssemblyInfo.cs
  40. 6
      Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs
  41. 9
      Perspex.Diagnostics/Views/ControlDetailsView.cs
  42. 5
      Perspex.Diagnostics/Views/GridRepeater.cs
  43. 2
      Perspex.Diagnostics/Views/TreePage.cs
  44. 5
      Perspex.Input/FocusManager.cs
  45. 10
      Perspex.Input/InputElement.cs
  46. 4
      Perspex.Input/InputExtensions.cs
  47. 2
      Perspex.Input/KeyboardNavigationMode.cs
  48. 4
      Perspex.Input/MouseDevice.cs
  49. 6
      Perspex.Input/Properties/AssemblyInfo.cs
  50. 6
      Perspex.Input/Raw/RawKeyEventArgs.cs
  51. 10
      Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs
  52. 6
      Perspex.Interactivity/Properties/AssemblyInfo.cs
  53. 42
      Perspex.Interactivity/RoutedEvent.cs
  54. 14
      Perspex.Layout/GlobalSuppressions.cs
  55. 4
      Perspex.Layout/ILayoutManager.cs
  56. 6
      Perspex.Layout/LayoutManager.cs
  57. 2
      Perspex.Layout/Layoutable.cs
  58. 6
      Perspex.Layout/Properties/AssemblyInfo.cs
  59. 1
      Perspex.SceneGraph/IVisual.cs
  60. 30
      Perspex.SceneGraph/Matrix.cs
  61. 10
      Perspex.SceneGraph/Media/FormattedText.cs
  62. 2
      Perspex.SceneGraph/Media/FormattedTextLine.cs
  63. 14
      Perspex.SceneGraph/Media/IDrawingContext.cs
  64. 4
      Perspex.SceneGraph/Media/PathMarkupParser.cs
  65. 8
      Perspex.SceneGraph/Media/SolidColorBrush.cs
  66. 4
      Perspex.SceneGraph/Origin.cs
  67. 6
      Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs
  68. 65
      Perspex.SceneGraph/Point.cs
  69. 6
      Perspex.SceneGraph/Properties/AssemblyInfo.cs
  70. 10
      Perspex.SceneGraph/Rect.cs
  71. 6
      Perspex.SceneGraph/Rendering/RendererBase.cs
  72. 15
      Perspex.SceneGraph/Size.cs
  73. 2
      Perspex.SceneGraph/Thickness.cs
  74. 41
      Perspex.SceneGraph/Vector.cs
  75. 6
      Perspex.SceneGraph/Visual.cs
  76. 2
      Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs
  77. 6
      Perspex.Styling/Properties/AssemblyInfo.cs
  78. 2
      Perspex.Styling/Styling/INamed.cs
  79. 2
      Perspex.Styling/Styling/Selector.cs
  80. 6
      Perspex.Styling/Styling/SelectorMatch.cs
  81. 8
      Perspex.Styling/Styling/Selectors.cs
  82. 8
      Perspex.Styling/Styling/StyleActivator.cs
  83. 5
      Perspex.Styling/Styling/StyleBinding.cs
  84. 2
      Perspex.Themes.Default/ContentControlStyle.cs
  85. 3
      Perspex.Themes.Default/DropDownStyle.cs
  86. 6
      Perspex.Themes.Default/Properties/AssemblyInfo.cs
  87. 2
      Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs
  88. 2
      Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs
  89. 4
      Tests/Perspex.Base.UnitTests/PriorityValueTests.cs
  90. 10
      Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs
  91. 3
      Tests/Perspex.Controls.UnitTests/ContentControlTests.cs
  92. 30
      Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs
  93. 10
      Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs
  94. 1
      Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs
  95. 2
      Tests/Perspex.Controls.UnitTests/TabControlTests.cs
  96. 12
      Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs
  97. 4
      Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs
  98. 8
      Tests/Perspex.Controls.UnitTests/TopLevelTests.cs
  99. 12
      Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs
  100. 10
      Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs

4
Perspex.Animation/Properties/AssemblyInfo.cs

@ -4,10 +4,8 @@
// </copyright>
// -----------------------------------------------------------------------
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information

2
Perspex.Base/Diagnostics/PerspexObjectExtensions.cs

@ -25,7 +25,7 @@ namespace Perspex.Diagnostics
else
{
return new PerspexPropertyValue(
property,
property,
o.GetValue(property),
BindingPriority.Unset,
"Unset");

2
Perspex.Base/Diagnostics/PerspexPropertyValue.cs

@ -9,7 +9,7 @@ namespace Perspex.Diagnostics
public class PerspexPropertyValue
{
public PerspexPropertyValue(
PerspexProperty property,
PerspexProperty property,
object value,
BindingPriority priority,
string diagnostic)

2
Perspex.Base/PerspexProperty.cs

@ -468,7 +468,7 @@ namespace Perspex
private static Func<PerspexObject, TValue, TValue> Cast<TOwner, TValue>(Func<TOwner, TValue, TValue> f)
where TOwner : PerspexObject
{
return f != null ? (o, v) => f((TOwner)o, v) : (Func < PerspexObject, TValue, TValue > )null;
return f != null ? (o, v) => f((TOwner)o, v) : (Func<PerspexObject, TValue, TValue>)null;
}
/// <summary>

2
Perspex.Base/PriorityValue.cs

@ -18,7 +18,7 @@ namespace Perspex
/// Maintains a list of prioritised bindings together with a current value.
/// </summary>
/// <remarks>
/// Bindings, in the form of <see cref="IObservable{object}"/>s are added to the object using
/// Bindings, in the form of <see cref="IObservable{Object}"/>s are added to the object using
/// the <see cref="Add"/> method. With the observable is passed a priority, where lower values
/// represent higher priorites. The current <see cref="Value"/> is selected from the highest
/// priority binding that doesn't return <see cref="PerspexProperty.UnsetValue"/>. Where there

6
Perspex.Base/Properties/AssemblyInfo.cs

@ -8,7 +8,7 @@ using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Base")]
@ -24,11 +24,11 @@ using System.Runtime.CompilerServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

36
Perspex.Base/Threading/DispatcherTimer.cs

@ -55,17 +55,17 @@ namespace Perspex.Threading
public event EventHandler Tick;
public Dispatcher Dispatcher
{
get;
private set;
public Dispatcher Dispatcher
{
get;
private set;
}
public TimeSpan Interval
public TimeSpan Interval
{
get
{
return this.interval;
get
{
return this.interval;
}
set
@ -76,14 +76,14 @@ namespace Perspex.Threading
this.IsEnabled = enabled;
}
}
public bool IsEnabled
public bool IsEnabled
{
get
{
return this.timer != null;
}
set
{
if (this.IsEnabled != value)
@ -99,11 +99,11 @@ namespace Perspex.Threading
}
}
}
public object Tag
{
get;
set;
public object Tag
{
get;
set;
}
public static IDisposable Run(Func<bool> action, TimeSpan interval, DispatcherPriority priority = DispatcherPriority.Normal)
@ -132,7 +132,7 @@ namespace Perspex.Threading
this.timer = threading.StartTimer(this.Interval, this.InternalTick);
}
}
public void Stop()
{
if (this.IsEnabled)

4
Perspex.Base/Threading/PerspexScheduler.cs

@ -17,11 +17,11 @@ namespace Perspex.Threading
public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
{
return DispatcherTimer.Run(
() =>
() =>
{
action(this, state);
return false;
},
},
dueTime);
}
}

2
Perspex.Base/Utilities/MathUtilities.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="TypeUtilities.cs" company="Steven Kirk">
// <copyright file="MathUtilities.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

2
Perspex.Controls/Button.cs

@ -229,7 +229,7 @@ namespace Perspex.Controls
private void CanExecuteChanged(object sender, EventArgs e)
{
// HACK: Just set the IsEnabled property for the moment. This needs to be changed to
// HACK: Just set the IsEnabled property for the moment. This needs to be changed to
// use IsEnabledCore etc. but it will do for now.
this.IsEnabled = this.Command == null || this.Command.CanExecute(this.CommandParameter);
}

6
Perspex.Controls/GridLength.cs

@ -121,7 +121,7 @@ namespace Perspex.Controls
/// Compares two GridLength structures for equality.
/// </summary>
/// <param name="a">The first GridLength.</param>
/// <param name="a">The first GridLength.</param>
/// <param name="b">The second GridLength.</param>
/// <returns>True if the structures are equal, otherwise false.</returns>
public static bool operator ==(GridLength a, GridLength b)
{
@ -131,8 +131,8 @@ namespace Perspex.Controls
/// <summary>
/// Compares two GridLength structures for inequality.
/// </summary>
/// <param name="a">The first GridLength.</param>
/// <param name="a">The first GridLength.</param>
/// <param name="gl1">The first GridLength.</param>
/// <param name="gl2">The first GridLength.</param>
/// <returns>True if the structures are unequal, otherwise false.</returns>
public static bool operator !=(GridLength gl1, GridLength gl2)
{

2
Perspex.Controls/GridSplitter.cs

@ -9,7 +9,7 @@ namespace Perspex.Controls
using System;
using Perspex.Controls.Primitives;
using Perspex.Input;
using Rendering;
using Perspex.Rendering;
using Perspex.VisualTree;
public class GridSplitter : Thumb

8
Perspex.Controls/ISelectable.cs

@ -12,10 +12,10 @@ namespace Perspex.Controls
/// Interface for objects that are selectable.
/// </summary>
/// <remarks>
/// Controls such as <see cref="Selector"/> use this interface to indicate the selected
/// control in a list. If changing the control's <see cref="IsSelected"/> property should
/// update the selection in a <see cref="SelectingItemsControl"/> or equivalent, then the
/// control should raise the <see cref="SelectingItemsControl.IsSelectedChangedEvent"/>.
/// Controls such as <see cref="SelectingItemsControl"/> use this interface to indicate the
/// selected control in a list. If changing the control's <see cref="IsSelected"/> property
/// should update the selection in a <see cref="SelectingItemsControl"/> or equivalent, then
/// the control should raise the <see cref="SelectingItemsControl.IsSelectedChangedEvent"/>.
/// </remarks>
public interface ISelectable
{

4
Perspex.Controls/Menu.cs

@ -9,11 +9,11 @@ namespace Perspex.Controls
using System;
using System.Linq;
using System.Reactive.Disposables;
using Perspex.Controls.Primitives;
using Perspex.Input;
using Perspex.Interactivity;
using Perspex.LogicalTree;
using Perspex.Rendering;
using Perspex.Interactivity;
using Perspex.Controls.Primitives;
/// <summary>
/// A top-level menu control.

2
Perspex.Controls/MenuItem.cs

@ -75,7 +75,7 @@ namespace Perspex.Controls
RoutedEvent.Register<MenuItem, RoutedEventArgs>(nameof(SubmenuOpened), RoutingStrategies.Bubble);
/// <summary>
/// The default value for the <see cref="ItemsPanel"/> property.
/// The default value for the <see cref="ItemsControl.ItemsPanel"/> property.
/// </summary>
private static readonly ItemsPanelTemplate DefaultPanel =
new ItemsPanelTemplate(() => new StackPanel

4
Perspex.Controls/Mixins/SelectableMixin.cs

@ -15,7 +15,7 @@ namespace Perspex.Controls.Mixins
/// </summary>
/// <remarks>
/// <para>
/// The <see cref="SelectableMixin{TControl}"/> adds behavior to a control which can be
/// The <see cref="SelectableMixin"/> adds behavior to a control which can be
/// selected. It adds the following behavior:
/// </para>
/// <list type="bullet">
@ -38,7 +38,7 @@ namespace Perspex.Controls.Mixins
public static class SelectableMixin
{
/// <summary>
/// Initializes a new instance of the <see cref="SelectableMixin{TControl}"/> class.
/// Initializes a new instance of the <see cref="SelectableMixin"/> class.
/// </summary>
/// <typeparam name="TControl">The control type.</typeparam>
/// <param name="isSelected">The IsSelected property.</param>

1
Perspex.Controls/Parsers/GridLengthsParser.cs

@ -10,7 +10,6 @@ namespace Perspex.Controls.Parsers
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Parses a string of <see cref="GridLength"/>s for <see cref="ColumnDefinitions"/> and
/// <see cref="RowDefinitions"/>.

2
Perspex.Controls/Presenters/ContentPresenter.cs

@ -6,6 +6,7 @@
namespace Perspex.Controls.Presenters
{
using Perspex.Controls.Primitives;
using Perspex.Controls.Templates;
/// <summary>
@ -115,7 +116,6 @@ namespace Perspex.Controls.Presenters
if (result.Parent == null)
{
((ISetLogicalParent)result).SetParent((ILogical)logicalHost ?? this);
}
logicalChildren.Remove(old);

3
Perspex.Controls/Presenters/DeckPresenter.cs

@ -12,10 +12,9 @@ namespace Perspex.Controls.Presenters
using System.Reactive.Linq;
using System.Threading.Tasks;
using Perspex.Animation;
using Perspex.Collections;
using Perspex.Controls.Generators;
using Perspex.Controls.Primitives;
using Templates;
using Perspex.Controls.Templates;
using Perspex.Controls.Utils;
/// <summary>

4
Perspex.Controls/Presenters/IContentPresenter.cs

@ -6,8 +6,10 @@
namespace Perspex.Controls.Presenters
{
using Perspex.Controls.Primitives;
/// <summary>
/// Interface for controls that present a single item of data inside a
/// Interface for controls that present a single item of data inside a
/// <see cref="TemplatedControl"/> template.
/// </summary>
public interface IContentPresenter : IPresenter

2
Perspex.Controls/Presenters/IItemsPresenter.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="IPresenter.cs" company="Steven Kirk">
// <copyright file="IItemsPresenter.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

1
Perspex.Controls/Presenters/IPresenter.cs

@ -6,6 +6,7 @@
namespace Perspex.Controls.Presenters
{
using Perspex.Controls.Primitives;
using Perspex.Styling;
/// <summary>

2
Perspex.Controls/Presenters/ItemsPresenter.cs

@ -10,7 +10,7 @@ namespace Perspex.Controls.Presenters
using System.Collections;
using System.Collections.Specialized;
using Perspex.Controls.Generators;
using Templates;
using Perspex.Controls.Templates;
using Perspex.Input;
using Perspex.Styling;

4
Perspex.Controls/Presenters/TextPresenter.cs

@ -105,8 +105,8 @@ namespace Perspex.Controls.Presenters
var b = Math.Ceiling(charPos.Bottom) - 0.5;
context.DrawLine(
new Pen(caretBrush, 1),
new Point(x, y),
new Pen(caretBrush, 1),
new Point(x, y),
new Point(x, b));
}
}

2
Perspex.Controls/Primitives/AccessText.cs

@ -161,7 +161,7 @@ namespace Perspex.Controls.Primitives
}
/// <summary>
/// Called when the <see cref="Text"/> property changes.
/// Called when the <see cref="TextBlock.Text"/> property changes.
/// </summary>
/// <param name="text">The new text.</param>
private void TextChanged(string text)

27
Perspex.Controls/Primitives/AdornerLayer.cs

@ -7,7 +7,6 @@
namespace Perspex.Controls.Primitives
{
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Perspex.VisualTree;
@ -31,7 +30,7 @@ namespace Perspex.Controls.Primitives
public AdornerLayer()
{
this.Children.CollectionChanged += ChildrenCollectionChanged;
this.Children.CollectionChanged += this.ChildrenCollectionChanged;
}
public static Visual GetAdornedElement(Visual adorner)
@ -73,6 +72,18 @@ namespace Perspex.Controls.Primitives
return finalSize;
}
private static void AdornedElementChanged(PerspexPropertyChangedEventArgs e)
{
var adorner = (Visual)e.Sender;
var adorned = (Visual)e.NewValue;
var layer = adorner.GetVisualParent<AdornerLayer>();
if (layer != null)
{
layer.UpdateAdornedElement(adorner, adorned);
}
}
private void ChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
@ -119,18 +130,6 @@ namespace Perspex.Controls.Primitives
}
}
private static void AdornedElementChanged(PerspexPropertyChangedEventArgs e)
{
var adorner = (Visual)e.Sender;
var adorned = (Visual)e.NewValue;
var layer = adorner.GetVisualParent<AdornerLayer>();
if (layer != null)
{
layer.UpdateAdornedElement(adorner, adorned);
}
}
private class AdornedElementInfo
{
public IDisposable Subscription { get; set; }

1
Perspex.Controls/Primitives/SelectingItemsControl.cs

@ -128,6 +128,7 @@ namespace Perspex.Controls.Primitives
{
this.SelectedIndex = 0;
}
break;
case NotifyCollectionChangedAction.Remove:

4
Perspex.Controls/Primitives/Track.cs

@ -44,14 +44,14 @@ namespace Perspex.Controls.Primitives
{
if (val.Item1 != null)
{
val.Item1.DragDelta -= ThumbDragged;
val.Item1.DragDelta -= this.ThumbDragged;
}
this.ClearVisualChildren();
if (val.Item2 != null)
{
val.Item2.DragDelta += ThumbDragged;
val.Item2.DragDelta += this.ThumbDragged;
this.AddVisualChild(val.Item2);
}
});

6
Perspex.Controls/Properties/AssemblyInfo.cs

@ -8,7 +8,7 @@ using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Controls")]
@ -24,11 +24,11 @@ using System.Runtime.CompilerServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

2
Perspex.Controls/Shapes/Shape.cs

@ -106,7 +106,7 @@ namespace Perspex.Controls.Shapes
protected override Size MeasureOverride(Size availableSize)
{
// This should probably use GetRenderBounds(strokeThickness) but then the calculations
// This should probably use GetRenderBounds(strokeThickness) but then the calculations
// will multiply the stroke thickness as well, which isn't correct.
Rect shapeBounds = this.DefiningGeometry.Bounds;
Size shapeSize = new Size(shapeBounds.Right, shapeBounds.Bottom);

4
Perspex.Controls/TabControl.cs

@ -38,7 +38,7 @@ namespace Perspex.Controls
}
/// <summary>
/// Gets the <see cref="SelectedItem"/> as a <see cref="TabItem"/>.
/// Gets the <see cref="SelectingItemsControl.SelectedItem"/> as a <see cref="TabItem"/>.
/// </summary>
public TabItem SelectedTab
{
@ -69,7 +69,7 @@ namespace Perspex.Controls
}
/// <summary>
/// Called when the <see cref="SelectedIndex"/> property changes.
/// Called when the <see cref="SelectingItemsControl.SelectedIndex"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private void SelectedIndexChanged(PerspexPropertyChangedEventArgs e)

2
Perspex.Controls/Templates/TemplateExtensions.cs

@ -71,7 +71,7 @@ namespace Perspex.Controls.Templates
if (visual != null)
{
// TODO: This searches the whole descendent tree - it can stop when it exits the
// TODO: This searches the whole descendent tree - it can stop when it exits the
// template.
return visual.GetVisualDescendents()
.OfType<Control>()

4
Perspex.Controls/TextBox.cs

@ -62,8 +62,8 @@ namespace Perspex.Controls
.Select(x => x ? ScrollBarVisibility.Auto : ScrollBarVisibility.Hidden);
this.Bind(
ScrollViewer.HorizontalScrollBarVisibilityProperty,
horizontalScrollBarVisibility,
ScrollViewer.HorizontalScrollBarVisibilityProperty,
horizontalScrollBarVisibility,
BindingPriority.Style);
}

6
Perspex.Controls/ToolTip.cs

@ -17,9 +17,9 @@ namespace Perspex.Controls
/// A tooltip control.
/// </summary>
/// <remarks>
/// You will probably not want to create a <see cref="ToolTip"/> control directly: if added to
/// You will probably not want to create a <see cref="ToolTip"/> control directly: if added to
/// the tree it will act as a simple <see cref="ContentControl"/> styled to look like a tooltip.
/// To add a tooltip to a control, use the <see cref="TipProperty"/> attached property,
/// To add a tooltip to a control, use the <see cref="TipProperty"/> attached property,
/// assigning the content that you want displayed.
/// </remarks>
public class ToolTip : ContentControl
@ -42,7 +42,7 @@ namespace Perspex.Controls
/// <summary>
/// Observable fired when a tooltip should be displayed for a control. The output from this
/// observable is throttled and calls <see cref="ShowToolTip(Control)"/> when the time
/// observable is throttled and calls <see cref="ShowToolTip(Control)"/> when the time
/// period expires.
/// </summary>
private static Subject<Control> show = new Subject<Control>();

42
Perspex.Controls/TopLevel.cs

@ -9,6 +9,7 @@ namespace Perspex.Controls
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Perspex.Controls.Primitives;
using Perspex.Input;
using Perspex.Input.Raw;
using Perspex.Layout;
@ -16,8 +17,6 @@ namespace Perspex.Controls
using Perspex.Rendering;
using Perspex.Styling;
using Perspex.Threading;
using Perspex.Controls.Primitives;
using Perspex.Interactivity;
using Splat;
/// <summary>
@ -164,20 +163,6 @@ namespace Perspex.Controls
this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => this.PlatformImpl.ClientSize = x);
}
private static T TryGetService<T>(IDependencyResolver resolver) where T : class
{
var result = resolver.GetService<T>();
if (result == null)
{
System.Diagnostics.Debug.WriteLineIf(
result == null,
$"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?");
}
return result;
}
/// <summary>
/// Fired when the window is activated.
/// </summary>
@ -293,8 +278,8 @@ namespace Perspex.Controls
/// <returns>A disposable used to finish the operation.</returns>
/// <remarks>
/// When an auto-resize operation is in progress any resize events received will not be
/// cause the new size to be written to the <see cref="Width"/> and <see cref="Height"/>
/// properties.
/// cause the new size to be written to the <see cref="Layoutable.Width"/> and
/// <see cref="Layoutable.Height"/> properties.
/// </remarks>
protected IDisposable BeginAutoSizing()
{
@ -317,6 +302,27 @@ namespace Perspex.Controls
return base.ArrangeOverride(finalSize);
}
/// <summary>
/// Tries to get a service from an <see cref="IDependencyResolver"/>, throwing an
/// exception if not found.
/// </summary>
/// <typeparam name="T">The service type.</typeparam>
/// <param name="resolver">The resolver.</param>
/// <returns>The service.</returns>
private static T TryGetService<T>(IDependencyResolver resolver) where T : class
{
var result = resolver.GetService<T>();
if (result == null)
{
System.Diagnostics.Debug.WriteLineIf(
result == null,
$"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?");
}
return result;
}
/// <summary>
/// Handles an activated notification from <see cref="ITopLevelImpl.Activated"/>.
/// </summary>

2
Perspex.Controls/Utils/StringUtils.cs

@ -24,7 +24,7 @@ namespace Perspex.Controls.Utils
public static bool IsStartOfWord(string text, int index)
{
// A 'word' starts with an AlphaNumeric or some punctuation symbols immediately
// A 'word' starts with an AlphaNumeric or some punctuation symbols immediately
// preceeded by lwsp.
if (index > 0 && !char.IsWhiteSpace(text[index - 1]))
{

2
Perspex.Controls/Window.cs

@ -91,7 +91,7 @@ namespace Perspex.Controls
var modal = this.PlatformImpl.ShowDialog();
var result = new TaskCompletionSource<TResult>();
Observable.FromEventPattern(this, nameof(Closed))
Observable.FromEventPattern(this, nameof(this.Closed))
.Take(1)
.Subscribe(_ =>
{

4
Perspex.Diagnostics/DevTools.cs

@ -37,8 +37,8 @@ namespace Perspex.Diagnostics
public static IDisposable Attach(Window window)
{
return window.AddHandler(
Window.KeyDownEvent,
WindowPreviewKeyDown,
Window.KeyDownEvent,
WindowPreviewKeyDown,
Interactivity.RoutingStrategies.Tunnel);
}

6
Perspex.Diagnostics/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Diagnostics")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

6
Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs

@ -8,8 +8,8 @@ namespace Perspex.Diagnostics.ViewModels
{
using System;
using Perspex.Controls;
using ReactiveUI;
using Perspex.Input;
using ReactiveUI;
internal class DevToolsViewModel : ReactiveObject
{
@ -25,8 +25,8 @@ namespace Perspex.Diagnostics.ViewModels
{
this.WhenAnyValue(x => x.Root).Subscribe(x =>
{
this.LogicalTree = new LogicalTreeViewModel(root);
this.VisualTree = new VisualTreeViewModel(root);
this.LogicalTree = new LogicalTreeViewModel(this.root);
this.VisualTree = new VisualTreeViewModel(this.root);
});
this.focusedControl = KeyboardDevice.Instance.WhenAnyValue(x => x.FocusedElement)

9
Perspex.Diagnostics/Views/ControlDetailsView.cs

@ -1,19 +1,18 @@
// -----------------------------------------------------------------------
// <copyright file="DevTools.cs" company="Steven Kirk">
// <copyright file="ControlDetailsView.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Diagnostics.Views
{
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using Perspex.Controls;
using Perspex.Diagnostics.ViewModels;
using Perspex.Styling;
using ReactiveUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reactive.Linq;
internal class ControlDetailsView : UserControl
{

5
Perspex.Diagnostics/Views/GridRepeater.cs

@ -1,16 +1,15 @@
// -----------------------------------------------------------------------
// <copyright file="VisualTreeView.cs" company="Steven Kirk">
// <copyright file="GridRepeater.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Diagnostics.Views
{
using Perspex.Controls;
using Perspex.Controls.Templates;
using System;
using System.Collections;
using System.Collections.Generic;
using Perspex.Controls;
internal static class GridRepeater
{

2
Perspex.Diagnostics/Views/TreePage.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="DevTools.cs" company="Steven Kirk">
// <copyright file="TreePage.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

5
Perspex.Input/FocusManager.cs

@ -9,10 +9,9 @@ namespace Perspex.Input
using System;
using System.Collections.Generic;
using System.Linq;
using Perspex.Interactivity;
using Perspex.VisualTree;
using Splat;
using Perspex.Interactivity;
/// <summary>
/// Manages focus for the application.
@ -166,7 +165,7 @@ namespace Perspex.Input
yield return scope;
}
control = control.GetVisualParent<IInputElement>() ??
control = control.GetVisualParent<IInputElement>() ??
((control as IHostedVisualTreeRoot)?.Host as IInputElement);
}
}

10
Perspex.Input/InputElement.cs

@ -43,7 +43,7 @@ namespace Perspex.Input
public static readonly RoutedEvent<KeyEventArgs> KeyDownEvent =
RoutedEvent.Register<InputElement, KeyEventArgs>(
"KeyDown",
"KeyDown",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
public static readonly RoutedEvent<KeyEventArgs> KeyUpEvent =
@ -59,22 +59,22 @@ namespace Perspex.Input
public static readonly RoutedEvent<PointerEventArgs> PointerMovedEvent =
RoutedEvent.Register<InputElement, PointerEventArgs>(
"PointerMove",
"PointerMove",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
public static readonly RoutedEvent<PointerPressEventArgs> PointerPressedEvent =
RoutedEvent.Register<InputElement, PointerPressEventArgs>(
"PointerPressed",
"PointerPressed",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
public static readonly RoutedEvent<PointerEventArgs> PointerReleasedEvent =
RoutedEvent.Register<InputElement, PointerEventArgs>(
"PointerReleased",
"PointerReleased",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
public static readonly RoutedEvent<PointerWheelEventArgs> PointerWheelChangedEvent =
RoutedEvent.Register<InputElement, PointerWheelEventArgs>(
"PointerWheelChanged",
"PointerWheelChanged",
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
static InputElement()

4
Perspex.Input/InputExtensions.cs

@ -16,9 +16,9 @@ namespace Perspex.Input
{
Contract.Requires<NullReferenceException>(element != null);
if (element.Bounds.Contains(p) &&
if (element.Bounds.Contains(p) &&
element.IsVisible &&
element.IsHitTestVisible &&
element.IsHitTestVisible &&
element.IsEnabledCore)
{
p -= element.Bounds.Position;

2
Perspex.Input/KeyboardNavigationMode.cs

@ -7,7 +7,7 @@
namespace Perspex.Input
{
/// <summary>
/// Defines the mode of keyboard traversal within a container when the tab or arrow keys are
/// Defines the mode of keyboard traversal within a container when the tab or arrow keys are
/// pressed.
/// </summary>
public enum KeyboardNavigationMode

4
Perspex.Input/MouseDevice.cs

@ -222,8 +222,8 @@ namespace Perspex.Input
private IInteractive GetSource(IVisual hit)
{
return this.Captured ??
(hit as IInteractive) ??
return this.Captured ??
(hit as IInteractive) ??
hit.GetSelfAndVisualAncestors().OfType<IInteractive>().FirstOrDefault();
}

6
Perspex.Input/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Input")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

6
Perspex.Input/Raw/RawKeyEventArgs.cs

@ -15,10 +15,10 @@ namespace Perspex.Input.Raw
public class RawKeyEventArgs : RawInputEventArgs
{
public RawKeyEventArgs(
IKeyboardDevice device,
IKeyboardDevice device,
uint timestamp,
RawKeyEventType type,
Key key,
RawKeyEventType type,
Key key,
string text)
: base(device, timestamp)
{

10
Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Interactive.UnitTests")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

6
Perspex.Interactivity/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Interactive")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

42
Perspex.Interactivity/RoutedEvent.cs

@ -24,7 +24,7 @@ namespace Perspex.Interactivity
private List<ClassEventSubscription> subscriptions = new List<ClassEventSubscription>();
public RoutedEvent(
string name,
string name,
RoutingStrategies routingStrategies,
Type eventArgsType,
Type ownerType)
@ -40,28 +40,28 @@ namespace Perspex.Interactivity
this.RoutingStrategies = routingStrategies;
}
public Type EventArgsType
{
get;
private set;
public Type EventArgsType
{
get;
private set;
}
public string Name
{
get;
private set;
public string Name
{
get;
private set;
}
public Type OwnerType
{
get;
private set;
public Type OwnerType
{
get;
private set;
}
public RoutingStrategies RoutingStrategies
{
get;
private set;
public RoutingStrategies RoutingStrategies
{
get;
private set;
}
public static RoutedEvent<TEventArgs> Register<TOwner, TEventArgs>(
@ -77,7 +77,7 @@ namespace Perspex.Interactivity
public static RoutedEvent<TEventArgs> Register<TEventArgs>(
string name,
RoutingStrategies routingStrategy,
Type ownerType)
Type ownerType)
where TEventArgs : RoutedEventArgs
{
Contract.Requires<NullReferenceException>(name != null);
@ -126,15 +126,15 @@ namespace Perspex.Interactivity
public void AddClassHandler<TTarget>(
Func<TTarget, Action<TEventArgs>> handler,
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble)
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble)
where TTarget : class
{
this.AddClassHandler(typeof(TTarget), (s, e) => ClassHandlerAdapter<TTarget>(s, e, handler), routes);
}
private static void ClassHandlerAdapter<TTarget>(
object sender,
RoutedEventArgs e,
object sender,
RoutedEventArgs e,
Func<TTarget, Action<TEventArgs>> handler) where TTarget : class
{
var target = sender as TTarget;

14
Perspex.Layout/GlobalSuppressions.cs

@ -0,0 +1,14 @@
// -----------------------------------------------------------------------
// <copyright file="GlobalSuppressions.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"StyleCop.CSharp.MaintainabilityRules",
"SA1401:Fields must be private",
Justification = "Routed event fields should not be private.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"StyleCop.CSharp.DocumentationRules",
"SA1609:Property documentation must have value",
Justification = "This rule is fscking pointless")]

4
Perspex.Layout/ILayoutManager.cs

@ -15,7 +15,7 @@ namespace Perspex.Layout
/// <remarks>
/// Each layout root element such as a window has its own LayoutManager that is responsible
/// for laying out its child controls. When a layout is required the <see cref="LayoutNeeded"/>
/// observable will fire and the root element should respond by calling
/// observable will fire and the root element should respond by calling
/// <see cref="ExecuteLayoutPass"/> at the earliest opportunity to carry out the layout.
/// </remarks>
public interface ILayoutManager
@ -42,7 +42,7 @@ namespace Perspex.Layout
/// Gets a value indicating whether a layout is queued.
/// </summary>
/// <remarks>
/// Returns true when <see cref="LayoutNeeded"/> has been fired, but
/// Returns true when <see cref="LayoutNeeded"/> has been fired, but
/// <see cref="ExecuteLayoutPass"/> has not yet been called.
/// </remarks>
bool LayoutQueued { get; }

6
Perspex.Layout/LayoutManager.cs

@ -8,12 +8,12 @@ namespace Perspex.Layout
{
using System;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Subjects;
using NGenerics.DataStructures.General;
using Perspex.VisualTree;
using Serilog;
using Serilog.Core.Enrichers;
using System.Reactive.Disposables;
/// <summary>
/// Manages measuring and arranging of controls.
@ -21,7 +21,7 @@ namespace Perspex.Layout
/// <remarks>
/// Each layout root element such as a window has its own LayoutManager that is responsible
/// for laying out its child controls. When a layout is required the <see cref="LayoutNeeded"/>
/// observable will fire and the root element should respond by calling
/// observable will fire and the root element should respond by calling
/// <see cref="ExecuteLayoutPass"/> at the earliest opportunity to carry out the layout.
/// </remarks>
public class LayoutManager : ILayoutManager
@ -108,7 +108,7 @@ namespace Perspex.Layout
/// Gets a value indicating whether a layout is queued.
/// </summary>
/// <remarks>
/// Returns true when <see cref="LayoutNeeded"/> has been fired, but
/// Returns true when <see cref="LayoutNeeded"/> has been fired, but
/// <see cref="ExecuteLayoutPass"/> has not yet been called.
/// </remarks>
public bool LayoutQueued

2
Perspex.Layout/Layoutable.cs

@ -218,7 +218,7 @@ namespace Perspex.Layout
throw new InvalidOperationException("Invalid Arrange rectangle.");
}
// If the measure was invalidated during an arrange pass, wait for the measure pass to
// If the measure was invalidated during an arrange pass, wait for the measure pass to
// be re-run.
if (!this.IsMeasureValid)
{

6
Perspex.Layout/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Layout")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

1
Perspex.SceneGraph/IVisual.cs

@ -8,6 +8,7 @@ namespace Perspex
{
using Perspex.Collections;
using Perspex.Media;
using Perspex.VisualTree;
/// <summary>
/// Represents a node in the visual scene graph.

30
Perspex.SceneGraph/Matrix.cs

@ -94,6 +94,21 @@ namespace Perspex
(left.offsetX * right.M12) + (left.offsetY * right.M22) + right.offsetY);
}
public static Matrix operator -(Matrix matrix)
{
return matrix.Invert();
}
public static bool operator ==(Matrix matrix1, Matrix matrix2)
{
return matrix1.Equals(matrix2);
}
public static bool operator !=(Matrix matrix1, Matrix matrix2)
{
return !matrix1.Equals(matrix2);
}
public static bool Equals(Matrix matrix1, Matrix matrix2)
{
return matrix1.Equals(matrix2);
@ -131,21 +146,6 @@ namespace Perspex
return angle * 0.0174532925;
}
public static Matrix operator -(Matrix matrix)
{
return matrix.Invert();
}
public static bool operator ==(Matrix matrix1, Matrix matrix2)
{
return matrix1.Equals(matrix2);
}
public static bool operator !=(Matrix matrix1, Matrix matrix2)
{
return !matrix1.Equals(matrix2);
}
public bool Equals(Matrix value)
{
return this.m11 == value.M11 &&

10
Perspex.SceneGraph/Media/FormattedText.cs

@ -31,10 +31,10 @@ namespace Perspex.Media
var platform = Locator.Current.GetService<IPlatformRenderInterface>();
this.PlatformImpl = platform.CreateFormattedText(
text,
fontFamilyName,
fontSize,
fontStyle,
text,
fontFamilyName,
fontSize,
fontStyle,
textAlignment,
fontWeight);
}
@ -122,4 +122,4 @@ namespace Perspex.Media
this.PlatformImpl.SetForegroundBrush(brush, startIndex, count);
}
}
}
}

2
Perspex.SceneGraph/Media/FormattedTextLine.cs

@ -18,4 +18,4 @@ namespace Perspex.Media
public double Height { get; private set; }
}
}
}

14
Perspex.SceneGraph/Media/IDrawingContext.cs

@ -14,8 +14,18 @@ namespace Perspex.Media
/// </summary>
public interface IDrawingContext : IDisposable
{
/// <summary>
/// Gets the current transform of the drawing context.
/// </summary>
Matrix CurrentTransform { get; }
/// <summary>
/// Draws a bitmap image.
/// </summary>
/// <param name="source">The bitmap image.</param>
/// <param name="opacity">The opacity to draw with.</param>
/// <param name="sourceRect">The rect in the image to draw.</param>
/// <param name="destRect">The rect in the output to draw to.</param>
void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect);
/// <summary>
@ -23,7 +33,7 @@ namespace Perspex.Media
/// </summary>
/// <param name="pen">The stroke pen.</param>
/// <param name="p1">The first point of the line.</param>
/// <param name="p1">The second point of the line.</param>
/// <param name="p2">The second point of the line.</param>
void DrawLine(Pen pen, Point p1, Point p2);
/// <summary>
@ -39,6 +49,7 @@ namespace Perspex.Media
/// </summary>
/// <param name="pen">The pen.</param>
/// <param name="rect">The rectangle bounds.</param>
/// <param name="cornerRadius">The corner radius.</param>
void DrawRectange(Pen pen, Rect rect, float cornerRadius = 0.0f);
/// <summary>
@ -54,6 +65,7 @@ namespace Perspex.Media
/// </summary>
/// <param name="brush">The brush.</param>
/// <param name="rect">The rectangle bounds.</param>
/// <param name="cornerRadius">The corner radius.</param>
void FillRectange(Brush brush, Rect rect, float cornerRadius = 0.0f);
/// <summary>

4
Perspex.SceneGraph/Media/PathMarkupParser.cs

@ -174,7 +174,7 @@ namespace Perspex.Media
if (!Commands.TryGetValue(c, out command))
{
if ((char.IsDigit(c) || c == '.' || c == '+' || c == '-') &&
if ((char.IsDigit(c) || c == '.' || c == '+' || c == '-') &&
(lastCommand != Command.None))
{
return lastCommand;
@ -198,7 +198,7 @@ namespace Perspex.Media
bool readPoint = false;
bool readExponent = false;
int i;
while ((i = reader.Peek()) != -1)
{
char c = char.ToUpperInvariant((char)i);

8
Perspex.SceneGraph/Media/SolidColorBrush.cs

@ -32,10 +32,10 @@ namespace Perspex.Media
/// <summary>
/// Gets the color of the brush.
/// </summary>
public Color Color
{
get;
private set;
public Color Color
{
get;
private set;
}
public override string ToString()

4
Perspex.SceneGraph/Origin.cs

@ -46,8 +46,8 @@ namespace Perspex
public Point ToPixels(Size size)
{
return this.unit == OriginUnit.Pixels ?
this.point :
return this.unit == OriginUnit.Pixels ?
this.point :
new Point(this.point.X * size.Width, this.point.Y * size.Height);
}
}

6
Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs

@ -13,9 +13,9 @@ namespace Perspex.Platform
IBitmapImpl CreateBitmap(int width, int height);
IFormattedTextImpl CreateFormattedText(
string text,
string fontFamily,
double fontSize,
string text,
string fontFamily,
double fontSize,
FontStyle fontStyle,
TextAlignment textAlignment,
FontWeight fontWeight);

65
Perspex.SceneGraph/Point.cs

@ -50,6 +50,15 @@ namespace Perspex
get { return this.y; }
}
/// <summary>
/// Converts the <see cref="Point"/> to a <see cref="Vector"/>.
/// </summary>
/// <param name="p">The point.</param>
public static implicit operator Vector(Point p)
{
return new Vector(p.x, p.y);
}
/// <summary>
/// Checks for equality between two <see cref="Point"/>s.
/// </summary>
@ -72,26 +81,56 @@ namespace Perspex
return !(left == right);
}
/// <summary>
/// Adds two points.
/// </summary>
/// <param name="a">The first point.</param>
/// <param name="b">The second point.</param>
/// <returns>A point that is the result of the addition.</returns>
public static Point operator +(Point a, Point b)
{
return new Point(a.x + b.x, a.y + b.y);
}
/// <summary>
/// Adds a vector to a point.
/// </summary>
/// <param name="a">The point.</param>
/// <param name="b">The vector.</param>
/// <returns>A point that is the result of the addition.</returns>
public static Point operator +(Point a, Vector b)
{
return new Point(a.x + b.X, a.y + b.Y);
}
/// <summary>
/// Subtracts two points.
/// </summary>
/// <param name="a">The first point.</param>
/// <param name="b">The second point.</param>
/// <returns>A point that is the result of the subtraction.</returns>
public static Point operator -(Point a, Point b)
{
return new Point(a.x - b.x, a.y - b.y);
}
/// <summary>
/// Subtracts a vector from a point.
/// </summary>
/// <param name="a">The point.</param>
/// <param name="b">The vector.</param>
/// <returns>A point that is the result of the subtraction.</returns>
public static Point operator -(Point a, Vector b)
{
return new Point(a.x - b.X, a.y - b.Y);
}
/// <summary>
/// Applies a matrix to a point.
/// </summary>
/// <param name="point">The point.</param>
/// <param name="matrix">The matrix.</param>
/// <returns>The resulting point.</returns>
public static Point operator *(Point point, Matrix matrix)
{
return new Point(
@ -99,11 +138,13 @@ namespace Perspex
(point.X * matrix.M12) + (point.Y * matrix.M22) + matrix.OffsetY);
}
public static implicit operator Vector(Point p)
{
return new Vector(p.x, p.y);
}
/// <summary>
/// Checks for equality between a point and an object.
/// </summary>
/// <param name="obj">The object.</param>
/// <returns>
/// True if <paramref name="obj"/> is a point that equals the current point.
/// </returns>
public override bool Equals(object obj)
{
if (obj is Point)
@ -115,6 +156,10 @@ namespace Perspex
return false;
}
/// <summary>
/// Returns a hash code for a <see cref="Point"/>.
/// </summary>
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
unchecked
@ -135,11 +180,21 @@ namespace Perspex
return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y);
}
/// <summary>
/// Returns a new point with the specified X coordinate.
/// </summary>
/// <param name="x">The X coordinate.</param>
/// <returns>The new point.</returns>
public Point WithX(double x)
{
return new Point(x, this.y);
}
/// <summary>
/// Returns a new point with the specified Y coordinate.
/// </summary>
/// <param name="y">The Y coordinate.</param>
/// <returns>The new point.</returns>
public Point WithY(double y)
{
return new Point(this.x, y);

6
Perspex.SceneGraph/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.SceneGraph")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

10
Perspex.SceneGraph/Rect.cs

@ -77,8 +77,8 @@ namespace Perspex
/// <summary>
/// Initializes a new instance of the <see cref="Rect"/> structure.
/// </summary>
/// <param name="position">The top left position of the rectangle.</param>
/// <param name="buttonRight">The bottom right position of the rectangle.</param>
/// <param name="topLeft">The top left position of the rectangle.</param>
/// <param name="bottomRight">The bottom right position of the rectangle.</param>
public Rect(Point topLeft, Point bottomRight)
{
this.x = topLeft.X;
@ -369,11 +369,11 @@ namespace Perspex
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"{0}, {1}, {2}, {3}",
CultureInfo.InvariantCulture,
"{0}, {1}, {2}, {3}",
this.x,
this.y,
this.width,
this.width,
this.height);
}
}

6
Perspex.SceneGraph/Rendering/RendererBase.cs

@ -19,7 +19,7 @@ namespace Perspex.Rendering
public abstract class RendererBase : IRenderer
{
/// <summary>
/// Gets the number of times <see cref="Render"/> has been called.
/// Gets the number of times <see cref="Render(IVisual, IPlatformHandle)"/> has been called.
/// </summary>
public int RenderCount
{
@ -50,7 +50,7 @@ namespace Perspex.Rendering
public abstract void Resize(int width, int height);
/// <summary>
/// When overriden by a derived class creates an <see cref="IDrawingContext"/> for a
/// When overriden by a derived class creates an <see cref="IDrawingContext"/> for a
/// rendering session.
/// </summary>
/// <param name="handle">The handle to use to create the context.</param>
@ -62,6 +62,8 @@ namespace Perspex.Rendering
/// </summary>
/// <param name="visual">The visual to render.</param>
/// <param name="context">The drawing context.</param>
/// <param name="translation">The current translation.</param>
/// <param name="transform">The current transform.</param>
protected virtual void Render(IVisual visual, IDrawingContext context, Matrix translation, Matrix transform)
{
var opacity = visual.Opacity;

15
Perspex.SceneGraph/Size.cs

@ -81,7 +81,7 @@ namespace Perspex
/// <summary>
/// Scales a size.
/// </summary>
/// <param name="rect">The size</param>
/// <param name="size">The size</param>
/// <param name="scale">The scaling factor.</param>
/// <returns>The scaled size.</returns>
public static Size operator *(Size size, Vector scale)
@ -92,7 +92,7 @@ namespace Perspex
/// <summary>
/// Scales a size.
/// </summary>
/// <param name="rect">The size</param>
/// <param name="size">The size</param>
/// <param name="scale">The scaling factor.</param>
/// <returns>The scaled size.</returns>
public static Size operator /(Size size, Vector scale)
@ -125,6 +125,13 @@ namespace Perspex
Math.Max(0, this.height - thickness.Top - thickness.Bottom));
}
/// <summary>
/// Checks for equality between a size and an object.
/// </summary>
/// <param name="obj">The object.</param>
/// <returns>
/// True if <paramref name="obj"/> is a size that equals the current size.
/// </returns>
public override bool Equals(object obj)
{
if (obj is Size)
@ -136,6 +143,10 @@ namespace Perspex
return false;
}
/// <summary>
/// Returns a hash code for a <see cref="Size"/>.
/// </summary>
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
unchecked

2
Perspex.SceneGraph/Thickness.cs

@ -45,7 +45,7 @@ namespace Perspex
/// Initializes a new instance of the <see cref="Thickness"/> structure.
/// </summary>
/// <param name="horizontal">The thickness on the left and right.</param>
/// <param name="top">The thickness on the top and bottom.</param>
/// <param name="vertical">The thickness on the top and bottom.</param>
public Thickness(double horizontal, double vertical)
{
Contract.Requires<ArgumentException>(horizontal >= 0);

41
Perspex.SceneGraph/Vector.cs

@ -51,26 +51,47 @@ namespace Perspex
get { return this.y; }
}
/// <summary>
/// Converts the <see cref="Vector"/> to a <see cref="Point"/>.
/// </summary>
/// <param name="a">The vector.</param>
public static explicit operator Point(Vector a)
{
return new Point(a.x, a.y);
}
/// <summary>
/// Negates a vector.
/// </summary>
/// <param name="a">The vector.</param>
/// <returns>The negated vector.</returns>
public static Vector operator -(Vector a)
{
return new Vector(-a.x, -a.y);
}
/// <summary>
/// Adds two vectors.
/// </summary>
/// <param name="a">The first vector.</param>
/// <param name="b">The second vector.</param>
/// <returns>A vector that is the result of the addition.</returns>
public static Vector operator +(Vector a, Vector b)
{
return new Vector(a.x + b.x, a.y + b.y);
}
/// <summary>
/// Subtracts two vectors.
/// </summary>
/// <param name="a">The first vector.</param>
/// <param name="b">The second vector.</param>
/// <returns>A vector that is the result of the subtraction.</returns>
public static Vector operator -(Vector a, Vector b)
{
return new Vector(a.x - b.x, a.y - b.y);
}
public static explicit operator Point(Vector a)
{
return new Point(a.x, a.y);
}
/// <summary>
/// Returns the string representation of the point.
/// </summary>
@ -80,11 +101,21 @@ namespace Perspex
return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y);
}
/// <summary>
/// Returns a new vector with the specified X coordinate.
/// </summary>
/// <param name="x">The X coordinate.</param>
/// <returns>The new vector.</returns>
public Vector WithX(double x)
{
return new Vector(x, this.y);
}
/// <summary>
/// Returns a new vector with the specified Y coordinate.
/// </summary>
/// <param name="y">The Y coordinate.</param>
/// <returns>The new vector.</returns>
public Vector WithY(double y)
{
return new Vector(this.x, y);

6
Perspex.SceneGraph/Visual.cs

@ -198,7 +198,6 @@ namespace Perspex
get { return this.isAttachedToVisualTree; }
}
/// <summary>
/// Gets the scene graph node's child nodes.
/// </summary>
@ -417,7 +416,8 @@ namespace Perspex
}
/// <summary>
/// Called when the <see cref="RenderTransform.Changed"/> event is fired.
/// Called when the <see cref="RenderTransform"/>'s <see cref="Transform.Changed"/> event
/// is fired.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The event args.</param>
@ -508,7 +508,7 @@ namespace Perspex
}
/// <summary>
/// Calls the <see cref="OnDetachedToVisualTree(IRenderRoot)"/> method for this control
/// Calls the <see cref="OnDetachedFromVisualTree(IRenderRoot)"/> method for this control
/// and all of its visual descendents.
/// </summary>
/// <param name="root">The root of the visual tree.</param>

2
Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="IVisualTreeHost.cs" company="Steven Kirk">
// <copyright file="IHostedVisualTreeRoot.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

6
Perspex.Styling/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Styling")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

2
Perspex.Styling/Styling/INamed.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="TemplateExtensions.cs" company="Steven Kirk">
// <copyright file="INamed.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

2
Perspex.Styling/Styling/Selector.cs

@ -62,7 +62,7 @@ namespace Perspex.Styling
{
List<IObservable<bool>> inputs = new List<IObservable<bool>>();
Selector selector = this;
while (selector != null)
{
if (selector.inTemplate && control.TemplatedParent == null)

6
Perspex.Styling/Styling/SelectorMatch.cs

@ -12,8 +12,8 @@ namespace Perspex.Styling
/// Holds the result of a <see cref="Selector"/> match.
/// </summary>
/// <remarks>
/// There are two types of selectors - ones whose match can never change for a particular
/// control (such as <see cref="Selectors.OfType{T}(Selector)"/>) and ones whose result can
/// There are two types of selectors - ones whose match can never change for a particular
/// control (such as <see cref="Selectors.OfType{T}(Selector)"/>) and ones whose result can
/// change over time (such as <see cref="Selectors.Class(Selector, string)"/>. For the first
/// category of selectors, the value of <see cref="ImmediateResult"/> will be set but for the
/// second, <see cref="ImmediateResult"/> will be null and <see cref="ObservableResult"/> will
@ -44,7 +44,7 @@ namespace Perspex.Styling
}
/// <summary>
/// Gets the immedate result of the selector match, in the case of selectors that cannot
/// Gets the immedate result of the selector match, in the case of selectors that cannot
/// change over time.
/// </summary>
public bool? ImmediateResult { get; }

8
Perspex.Styling/Styling/Selectors.cs

@ -79,10 +79,10 @@ namespace Perspex.Styling
Contract.Requires<ArgumentNullException>(previous != null);
return new Selector(
previous,
x => MatchTemplate(x, previous),
" /deep/ ",
inTemplate: true,
previous,
x => MatchTemplate(x, previous),
" /deep/ ",
inTemplate: true,
stopTraversal: true);
}

8
Perspex.Styling/Styling/StyleActivator.cs

@ -28,7 +28,7 @@ namespace Perspex.Styling
private List<IObserver<bool>> observers = new List<IObserver<bool>>();
public StyleActivator(
IList<IObservable<bool>> inputs,
IList<IObservable<bool>> inputs,
ActivatorMode mode = ActivatorMode.And)
{
int i = 0;
@ -97,7 +97,7 @@ namespace Perspex.Styling
this.values[index] = value;
bool current;
switch (this.mode)
{
case ActivatorMode.And:
@ -121,10 +121,10 @@ namespace Perspex.Styling
{
// We can unsubscribe from everything if the completed observable:
// - Is the only subscription.
// - Has finished on 'false' and we're in And mode
// - Has finished on 'false' and we're in And mode
// - Has finished on 'true' and we're in Or mode
var value = this.values[i];
var unsubscribe =
var unsubscribe =
(this.values.Length == 1) ||
(this.mode == ActivatorMode.And ? !value : value);

5
Perspex.Styling/Styling/StyleBinding.cs

@ -14,8 +14,9 @@ namespace Perspex.Styling
/// </summary>
/// <remarks>
/// This class takes an activator and a value. The activator is an observable which produces
/// a bool. When the activator produces true, this observable will produce <see cref="Value"/>.
/// When the activator produces false it will produce <see cref="PerspexProperty.UnsetValue"/>.
/// a bool. When the activator produces true, this observable will produce
/// <see cref="ActivatedValue"/>. When the activator produces false it will produce
/// <see cref="PerspexProperty.UnsetValue"/>.
/// </remarks>
internal class StyleBinding : ObservableBase<object>, IDescription
{

2
Perspex.Themes.Default/ContentControlStyle.cs

@ -31,7 +31,7 @@ namespace Perspex.Themes.Default
private Control Template(ContentControl control)
{
return new ContentPresenter
{
{
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
};

3
Perspex.Themes.Default/DropDownStyle.cs

@ -120,7 +120,8 @@ namespace Perspex.Themes.Default
PlacementTarget = control,
StaysOpen = false,
[~~Popup.IsOpenProperty] = control[~~DropDown.IsDropDownOpenProperty],
[~Popup.MinWidthProperty] = control[~DropDown.BoundsProperty].Cast<Rect>().Select(x => (object)x.Width), }
[~Popup.MinWidthProperty] = control[~DropDown.BoundsProperty].Cast<Rect>().Select(x => (object)x.Width),
}
},
},
};

6
Perspex.Themes.Default/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Themes.Default")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

2
Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs

@ -203,7 +203,7 @@ namespace Perspex.Base.UnitTests
public double Value { get; }
public static implicit operator double (ImplictDouble v)
public static implicit operator double(ImplictDouble v)
{
return v.Value;
}

2
Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs

@ -118,7 +118,7 @@ namespace Perspex.Base.UnitTests
private class Class1 : PerspexObject
{
public static readonly PerspexProperty<string> FooProperty =
public static readonly PerspexProperty<string> FooProperty =
PerspexProperty.Register<Class1, string>("Foo", "default");
}

4
Tests/Perspex.Base.UnitTests/PriorityValueTests.cs

@ -177,7 +177,7 @@ namespace Perspex.Base.UnitTests
var target = new PriorityValue("Test", typeof(string));
bool called = false;
target.Changed.Subscribe(value => called = (value.Item1 == PerspexProperty.UnsetValue && (string)value.Item2 == "foo"));
target.Changed.Subscribe(value => called = value.Item1 == PerspexProperty.UnsetValue && (string)value.Item2 == "foo");
target.Add(this.Single("foo"), 0);
Assert.True(called);
@ -191,7 +191,7 @@ namespace Perspex.Base.UnitTests
bool called = false;
target.Add(subject, 0);
target.Changed.Subscribe(value => called = ((string)value.Item1 == "foo" && (string)value.Item2 == "bar"));
target.Changed.Subscribe(value => called = (string)value.Item1 == "foo" && (string)value.Item2 == "bar");
subject.OnNext("bar");
Assert.True(called);

10
Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.UnitTests")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

3
Tests/Perspex.Controls.UnitTests/ContentControlTests.cs

@ -9,12 +9,11 @@ namespace Perspex.Controls.UnitTests
using System;
using System.Collections.Specialized;
using System.Linq;
using LogicalTree;
using Moq;
using Perspex.Controls;
using Perspex.Controls.Presenters;
using Perspex.Controls.Templates;
using Perspex.Layout;
using LogicalTree;
using Perspex.Platform;
using Perspex.Styling;
using Perspex.VisualTree;

30
Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="ScrollPresenterTests.cs" company="Steven Kirk">
// <copyright file="ScrollContentPresenterTests.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
@ -10,8 +10,8 @@ namespace Perspex.Controls.UnitTests.Presenters
using System.Collections.Generic;
using System.Reactive.Linq;
using Perspex.Controls.Presenters;
using Xunit;
using Perspex.Layout;
using Xunit;
public class ScrollContentPresenterTests
{
@ -21,11 +21,11 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Padding = new Thickness(8),
HorizontalAlignment = HorizontalAlignment.Left
}),
},
};
target.Measure(new Size(100, 100));
@ -40,10 +40,10 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Padding = new Thickness(8),
}),
},
};
target.Measure(new Size(100, 100));
@ -58,11 +58,11 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Padding = new Thickness(8),
HorizontalAlignment = HorizontalAlignment.Right
}),
},
};
target.Measure(new Size(100, 100));
@ -77,11 +77,11 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Padding = new Thickness(8),
VerticalAlignment = VerticalAlignment.Bottom,
}),
},
};
target.Measure(new Size(100, 100));
@ -96,12 +96,12 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Padding = new Thickness(8),
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
}),
},
};
target.Measure(new Size(100, 100));
@ -116,7 +116,7 @@ namespace Perspex.Controls.UnitTests.Presenters
TestControl content;
var target = new ScrollContentPresenter
{
Content = (content = new TestControl()),
Content = content = new TestControl(),
};
target.Measure(new Size(100, 100));
@ -131,11 +131,11 @@ namespace Perspex.Controls.UnitTests.Presenters
Border content;
var target = new ScrollContentPresenter
{
Content = (content = new Border
Content = content = new Border
{
Width = 150,
Height = 150,
}),
},
Offset = new Vector(25, 25),
};

10
Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perspex.Controls.UnitTests")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

1
Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs

@ -13,7 +13,6 @@ namespace Perspex.Controls.UnitTests
using Perspex.Controls.Templates;
using Perspex.VisualTree;
using Xunit;
using Perspex.Layout;
public class ScrollViewerTests
{

2
Tests/Perspex.Controls.UnitTests/TabControlTests.cs

@ -6,13 +6,13 @@
namespace Perspex.Controls.UnitTests
{
using System.Collections.ObjectModel;
using System.Linq;
using Perspex.Controls.Presenters;
using Perspex.Controls.Primitives;
using Perspex.Controls.Templates;
using Perspex.LogicalTree;
using Xunit;
using System.Collections.ObjectModel;
public class TabControlTests
{

12
Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs

@ -23,8 +23,8 @@ namespace Perspex.Controls.UnitTests
public void Template_Doesnt_Get_Executed_On_Set()
{
bool executed = false;
var template = new ControlTemplate(_ =>
var template = new ControlTemplate(_ =>
{
executed = true;
return new Control();
@ -155,7 +155,7 @@ namespace Perspex.Controls.UnitTests
var root = new TestRoot
{
Child = (target = new TestTemplatedControl
Child = target = new TestTemplatedControl
{
Template = new ControlTemplate(_ =>
{
@ -169,10 +169,9 @@ namespace Perspex.Controls.UnitTests
}
};
}),
})
}
};
target.ApplyTemplate();
styler.Verify(x => x.ApplyStyles(It.IsAny<TestTemplatedControl>()), Times.Once());
@ -218,7 +217,7 @@ namespace Perspex.Controls.UnitTests
{
return new ContentPresenter
{
Content = new TextBlock
Content = new TextBlock
{
}
};
@ -274,4 +273,3 @@ namespace Perspex.Controls.UnitTests
}
}
}

4
Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="TestRoot.cs" company="Steven Kirk">
// <copyright file="TestTemplatedControl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
@ -12,7 +12,7 @@ namespace Perspex.Controls.UnitTests
{
public bool OnTemplateAppliedCalled { get; private set; }
public new void AddVisualChild(Visual visual)
public new void AddVisualChild(IVisual visual)
{
base.AddVisualChild(visual);
}

8
Tests/Perspex.Controls.UnitTests/TopLevelTests.cs

@ -295,10 +295,10 @@ namespace Perspex.Controls.UnitTests
var target = new TestTopLevel(impl.Object);
var input = new RawKeyEventArgs(
new Mock<IKeyboardDevice>().Object,
0,
RawKeyEventType.KeyDown,
Key.A,
new Mock<IKeyboardDevice>().Object,
0,
RawKeyEventType.KeyDown,
Key.A,
"A");
impl.Object.Input(input);

12
Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="GeometryTests.cs" company="Steven Kirk">
// <copyright file="PathTests.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
@ -14,10 +14,10 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes
public class PathTests
{
private static readonly RectComparer compare = new RectComparer();
private static readonly RectComparer Compare = new RectComparer();
[Fact]
void Should_Measure_Expander_Triangle_Correctly()
public void Should_Measure_Expander_Triangle_Correctly()
{
using (Locator.CurrentMutable.WithResolver())
{
@ -35,12 +35,12 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes
target.Measure(new Size(100, 100));
target.Arrange(new Rect(0, 0, 100, 100));
Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, compare);
Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, Compare);
}
}
[Fact]
void Should_Measure_Expander_Triangle_With_Stroke_Correctly()
public void Should_Measure_Expander_Triangle_With_Stroke_Correctly()
{
using (Locator.CurrentMutable.WithResolver())
{
@ -69,7 +69,7 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes
//
// However Path.Measure doesn't correctly handle strokes currently, so testing for
// the (incorrect) current output for now...
Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, compare);
Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, Compare);
}
}
}

10
Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs

@ -12,10 +12,10 @@ namespace Perspex.Direct2D1.UnitTests.Media
public class GeometryTests
{
private static readonly RectComparer compare = new RectComparer();
private static readonly RectComparer Compare = new RectComparer();
[Fact]
void Should_Measure_Expander_Triangle_Correctly()
public void Should_Measure_Expander_Triangle_Correctly()
{
using (Locator.CurrentMutable.WithResolver())
{
@ -23,12 +23,12 @@ namespace Perspex.Direct2D1.UnitTests.Media
var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z");
Assert.Equal(new Rect(0, 2, 4, 8), target.Bounds, compare);
Assert.Equal(new Rect(0, 2, 4, 8), target.Bounds, Compare);
}
}
[Fact]
void Should_Measure_Expander_Triangle_With_Stroke_Correctly()
public void Should_Measure_Expander_Triangle_With_Stroke_Correctly()
{
using (Locator.CurrentMutable.WithResolver())
{
@ -36,7 +36,7 @@ namespace Perspex.Direct2D1.UnitTests.Media
var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z");
Assert.Equal(new Rect(-1, -0.414, 6.414, 12.828), target.GetRenderBounds(2), compare);
Assert.Equal(new Rect(-1, -0.414, 6.414, 12.828), target.GetRenderBounds(2), Compare);
}
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save