Skip to content

Commit

Permalink
Move Control.TextChanged event to TextControl.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensley committed Oct 26, 2013
1 parent 75097d7 commit 57e6abd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
19 changes: 0 additions & 19 deletions Source/Eto/Forms/Controls/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,6 @@ public virtual void OnKeyUp(KeyEventArgs e)
Parent.OnKeyUp(e);
}

public const string TextChangedEvent = "Control.TextChanged";
EventHandler<EventArgs> textChanged;

public event EventHandler<EventArgs> TextChanged
{
add
{
HandleEvent(TextChangedEvent);
textChanged += value;
}
remove { textChanged -= value; }
}

public virtual void OnTextChanged(EventArgs e)
{
if (textChanged != null)
textChanged(this, e);
}

public const string TextInputEvent = "Control.TextInput";
EventHandler<TextInputEventArgs> textInput;

Expand Down
26 changes: 22 additions & 4 deletions Source/Eto/Forms/Controls/TextControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,41 @@
#if XAML
using System.Windows.Markup;
#endif

namespace Eto.Forms
{
public interface ITextControl : ICommonControl
{
string Text { get; set; }
}

[ContentProperty("Text")]
public abstract class TextControl : CommonControl
{
new ITextControl Handler { get { return (ITextControl)base.Handler; } }

protected TextControl(Generator g, Type type, bool initialize = true) : base(g, type, initialize)
{
}


public const string TextChangedEvent = "Control.TextChanged";
EventHandler<EventArgs> textChanged;

public event EventHandler<EventArgs> TextChanged
{
add
{
HandleEvent(TextChangedEvent);
textChanged += value;
}
remove { textChanged -= value; }
}

public virtual void OnTextChanged(EventArgs e)
{
if (textChanged != null)
textChanged(this, e);
}

public virtual string Text
{
get { return Handler.Text; }
Expand Down

0 comments on commit 57e6abd

Please sign in to comment.