9 changed files with 84 additions and 5 deletions
@ -0,0 +1,31 @@ |
|||||
|
// -----------------------------------------------------------------------
|
||||
|
// <copyright file="IFocusManager.cs" company="Steven Kirk">
|
||||
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
|
// </copyright>
|
||||
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
|
namespace Perspex.Input |
||||
|
{ |
||||
|
public class FocusManager : IFocusManager |
||||
|
{ |
||||
|
public IFocusable Current |
||||
|
{ |
||||
|
get; |
||||
|
private set; |
||||
|
} |
||||
|
|
||||
|
public void Focus(IFocusable control) |
||||
|
{ |
||||
|
if (this.Current != null) |
||||
|
{ |
||||
|
this.Current.IsFocused = false; |
||||
|
} |
||||
|
|
||||
|
if (control != null) |
||||
|
{ |
||||
|
control.IsFocused = true; |
||||
|
this.Current = control; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
// -----------------------------------------------------------------------
|
||||
|
// <copyright file="IFocusManager.cs" company="Steven Kirk">
|
||||
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
|
// </copyright>
|
||||
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
|
namespace Perspex.Input |
||||
|
{ |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
public interface IFocusManager |
||||
|
{ |
||||
|
IFocusable Current { get; } |
||||
|
|
||||
|
void Focus(IFocusable focusable); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue