diff --git a/Perspex.Controls/Platform/IWindowImpl.cs b/Perspex.Controls/Platform/IWindowImpl.cs index 83586d3e9f..f937017901 100644 --- a/Perspex.Controls/Platform/IWindowImpl.cs +++ b/Perspex.Controls/Platform/IWindowImpl.cs @@ -1,22 +1,40 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Platform { using System; - using System.Threading.Tasks; + /// + /// Defines a platform-specific window implementation. + /// public interface IWindowImpl : ITopLevelImpl { + /// + /// Sets the title of the window. + /// + /// The title. void SetTitle(string title); + /// + /// Shows the window. + /// void Show(); + /// + /// Shows the window as a dialog. + /// + /// + /// An that should be used to close the window. + /// IDisposable ShowDialog(); + /// + /// Hides the window. + /// void Hide(); } } diff --git a/Perspex.SceneGraph/Media/EllipseGeometry.cs b/Perspex.SceneGraph/Media/EllipseGeometry.cs index 625ad176dd..6c31dda4a7 100644 --- a/Perspex.SceneGraph/Media/EllipseGeometry.cs +++ b/Perspex.SceneGraph/Media/EllipseGeometry.cs @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -10,8 +10,15 @@ namespace Perspex.Media using Perspex.Platform; using Splat; + /// + /// Represents the geometry of an ellipse or circle. + /// public class EllipseGeometry : Geometry { + /// + /// Initializes a new instance of the class. + /// + /// The rectangle that the ellipse should fill. public EllipseGeometry(Rect rect) { IPlatformRenderInterface factory = Locator.Current.GetService(); @@ -46,11 +53,13 @@ namespace Perspex.Media this.PlatformImpl = impl; } + /// public override Rect Bounds { get { return this.PlatformImpl.Bounds; } } + /// public override Geometry Clone() { return new EllipseGeometry(this.Bounds); diff --git a/Perspex.SceneGraph/Media/Geometry.cs b/Perspex.SceneGraph/Media/Geometry.cs index 0d30a8ca3b..77dede97ae 100644 --- a/Perspex.SceneGraph/Media/Geometry.cs +++ b/Perspex.SceneGraph/Media/Geometry.cs @@ -9,11 +9,20 @@ namespace Perspex.Media using System; using Perspex.Platform; + /// + /// Defines a geometric shape. + /// public abstract class Geometry : PerspexObject { + /// + /// Defines the property. + /// public static readonly PerspexProperty TransformProperty = PerspexProperty.Register("Transform"); + /// + /// Initializes static members of the class. + /// static Geometry() { TransformProperty.Changed.Subscribe(x => @@ -22,25 +31,43 @@ namespace Perspex.Media }); } + /// + /// Gets the geometry's bounding rectangle. + /// public abstract Rect Bounds { get; } + /// + /// Gets the platform-specific implementation of the geometry. + /// public IGeometryImpl PlatformImpl { get; protected set; } + /// + /// Gets or sets a transform to apply to the geometry. + /// public Transform Transform { get { return this.GetValue(TransformProperty); } set { this.SetValue(TransformProperty, value); } } + /// + /// Clones the geometry. + /// + /// A cloned geometry. public abstract Geometry Clone(); + /// + /// Gets the geometry's bounding rectangle with the specified stroke thickness. + /// + /// The stroke thickness. + /// The bounding rectangle. public Rect GetRenderBounds(double strokeThickness) { return this.PlatformImpl.GetRenderBounds(strokeThickness); diff --git a/Perspex.SceneGraph/Media/RectangleGeometry.cs b/Perspex.SceneGraph/Media/RectangleGeometry.cs index 6d89919e26..a2aa83cd76 100644 --- a/Perspex.SceneGraph/Media/RectangleGeometry.cs +++ b/Perspex.SceneGraph/Media/RectangleGeometry.cs @@ -1,17 +1,23 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Media { - using System; using Perspex.Platform; using Splat; + /// + /// Represents the geometry of a rectangle. + /// public class RectangleGeometry : Geometry { + /// + /// Initializes a new instance of the class. + /// + /// The rectangle bounds. public RectangleGeometry(Rect rect) { IPlatformRenderInterface factory = Locator.Current.GetService(); @@ -29,11 +35,13 @@ namespace Perspex.Media this.PlatformImpl = impl; } + /// public override Rect Bounds { get { return this.PlatformImpl.Bounds; } } + /// public override Geometry Clone() { return new RectangleGeometry(this.Bounds); diff --git a/Perspex.SceneGraph/Media/StreamGeometry.cs b/Perspex.SceneGraph/Media/StreamGeometry.cs index f2a013d1ad..8e5eb6425a 100644 --- a/Perspex.SceneGraph/Media/StreamGeometry.cs +++ b/Perspex.SceneGraph/Media/StreamGeometry.cs @@ -1,33 +1,48 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Media { - using System; using Perspex.Platform; using Splat; + /// + /// Represents the geometry of an arbitrarily complex shape. + /// public class StreamGeometry : Geometry { + /// + /// Initializes a new instance of the class. + /// public StreamGeometry() { IPlatformRenderInterface factory = Locator.Current.GetService(); this.PlatformImpl = factory.CreateStreamGeometry(); } + /// + /// Initializes a new instance of the class. + /// + /// The platform-specific implementation. private StreamGeometry(IGeometryImpl impl) { this.PlatformImpl = impl; } + /// public override Rect Bounds { get { return this.PlatformImpl.Bounds; } } + /// + /// Creates a from a string. + /// + /// The string. + /// A . public static StreamGeometry Parse(string s) { StreamGeometry result = new StreamGeometry(); @@ -40,11 +55,18 @@ namespace Perspex.Media } } + /// public override Geometry Clone() { return new StreamGeometry(((IStreamGeometryImpl)this.PlatformImpl).Clone()); } + /// + /// Opens the geometry to start defining it. + /// + /// + /// A which can be used to define the geometry. + /// public StreamGeometryContext Open() { return new StreamGeometryContext(((IStreamGeometryImpl)this.PlatformImpl).Open()); diff --git a/Perspex.SceneGraph/Media/StreamGeometryContext.cs b/Perspex.SceneGraph/Media/StreamGeometryContext.cs index 62d24b3d7e..377c89a735 100644 --- a/Perspex.SceneGraph/Media/StreamGeometryContext.cs +++ b/Perspex.SceneGraph/Media/StreamGeometryContext.cs @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -9,40 +9,85 @@ namespace Perspex.Media using System; using Perspex.Platform; + /// + /// Describes a geometry using drawing commands. + /// + /// + /// This class is used to define the geometry of a . An instance + /// of is obtained by calling + /// . + /// + /// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed? public class StreamGeometryContext : IDisposable { private IStreamGeometryContextImpl impl; + /// + /// Initializes a new instance of the class. + /// + /// The platform-specific implementation. public StreamGeometryContext(IStreamGeometryContextImpl impl) { this.impl = impl; } + /// + /// Draws an arc to the specified point. + /// + /// The destination point. + /// The radii of an oval whose perimeter is used to draw the angle. + /// The rotation angle of the oval that specifies the curve. + /// true to draw the arc greater than 180 degrees; otherwise, false. + /// + /// A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction. + /// public void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection) { this.impl.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection); } + /// + /// Begins a new figure. + /// + /// The starting point for the figure. + /// Whether the figure is filled. public void BeginFigure(Point startPoint, bool isFilled) { this.impl.BeginFigure(startPoint, isFilled); } + /// + /// Draws a Bezier curve to the specified point. + /// + /// The first control point used to specify the shape of the curve. + /// The second control point used to specify the shape of the curve. + /// The destination point for the end of the curve. public void BezierTo(Point point1, Point point2, Point point3) { this.impl.BezierTo(point1, point2, point3); } + /// + /// Draws a line to the specified point. + /// + /// The destination point. public void LineTo(Point point) { this.impl.LineTo(point); } + /// + /// Ends the figure started by . + /// + /// Whether the figure is closed. public void EndFigure(bool isClosed) { this.impl.EndFigure(isClosed); } + /// + /// Finishes the drawing session. + /// public void Dispose() { this.impl.Dispose(); diff --git a/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs b/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs index aacd8801a8..515e296637 100644 --- a/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs +++ b/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------- // -// Copyright 2014 MIT Licence. See licence.md for more information. +// Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -9,16 +9,48 @@ namespace Perspex.Platform using System; using Perspex.Media; + /// + /// Describes a geometry using drawing commands. + /// public interface IStreamGeometryContextImpl : IDisposable { + /// + /// Draws an arc to the specified point. + /// + /// The destination point. + /// The radii of an oval whose perimeter is used to draw the angle. + /// The rotation angle of the oval that specifies the curve. + /// true to draw the arc greater than 180 degrees; otherwise, false. + /// + /// A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction. + /// void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection); + /// + /// Begins a new figure. + /// + /// The starting point for the figure. + /// Whether the figure is filled. void BeginFigure(Point startPoint, bool isFilled); + /// + /// Draws a Bezier curve to the specified point. + /// + /// The first control point used to specify the shape of the curve. + /// The second control point used to specify the shape of the curve. + /// The destination point for the end of the curve. void BezierTo(Point point1, Point point2, Point point3); + /// + /// Draws a line to the specified point. + /// + /// The destination point. void LineTo(Point point); + /// + /// Ends the figure started by . + /// + /// Whether the figure is closed. void EndFigure(bool isClosed); } }