aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-06-22 12:48:11 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-06-22 12:48:11 +0200
commit8c99bee3d98f7c3221e969c2924d87729ba7faea (patch)
treea9d397745c633f2306762e740486da8413b84223 /src/GraphicObjects/GraphicObject.cs
parentdc995bd1da98971009454f4efe043d6237d00729 (diff)
- simplify value change with only actual value, not the old one
- First tests with Scrollbar
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 0944703f..5b896b53 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -19,8 +19,16 @@ using System.Xml;
namespace go
{
- public class GraphicObject : IXmlSerializable, ILayoutable
+ public class GraphicObject : IXmlSerializable, ILayoutable, IValueChange
{
+ #region IValueChange implementation
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;
+ void NotifyValueChanged(string MemberName, object _value)
+ {
+ ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
+ }
+ #endregion
+
#region CTOR
public GraphicObject ()
{
@@ -115,7 +123,12 @@ namespace go
[XmlAttributeAttribute()][DefaultValue("unamed")]
public virtual string Name {
get { return _name; }
- set { _name = value; }
+ set {
+ if (_name == value)
+ return;
+ _name = value;
+ NotifyValueChanged("Name", _verticalAlignment);
+ }
}
[XmlAttributeAttribute()][DefaultValue(VerticalAlignment.Center)]
public virtual VerticalAlignment VerticalAlignment {
@@ -125,14 +138,19 @@ namespace go
return;
_verticalAlignment = value;
-
-// if (Top > 0)
+ NotifyValueChanged("VerticalAlignment", _verticalAlignment);
}
}
[XmlAttributeAttribute()][DefaultValue(HorizontalAlignment.Center)]
public virtual HorizontalAlignment HorizontalAlignment {
get { return _horizontalAlignment; }
- set { _horizontalAlignment = value; }
+ set {
+ if (_horizontalAlignment == value)
+ return;
+
+ _horizontalAlignment = value;
+ NotifyValueChanged("HorizontalAlignment", _horizontalAlignment);
+ }
}
[XmlAttributeAttribute()][DefaultValue(0)]
public virtual int Left {
@@ -142,7 +160,7 @@ namespace go
return;
Bounds.X = value;
-
+ NotifyValueChanged ("Left", Bounds.X);
this.RegisterForLayouting ((int)LayoutingType.X);
}
}
@@ -154,7 +172,7 @@ namespace go
return;
Bounds.Y = value;
-
+ NotifyValueChanged ("Top", Bounds.Y);
this.RegisterForLayouting ((int)LayoutingType.Y);
}
}
@@ -166,7 +184,7 @@ namespace go
return;
Bounds.Width = value;
-
+ NotifyValueChanged ("Width", Bounds.Width);
this.RegisterForLayouting ((int)LayoutingType.Width);
}
}
@@ -178,7 +196,7 @@ namespace go
return;
Bounds.Height = value;
-
+ NotifyValueChanged ("Height", Bounds.Height);
this.RegisterForLayouting ((int)LayoutingType.Height);
}
}