aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CompilerServices/Bindings.cs8
-rw-r--r--src/GraphicObjects/Button.cs6
-rw-r--r--src/GraphicObjects/DataSourceChangeEventArgs.cs (renamed from src/GraphicObjects/IBindable.cs)17
-rw-r--r--src/GraphicObjects/Expandable.cs6
-rw-r--r--src/GraphicObjects/GraphicObject.cs333
-rw-r--r--src/GraphicObjects/Group.cs24
-rw-r--r--src/GraphicObjects/Label.cs4
-rw-r--r--src/GraphicObjects/Popper.cs15
-rw-r--r--src/GraphicObjects/PrivateContainer.cs32
-rw-r--r--src/GraphicObjects/TabItem.cs6
-rw-r--r--src/GraphicObjects/TemplatedContainer.cs13
-rw-r--r--src/GraphicObjects/TemplatedControl.cs2
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs4
-rw-r--r--src/GraphicObjects/Window.cs6
-rw-r--r--src/IMLReader.cs21
-rw-r--r--src/Interface.cs6
16 files changed, 224 insertions, 279 deletions
diff --git a/src/CompilerServices/Bindings.cs b/src/CompilerServices/Bindings.cs
index 64f412f6..2f4077b2 100644
--- a/src/CompilerServices/Bindings.cs
+++ b/src/CompilerServices/Bindings.cs
@@ -199,10 +199,10 @@ namespace Crow
if (Target.TryFindMember (memberName)) {
if (TwoWayBinding) {
- IBindable source = Target.Instance as IBindable;
- if (source == null)
- throw new Exception (Source.Instance + " does not implement IBindable for 2 way bindings");
- source.Bindings.Add (new Binding (Target, Source));
+// IBindable source = Target.Instance as IBindable;
+// if (source == null)
+// throw new Exception (Source.Instance + " does not implement IBindable for 2 way bindings");
+// source.Bindings.Add (new Binding (Target, Source));
}
}
#if DEBUG_BINDING
diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs
index 59762182..1cfbe85c 100644
--- a/src/GraphicObjects/Button.cs
+++ b/src/GraphicObjects/Button.cs
@@ -47,12 +47,6 @@ namespace Crow
#endregion
#region GraphicObject Overrides
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
public override void onMouseDown (object sender, MouseButtonEventArgs e)
{
IsPressed = true;
diff --git a/src/GraphicObjects/IBindable.cs b/src/GraphicObjects/DataSourceChangeEventArgs.cs
index 45ff5864..78a81f3f 100644
--- a/src/GraphicObjects/IBindable.cs
+++ b/src/GraphicObjects/DataSourceChangeEventArgs.cs
@@ -1,10 +1,10 @@
//
-// IValueChange.cs
+// DataSourceChangeEventArg.cs
//
// Author:
// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
//
-// Copyright (c) 2015 jp
+// Copyright (c) 2016 jp
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,14 +19,19 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
-using System.Collections.Generic;
namespace Crow
{
- public interface IBindable
+ public class DataSourceChangeEventArgs : EventArgs
{
- List<Binding> Bindings { get; }
- object DataSource { get; set; }
+ public object OldDataSource;
+ public object NewDataSource;
+
+ public DataSourceChangeEventArgs (object oldDataSource, object newDataSource) : base()
+ {
+ OldDataSource = oldDataSource;
+ NewDataSource = newDataSource;
+ }
}
}
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index 70451f41..fe9519af 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -70,12 +70,6 @@ namespace Crow
_contentContainer = this.child.FindByName ("Content") as Container;
}
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
#region Public properties
[XmlAttributeAttribute()][DefaultValue("Expandable")]
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 093664d1..5cc2ae78 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -12,16 +12,8 @@ using System.IO;
namespace Crow
{
- public class GraphicObject : IXmlSerializable, ILayoutable, IValueChange, ICloneable, IBindable
+ public class GraphicObject : IXmlSerializable, ILayoutable, IValueChange, ICloneable
{
- #region IBindable implementation
- List<Binding> bindings = new List<Binding> ();
- public List<Binding> Bindings {
- get { return bindings; }
- }
-
- #endregion
-
internal static ulong currentUid = 0;
internal ulong uid = 0;
@@ -87,7 +79,7 @@ namespace Crow
Size minimumSize = "0,0";
bool cacheEnabled = false;
bool clipToClientRect = true;
- object dataSource;
+ protected object dataSource;
string style;
#endregion
@@ -136,7 +128,15 @@ namespace Crow
}
[XmlIgnore]public ILayoutable LogicalParent {
get { return logicalParent == null ? Parent : logicalParent; }
- set { logicalParent = value; }
+ set {
+ if (logicalParent == value)
+ return;
+ if (logicalParent != null)
+ (logicalParent as GraphicObject).DataSourceChanged -= onLogicalParentDataSourceChanged;
+ logicalParent = value;
+ if (logicalParent != null)
+ (logicalParent as GraphicObject).DataSourceChanged += onLogicalParentDataSourceChanged;
+ }
}
[XmlIgnore]public virtual Rectangle ClientRectangle {
get {
@@ -177,6 +177,7 @@ namespace Crow
public event EventHandler Enabled;
public event EventHandler Disabled;
public event EventHandler<LayoutingEventArgs> LayoutChanged;
+ public event EventHandler<DataSourceChangeEventArgs> DataSourceChanged;
#endregion
#region public properties
@@ -365,6 +366,10 @@ namespace Crow
return;
hasFocus = value;
+ if (hasFocus)
+ onFocused (this, null);
+ else
+ onUnfocused (this, null);
NotifyValueChanged ("HasFocus", hasFocus);
}
}
@@ -515,25 +520,25 @@ namespace Crow
RegisterForLayouting (LayoutingType.Sizing);
}
}
+ /// <summary>
+ /// Seek first logical tree upward if logicalParent is set, or seek graphic tree for
+ /// a not null dataSource that will be active for all descendants having dataSource=null
+ /// </summary>
[XmlAttributeAttribute][DefaultValue(null)]
public virtual object DataSource {
set {
if (dataSource == value)
return;
- #if DEBUG_BINDING
- Debug.WriteLine("******************************");
- Debug.WriteLine("New DataSource for => " + this.ToString());
- Debug.WriteLine("\t- " + DataSource);
- Debug.WriteLine("\t+ " + value);
- #endif
- this.ClearBinding ();
+ DataSourceChangeEventArgs dse = new DataSourceChangeEventArgs (dataSource, null);
dataSource = value;
- this.ResolveBindings();
+ dse.NewDataSource = DataSource;
+
+ OnDataSourceChanged (this, dse);
- NotifyValueChanged ("DataSource", dataSource);
+ NotifyValueChanged ("DataSource", DataSource);
}
get {
return dataSource == null ? LogicalParent == null ? null :
@@ -541,6 +546,25 @@ namespace Crow
(LogicalParent as GraphicObject).DataSource : null : dataSource;
}
}
+ protected virtual void onLogicalParentDataSourceChanged(object sender, DataSourceChangeEventArgs e){
+ ILayoutable tmp = Parent;
+ while (tmp != sender) {
+ if (!(tmp as GraphicObject).localDataSourceIsNull) {
+ OnDataSourceChanged (sender, e);
+ return;
+ }
+ tmp = tmp.Parent;
+ }
+ }
+ internal bool localDataSourceIsNull { get { return dataSource == null; } }
+
+ public virtual void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e){
+ DataSourceChanged.Raise (sender, e);
+ //#if DEBUG_BINDING
+ Debug.WriteLine("New DataSource for => {0} \n\t{1}=>{2}", this.ToString(),e.OldDataSource,e.NewDataSource);
+ //#endif
+ }
+
[XmlAttributeAttribute]
public virtual string Style {
get { return style; }
@@ -1183,20 +1207,17 @@ namespace Crow
}
#endregion
- public virtual void onFocused(object sender, EventArgs e){
+ protected virtual void onFocused(object sender, EventArgs e){
#if DEBUG_FOCUS
Debug.WriteLine("Focused => " + this.ToString());
#endif
Focused.Raise (this, e);
- this.HasFocus = true;
}
- public virtual void onUnfocused(object sender, EventArgs e){
+ protected virtual void onUnfocused(object sender, EventArgs e){
#if DEBUG_FOCUS
Debug.WriteLine("UnFocused => " + this.ToString());
#endif
-
Unfocused.Raise (this, e);
- this.HasFocus = false;
}
public virtual void onEnable(object sender, EventArgs e){
Enabled.Raise (this, e);
@@ -1206,84 +1227,84 @@ namespace Crow
}
#region Binding
- public void BindMember(string _member, string _expression){
- Bindings.Add(new Binding (this, _member, _expression));
- }
- public virtual void ResolveBindings()
- {
- if (Bindings.Count == 0)
- return;
- #if DEBUG_BINDING
- Debug.WriteLine ("Resolve Bindings => " + this.ToString ());
- #endif
-
- CompilerServices.ResolveBindings (Bindings);
- }
+// public void BindMember(string _member, string _expression){
+// Bindings.Add(new Binding (this, _member, _expression));
+// }
+// public virtual void ResolveBindings()
+// {
+// if (Bindings.Count == 0)
+// return;
+// #if DEBUG_BINDING
+// Debug.WriteLine ("Resolve Bindings => " + this.ToString ());
+// #endif
+//
+// CompilerServices.ResolveBindings (Bindings);
+// }
/// <summary>
/// Remove dynamic delegates by ids from dataSource
/// and delete ref of this in Shared interface refs
/// </summary>
- public virtual void ClearBinding(){
- //dont clear binding if dataSource is not null,
- foreach (Binding b in Bindings) {
- try {
- if (!b.Resolved)
- continue;
- //cancel compiled events
- if (b.Target == null){
- continue;
- #if DEBUG_BINDING
- Debug.WriteLine("Clear binding canceled for => " + b.ToString());
- #endif
- }
- if (b.Target.Instance != DataSource){
- #if DEBUG_BINDING
- Debug.WriteLine("Clear binding canceled for => " + b.ToString());
- #endif
- continue;
- }
- #if DEBUG_BINDING
- Debug.WriteLine("ClearBinding => " + b.ToString());
- #endif
- if (string.IsNullOrEmpty (b.DynMethodId)) {
- b.Resolved = false;
- if (b.Source.Member.MemberType == MemberTypes.Event)
- removeEventHandler (b);
- //TODO:check if full reset is necessary
- continue;
- }
- MemberReference mr = null;
- if (b.Target == null)
- mr = b.Source;
- else
- mr = b.Target;
- Type dataSourceType = mr.Instance.GetType();
- EventInfo evtInfo = dataSourceType.GetEvent ("ValueChanged");
- FieldInfo evtFi = CompilerServices.GetEventHandlerField (dataSourceType, "ValueChanged");
- MulticastDelegate multicastDelegate = evtFi.GetValue (mr.Instance) as MulticastDelegate;
- if (multicastDelegate != null) {
- foreach (Delegate d in multicastDelegate.GetInvocationList()) {
- if (d.Method.Name == b.DynMethodId)
- evtInfo.RemoveEventHandler (mr.Instance, d);
- }
- }
- b.Reset ();
- } catch (Exception ex) {
- Debug.WriteLine("\t Error: " + ex.ToString());
- }
- }
- }
- void removeEventHandler(Binding b){
- FieldInfo fiEvt = CompilerServices.GetEventHandlerField (b.Source.Instance.GetType(), b.Source.Member.Name);
- MulticastDelegate multiDel = fiEvt.GetValue (b.Source.Instance) as MulticastDelegate;
- if (multiDel != null) {
- foreach (Delegate d in multiDel.GetInvocationList()) {
- if (d.Method.Name == b.Target.Member.Name)
- b.Source.Event.RemoveEventHandler (b.Source.Instance, d);
- }
- }
- }
+// public virtual void ClearBinding(){
+// //dont clear binding if dataSource is not null,
+// foreach (Binding b in Bindings) {
+// try {
+// if (!b.Resolved)
+// continue;
+// //cancel compiled events
+// if (b.Target == null){
+// continue;
+// #if DEBUG_BINDING
+// Debug.WriteLine("Clear binding canceled for => " + b.ToString());
+// #endif
+// }
+// if (b.Target.Instance != DataSource){
+// #if DEBUG_BINDING
+// Debug.WriteLine("Clear binding canceled for => " + b.ToString());
+// #endif
+// continue;
+// }
+// #if DEBUG_BINDING
+// Debug.WriteLine("ClearBinding => " + b.ToString());
+// #endif
+// if (string.IsNullOrEmpty (b.DynMethodId)) {
+// b.Resolved = false;
+// if (b.Source.Member.MemberType == MemberTypes.Event)
+// removeEventHandler (b);
+// //TODO:check if full reset is necessary
+// continue;
+// }
+// MemberReference mr = null;
+// if (b.Target == null)
+// mr = b.Source;
+// else
+// mr = b.Target;
+// Type dataSourceType = mr.Instance.GetType();
+// EventInfo evtInfo = dataSourceType.GetEvent ("ValueChanged");
+// FieldInfo evtFi = CompilerServices.GetEventHandlerField (dataSourceType, "ValueChanged");
+// MulticastDelegate multicastDelegate = evtFi.GetValue (mr.Instance) as MulticastDelegate;
+// if (multicastDelegate != null) {
+// foreach (Delegate d in multicastDelegate.GetInvocationList()) {
+// if (d.Method.Name == b.DynMethodId)
+// evtInfo.RemoveEventHandler (mr.Instance, d);
+// }
+// }
+// b.Reset ();
+// } catch (Exception ex) {
+// Debug.WriteLine("\t Error: " + ex.ToString());
+// }
+// }
+// }
+// void removeEventHandler(Binding b){
+// FieldInfo fiEvt = CompilerServices.GetEventHandlerField (b.Source.Instance.GetType(), b.Source.Member.Name);
+// MulticastDelegate multiDel = fiEvt.GetValue (b.Source.Instance) as MulticastDelegate;
+// if (multiDel != null) {
+// foreach (Delegate d in multiDel.GetInvocationList()) {
+// if (d.Method.Name == b.Target.Member.Name)
+// b.Source.Event.RemoveEventHandler (b.Source.Instance, d);
+// }
+// }
+// }
#endregion
#region IXmlSerializable
@@ -1291,60 +1312,60 @@ namespace Crow
{
return null;
}
- void affectMember(string name, string value){
- Type thisType = this.GetType ();
-
- if (string.IsNullOrEmpty (value))
- return;
-
- MemberInfo mi = thisType.GetMember (name).FirstOrDefault();
- if (mi == null) {
- Debug.WriteLine ("XML: Unknown attribute in " + thisType.ToString() + " : " + name);
- return;
- }
- if (mi.MemberType == MemberTypes.Event) {
- this.Bindings.Add (new Binding (new MemberReference(this, mi), value));
- return;
- }
- if (mi.MemberType == MemberTypes.Property) {
- PropertyInfo pi = mi as PropertyInfo;
-
- if (pi.GetSetMethod () == null) {
- Debug.WriteLine ("XML: Read only property in " + thisType.ToString() + " : " + name);
- return;
- }
-
- XmlAttributeAttribute xaa = (XmlAttributeAttribute)pi.GetCustomAttribute (typeof(XmlAttributeAttribute));
- if (xaa != null) {
- if (!string.IsNullOrEmpty (xaa.AttributeName))
- name = xaa.AttributeName;
- }
- if (value.StartsWith("{",StringComparison.Ordinal)) {
- //binding
- if (!value.EndsWith("}", StringComparison.Ordinal))
- throw new Exception (string.Format("XML:Malformed binding: {0}", value));
-
- this.Bindings.Add (new Binding (new MemberReference(this, pi), value.Substring (1, value.Length - 2)));
- return;
- }
- if (pi.GetCustomAttribute (typeof(XmlIgnoreAttribute)) != null)
- return;
- if (xaa == null)//not define as xmlAttribute
- return;
-
- if (pi.PropertyType == typeof(string)) {
- pi.SetValue (this, value, null);
- return;
- }
-
- if (pi.PropertyType.IsEnum) {
- pi.SetValue (this, Enum.Parse (pi.PropertyType, value), null);
- } else {
- MethodInfo me = pi.PropertyType.GetMethod ("Parse", new Type[] { typeof(string) });
- pi.SetValue (this, me.Invoke (null, new string[] { value }), null);
- }
- }
- }
+// void affectMember(string name, string value){
+// Type thisType = this.GetType ();
+//
+// if (string.IsNullOrEmpty (value))
+// return;
+//
+// MemberInfo mi = thisType.GetMember (name).FirstOrDefault();
+// if (mi == null) {
+// Debug.WriteLine ("XML: Unknown attribute in " + thisType.ToString() + " : " + name);
+// return;
+// }
+// if (mi.MemberType == MemberTypes.Event) {
+// this.Bindings.Add (new Binding (new MemberReference(this, mi), value));
+// return;
+// }
+// if (mi.MemberType == MemberTypes.Property) {
+// PropertyInfo pi = mi as PropertyInfo;
+//
+// if (pi.GetSetMethod () == null) {
+// Debug.WriteLine ("XML: Read only property in " + thisType.ToString() + " : " + name);
+// return;
+// }
+//
+// XmlAttributeAttribute xaa = (XmlAttributeAttribute)pi.GetCustomAttribute (typeof(XmlAttributeAttribute));
+// if (xaa != null) {
+// if (!string.IsNullOrEmpty (xaa.AttributeName))
+// name = xaa.AttributeName;
+// }
+// if (value.StartsWith("{",StringComparison.Ordinal)) {
+// //binding
+// if (!value.EndsWith("}", StringComparison.Ordinal))
+// throw new Exception (string.Format("XML:Malformed binding: {0}", value));
+//
+// this.Bindings.Add (new Binding (new MemberReference(this, pi), value.Substring (1, value.Length - 2)));
+// return;
+// }
+// if (pi.GetCustomAttribute (typeof(XmlIgnoreAttribute)) != null)
+// return;
+// if (xaa == null)//not define as xmlAttribute
+// return;
+//
+// if (pi.PropertyType == typeof(string)) {
+// pi.SetValue (this, value, null);
+// return;
+// }
+//
+// if (pi.PropertyType.IsEnum) {
+// pi.SetValue (this, Enum.Parse (pi.PropertyType, value), null);
+// } else {
+// MethodInfo me = pi.PropertyType.GetMethod ("Parse", new Type[] { typeof(string) });
+// pi.SetValue (this, me.Invoke (null, new string[] { value }), null);
+// }
+// }
+// }
public virtual void ReadXml (System.Xml.XmlReader reader)
{
if (reader.HasAttributes) {
@@ -1357,7 +1378,7 @@ namespace Crow
if (reader.Name == "Style")
continue;
- affectMember (reader.Name, reader.Value);
+ //affectMember (reader.Name, reader.Value);
}
reader.MoveToElement ();
}else
@@ -1475,12 +1496,6 @@ namespace Crow
/// <summary>
/// full GraphicTree clone with binding definition
/// </summary>
- public virtual GraphicObject DeepClone(){
- GraphicObject tmp = Clone () as GraphicObject;
- foreach (Binding b in this.bindings)
- tmp.Bindings.Add (new Binding (new MemberReference (tmp, b.Source.Member), b.Expression));
- return tmp;
- }
public override string ToString ()
{
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index efe02d95..da42b8f5 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -40,7 +40,6 @@ namespace Crow
lock (children)
Children.Add(g);
g.Parent = this;
- g.ResolveBindings ();
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
g.LayoutChanged += OnChildLayoutChanges;
@@ -48,7 +47,6 @@ namespace Crow
public virtual void RemoveChild(GraphicObject child)
{
child.LayoutChanged -= OnChildLayoutChanges;
- child.ClearBinding ();
//child.Parent = null;
lock (children)
Children.Remove(child);
@@ -65,7 +63,6 @@ namespace Crow
while(Children.Count > 0){
GraphicObject g = Children[Children.Count-1];
g.LayoutChanged -= OnChildLayoutChanges;
- g.ClearBinding ();
g.Parent = null;
Children.RemoveAt(Children.Count-1);
}
@@ -94,11 +91,12 @@ namespace Crow
}
#region GraphicObject overrides
- public override void ResolveBindings ()
+ public override void OnDataSourceChanged (object sender, DataSourceChangeEventArgs e)
{
- base.ResolveBindings ();
- foreach (GraphicObject w in Children)
- w.ResolveBindings ();
+ base.OnDataSourceChanged (sender, e);
+ foreach (GraphicObject g in children)
+ if (g.localDataSourceIsNull)
+ g.OnDataSourceChanged (sender, e);
}
public override GraphicObject FindByName (string nameToFind)
{
@@ -365,17 +363,5 @@ namespace Crow
#endregion
- public override void ClearBinding(){
- foreach (GraphicObject c in Children)
- c.ClearBinding ();
- base.ClearBinding ();
- }
- public override GraphicObject DeepClone ()
- {
- Group tmp = base.DeepClone () as Group;
- foreach (GraphicObject c in Children)
- tmp.AddChild (c.DeepClone ());
- return tmp;
- }
}
}
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs
index 666f00a2..2f35c223 100644
--- a/src/GraphicObjects/Label.cs
+++ b/src/GraphicObjects/Label.cs
@@ -670,7 +670,7 @@ namespace Crow
base.onMouseLeave (sender, e);
CurrentInterface.MouseCursor = XCursor.Default;
}
- public override void onFocused (object sender, EventArgs e)
+ protected override void onFocused (object sender, EventArgs e)
{
base.onFocused (sender, e);
@@ -680,7 +680,7 @@ namespace Crow
SelRelease = new Point (lines.LastOrDefault ().Length, lines.Count-1);
RegisterForRedraw ();
}
- public override void onUnfocused (object sender, EventArgs e)
+ protected override void onUnfocused (object sender, EventArgs e)
{
base.onUnfocused (sender, e);
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 1bfdf19c..e4cde7ed 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -175,21 +175,6 @@ namespace Crow
_content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height);
}
- public override void ClearBinding ()
- {
- //ensure popped window is cleared
- if (Content != null) {
- if (Content.Parent != null)
- CurrentInterface.DeleteWidget (Content);
- }
- base.ClearBinding ();
- }
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index 2a5deeaa..06f0c213 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -47,7 +47,6 @@ namespace Crow
{
if (child != null) {
- child.ClearBinding ();
contentSize = new Size (0, 0);
child.LayoutChanged -= OnChildLayoutChanges;
child.Parent = null;
@@ -66,16 +65,7 @@ namespace Crow
}
#region GraphicObject Overrides
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (child != null)
- child.ResolveBindings ();
- }
- protected void ResolveBindingsWithNoRecurse ()
- {
- base.ResolveBindings ();
- }
+
public override GraphicObject FindByName (string nameToFind)
{
if (Name == nameToFind)
@@ -88,6 +78,13 @@ namespace Crow
return child == goToFind ? true :
child == null ? false : child.Contains(goToFind);
}
+ public override void OnDataSourceChanged (object sender, DataSourceChangeEventArgs e)
+ {
+ base.OnDataSourceChanged (sender, e);
+ if (child != null)
+ if (child.localDataSourceIsNull)
+ child.OnDataSourceChanged (sender, e);
+ }
public override bool UpdateLayout (LayoutingType layoutType)
{
if (child != null) {
@@ -197,19 +194,6 @@ namespace Crow
}
#endregion
- public override void ClearBinding ()
- {
- if (child != null)
- child.ClearBinding ();
- base.ClearBinding ();
- }
- public override GraphicObject DeepClone ()
- {
- PrivateContainer tmp = base.DeepClone () as PrivateContainer;
- if (child != null)
- tmp.SetChild (child.DeepClone ());
- return tmp;
- }
}
}
diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs
index e14a7815..078fd04d 100644
--- a/src/GraphicObjects/TabItem.cs
+++ b/src/GraphicObjects/TabItem.cs
@@ -49,12 +49,6 @@ namespace Crow
_contentContainer.SetChild(value);
}
}
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (_contentContainer != null)
- _contentContainer.ResolveBindings ();
- }
protected override void loadTemplate(GraphicObject template = null)
{
base.loadTemplate (template);
diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs
index 7a4649a4..44c2ad08 100644
--- a/src/GraphicObjects/TemplatedContainer.cs
+++ b/src/GraphicObjects/TemplatedContainer.cs
@@ -34,19 +34,6 @@ namespace Crow
[XmlIgnore]public abstract GraphicObject Content{ get; set;}
#region GraphicObject overrides
- public override void ClearBinding ()
- {
- if (Content != null)
- Content.ClearBinding ();
-
- base.ClearBinding ();
- }
-// public override void ResolveBindings ()
-// {
-// base.ResolveBindings ();
-// if (Content != null)
-// Content.ResolveBindings ();
-// }
public override GraphicObject FindByName (string nameToFind)
{
if (Name == nameToFind)
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index 7f2e1b87..ba49f44f 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -94,8 +94,6 @@ namespace Crow
this.SetChild (CurrentInterface.Load (Interface.DefaultTemplates[this.GetType ().FullName]));
}else
this.SetChild (template);
-
- this.ResolveBindings ();
}
//TODO:IXmlSerializable is not used anymore
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
index 500e5ea6..7b7f897c 100644
--- a/src/GraphicObjects/TemplatedGroup.cs
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -307,8 +307,8 @@ namespace Crow
// //because items total size is forced to approx size
// if (_gsList.Orientation == Orientation.Horizontal) {
// page.Width = Measure.Fit;
- page.BindMember ("Height", "../HeightPolicy");
- page.BindMember ("Width", "../WidthPolicy");
+ //page.BindMember ("Height", "../HeightPolicy");
+ //page.BindMember ("Width", "../WidthPolicy");
// } else {
// page.Height = Measure.Fit;
// page.BindMember ("Width", "../WidthPolicy");
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index 9ef9e642..86f05d86 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -134,12 +134,6 @@ namespace Crow
#endregion
#region GraphicObject Overrides
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
base.onMouseMove (sender, e);
diff --git a/src/IMLReader.cs b/src/IMLReader.cs
index f9df89ff..55317aba 100644
--- a/src/IMLReader.cs
+++ b/src/IMLReader.cs
@@ -196,6 +196,12 @@ namespace Crow
emitLoader(RootType);
Read();//close tag
}
+
+ void createBindingDelegates(){
+// foreach (Dictionary<string, MemberAddress> pb in IMLCtx.PropertyBindings) {
+//
+// }
+ }
/// <summary>
/// Inits il generator, RootType must have been read first
/// </summary>
@@ -363,7 +369,7 @@ namespace Crow
if (reader.Value.StartsWith ("{")) {
readPropertyBinding(reader.Name, reader.Value.Substring (1, reader.Value.Length - 2));
- CompilerServices.emitBindingCreation (reader.il, reader.Name, reader.Value.Substring (1, reader.Value.Length - 2));
+ //CompilerServices.emitBindingCreation (reader.il, reader.Name, reader.Value.Substring (1, reader.Value.Length - 2));
}else
CompilerServices.EmitSetValue (reader.il, pi, reader.Value);
@@ -445,11 +451,16 @@ namespace Crow
}
}
Node[] origine = new Node[nodeIdx + 1];
- Array.Copy (target, origine, nodeIdx + 1);
+ try {
+ Array.Copy (target, origine, nodeIdx + 1);
- int destLength = target.Length - nodeIdx;
- Node[] dest = new Node[destLength];
- Array.Copy (target, nodeIdx, dest, 0, destLength);
+ int destLength = target.Length - nodeIdx;
+ Node[] dest = new Node[destLength];
+ Array.Copy (target, nodeIdx, dest, 0, destLength);
+
+ } catch (Exception ex) {
+ System.Diagnostics.Debug.WriteLine (ex.ToString ());
+ }
nodeId = Node.AddressToString (origine);
diff --git a/src/Interface.cs b/src/Interface.cs
index 1659c0ea..941b96f9 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -312,10 +312,10 @@ namespace Crow
if (_focusedWidget == value)
return;
if (_focusedWidget != null)
- _focusedWidget.onUnfocused (this, null);
+ _focusedWidget.HasFocus = false;
_focusedWidget = value;
if (_focusedWidget != null)
- _focusedWidget.onFocused (this, null);
+ _focusedWidget.HasFocus = true;
}
}
#endregion
@@ -499,7 +499,6 @@ namespace Crow
public void DeleteWidget(GraphicObject g)
{
g.Visible = false;//trick to ensure clip is added to refresh zone
- g.ClearBinding();
GraphicTree.Remove (g);
}
public void PutOnTop(GraphicObject g)
@@ -520,7 +519,6 @@ namespace Crow
//to ObjectToRedraw list, and without parent, it fails
GraphicObject g = GraphicTree [i];
g.Visible = false;
- g.ClearBinding ();
GraphicTree.RemoveAt (0);
}
#if DEBUG_LAYOUTING