Skip to content

Commit

Permalink
Merge pull request picoe#945 from picoe/feature/wpf-winformshost-updates
Browse files Browse the repository at this point in the history
WinFormsHostHandler updates.
  • Loading branch information
cwensley authored Jan 9, 2018
2 parents 31bea3d + 981f51d commit c3ccc9f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
49 changes: 49 additions & 0 deletions Source/Eto.Wpf/Forms/WindowsFormsHostHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,54 @@ void WinFormsControl_TextChanged(object sender, EventArgs e)

void WinFormsControl_GotFocus(object sender, EventArgs e) => Callback.OnGotFocus(Widget, EventArgs.Empty);

public override void Focus()
{
if (Widget.Loaded && WinFormsControl.IsHandleCreated)
WinFormsControl.Focus();
else
Widget.LoadComplete += Widget_LoadComplete;
}

void Widget_LoadComplete(object sender, EventArgs e)
{
Widget.LoadComplete -= Widget_LoadComplete;
WinFormsControl.Focus();
}

public override bool HasFocus => WinFormsControl.Focused;

public override bool AllowDrop
{
get { return WinFormsControl.AllowDrop; }
set { WinFormsControl.AllowDrop = value; }
}

public override void SuspendLayout()
{
base.SuspendLayout();
WinFormsControl.SuspendLayout();
}

public override void ResumeLayout()
{
base.ResumeLayout();
WinFormsControl.ResumeLayout();
}

public override void Invalidate(bool invalidateChildren)
{
WinFormsControl.Invalidate(invalidateChildren);
}

public override void Invalidate(Rectangle rect, bool invalidateChildren)
{
WinFormsControl.Invalidate(rect.ToSD(), invalidateChildren);
}

public override bool Enabled
{
get { return WinFormsControl.Enabled; }
set { WinFormsControl.Enabled = value; }
}
}
}
13 changes: 3 additions & 10 deletions Source/Eto.Wpf/Forms/WpfFrameworkElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,10 @@ public string ToolTip
set { Control.ToolTip = value; }
}

public bool AllowDrop
public virtual bool AllowDrop
{
get
{
return Control.AllowDrop;
}

set
{
Control.AllowDrop = value;
}
get { return Control.AllowDrop; }
set { Control.AllowDrop = value; }
}

public virtual void Invalidate(bool invalidateChildren)
Expand Down

0 comments on commit c3ccc9f

Please sign in to comment.