Skip to content

Commit

Permalink
Make the 'XwtComponent.Tag' Property virtual so that it can be overri…
Browse files Browse the repository at this point in the history
…den by a control which in turn makes it possible to set the tag property on the native control itself.
  • Loading branch information
steffenWi committed Dec 2, 2015
1 parent d98cf66 commit 548fd03
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Xwt.WPF/Xwt.WPFBackend/WindowFrameBackend.cs
Expand Up @@ -59,6 +59,7 @@ void IWindowFrameBackend.Initialize (IWindowFrameEventSink eventSink)
Initialize ();
}

public object Tag { get { return window.Tag; } set { window.Tag = value; } }
public ApplicationContext Context { get; private set; }

public virtual void Initialize ()
Expand Down
2 changes: 2 additions & 0 deletions Xwt/Xwt.Backends/IWindowFrameBackend.cs
Expand Up @@ -92,6 +92,8 @@ public interface IWindowFrameBackend: IBackend
/// </summary>
/// <value>The screen.</value>
object Screen { get; }

object Tag { get; set; }
}

public interface IWindowFrameEventSink
Expand Down
4 changes: 3 additions & 1 deletion Xwt/Xwt/WindowFrame.cs
Expand Up @@ -72,7 +72,7 @@ public class WindowFrame: XwtComponent, IAnimatable
bool pendingReallocation;
Image icon;
WindowFrame transientFor;

public override object Tag { get { return Backend.Tag; } set { Backend.Tag = value; } }
protected class WindowBackendHost: BackendHost<WindowFrame,IWindowFrameBackend>, IWindowFrameEventSink
{
protected override void OnBackendCreated ()
Expand All @@ -83,7 +83,9 @@ protected override void OnBackendCreated ()
Parent.size = Backend.Bounds.Size;
Backend.EnableEvent (WindowFrameEvent.BoundsChanged);
}



public void OnBoundsChanged (Rectangle bounds)
{
Parent.OnBoundsChanged (new BoundsChangedEventArgs () { Bounds = bounds });
Expand Down
2 changes: 1 addition & 1 deletion Xwt/Xwt/XwtComponent.cs
Expand Up @@ -76,7 +76,7 @@ protected virtual BackendHost CreateBackendHost ()
/// <summary>
/// A value, that can be used to identify this component
/// </summary>
public object Tag { get; set; }
public virtual object Tag { get; set; }

/// <summary>
/// Maps an event handler of an Xwt component to an event identifier.
Expand Down

0 comments on commit 548fd03

Please sign in to comment.