Browse Source

Stylecop fixes.

pull/58/head
Steven Kirk 11 years ago
parent
commit
a143257ced
  1. 31
      Perspex.Controls/TopLevel.cs

31
Perspex.Controls/TopLevel.cs

@ -6,6 +6,9 @@
namespace Perspex.Controls namespace Perspex.Controls
{ {
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Perspex.Input; using Perspex.Input;
using Perspex.Input.Raw; using Perspex.Input.Raw;
using Perspex.Layout; using Perspex.Layout;
@ -14,16 +17,13 @@ namespace Perspex.Controls
using Perspex.Styling; using Perspex.Styling;
using Perspex.Threading; using Perspex.Threading;
using Splat; using Splat;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
/// <summary> /// <summary>
/// Base class for top-level windows. /// Base class for top-level windows.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This class acts as a base for top level windows such as <see cref="Window"/> and /// This class acts as a base for top level windows such as <see cref="Window"/> and
/// <see cref="PopupRoot"/>. It handles scheduling layout, styling and rendering as well as /// <see cref="PopupRoot"/>. It handles scheduling layout, styling and rendering as well as
/// tracking the window <see cref="ClientSize"/> and <see cref="IsActive"/> state. /// tracking the window <see cref="ClientSize"/> and <see cref="IsActive"/> state.
/// </remarks> /// </remarks>
public abstract class TopLevel : ContentControl, ILayoutRoot, IRenderRoot, ICloseable, IFocusScope public abstract class TopLevel : ContentControl, ILayoutRoot, IRenderRoot, ICloseable, IFocusScope
@ -63,7 +63,7 @@ namespace Perspex.Controls
private bool autoSizing; private bool autoSizing;
/// <summary> /// <summary>
/// Statically initializes the <see cref="TopLevel"/> class. /// Initializes static members of the <see cref="TopLevel"/> class.
/// </summary> /// </summary>
static TopLevel() static TopLevel()
{ {
@ -120,7 +120,7 @@ namespace Perspex.Controls
this.PlatformImpl.Input = this.HandleInput; this.PlatformImpl.Input = this.HandleInput;
this.PlatformImpl.Paint = this.HandlePaint; this.PlatformImpl.Paint = this.HandlePaint;
this.PlatformImpl.Resized = this.HandleResized; this.PlatformImpl.Resized = this.HandleResized;
Size clientSize = this.ClientSize = this.PlatformImpl.ClientSize; Size clientSize = this.ClientSize = this.PlatformImpl.ClientSize;
this.dispatcher = Dispatcher.UIThread; this.dispatcher = Dispatcher.UIThread;
@ -222,6 +222,15 @@ namespace Perspex.Controls
this.PlatformImpl.Activate(); this.PlatformImpl.Activate();
} }
/// <summary>
/// Begins an auto-resize operation.
/// </summary>
/// <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.
/// </remarks>
protected IDisposable BeginAutoSizing() protected IDisposable BeginAutoSizing()
{ {
this.autoSizing = true; this.autoSizing = true;
@ -284,6 +293,7 @@ namespace Perspex.Controls
/// <summary> /// <summary>
/// Handles input from <see cref="ITopLevelImpl.Input"/>. /// Handles input from <see cref="ITopLevelImpl.Input"/>.
/// </summary> /// </summary>
/// <param name="e">The event args.</param>
private void HandleInput(RawInputEventArgs e) private void HandleInput(RawInputEventArgs e)
{ {
this.inputManager.Process(e); this.inputManager.Process(e);
@ -294,7 +304,7 @@ namespace Perspex.Controls
/// </summary> /// </summary>
private void HandleLayoutNeeded() private void HandleLayoutNeeded()
{ {
this.dispatcher.InvokeAsync(LayoutManager.ExecuteLayoutPass, DispatcherPriority.Render); this.dispatcher.InvokeAsync(this.LayoutManager.ExecuteLayoutPass, DispatcherPriority.Render);
} }
/// <summary> /// <summary>
@ -311,13 +321,15 @@ namespace Perspex.Controls
private void HandleRenderNeeded() private void HandleRenderNeeded()
{ {
this.dispatcher.InvokeAsync( this.dispatcher.InvokeAsync(
() => this.PlatformImpl.Invalidate(new Rect(this.ClientSize)), () => this.PlatformImpl.Invalidate(new Rect(this.ClientSize)),
DispatcherPriority.Render); DispatcherPriority.Render);
} }
/// <summary> /// <summary>
/// Handles a paint request from <see cref="ITopLevelImpl.Paint"/>. /// Handles a paint request from <see cref="ITopLevelImpl.Paint"/>.
/// </summary> /// </summary>
/// <param name="rect">The rectangle to paint.</param>
/// <param name="handle">An optional platform-specific handle.</param>
private void HandlePaint(Rect rect, IPlatformHandle handle) private void HandlePaint(Rect rect, IPlatformHandle handle)
{ {
this.renderer.Render(this, handle); this.renderer.Render(this, handle);
@ -327,6 +339,7 @@ namespace Perspex.Controls
/// <summary> /// <summary>
/// Handles a resize notification from <see cref="ITopLevelImpl.Resized"/>. /// Handles a resize notification from <see cref="ITopLevelImpl.Resized"/>.
/// </summary> /// </summary>
/// <param name="clientSize">The new client size.</param>
private void HandleResized(Size clientSize) private void HandleResized(Size clientSize)
{ {
if (!this.autoSizing) if (!this.autoSizing)

Loading…
Cancel
Save