aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/PrivateContainer.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-05 20:38:00 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-05 20:38:00 +0100
commit9e7f05bfc4a9f47bf11ca44842c0dd92def4d5aa (patch)
tree59955d569a318c93851fa107d7ae14da0152407f /src/GraphicObjects/PrivateContainer.cs
parent759f4f39e3fdde1f9ed8b620af51e05d052d8964 (diff)
new layouting update through events
Diffstat (limited to 'src/GraphicObjects/PrivateContainer.cs')
-rw-r--r--src/GraphicObjects/PrivateContainer.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index f4190f9b..9b312c14 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -52,6 +52,7 @@ namespace Crow
{
if (child != null) {
+ child.LayoutChanged -= OnChildLayoutChanges;
this.RegisterForLayouting ((int)LayoutingType.Sizing);
child.Parent = null;
}
@@ -60,6 +61,7 @@ namespace Crow
if (child != null) {
child.Parent = this;
+ child.LayoutChanged += OnChildLayoutChanges;
child.RegisterForLayouting ((int)LayoutingType.Sizing);
}
@@ -117,6 +119,24 @@ namespace Crow
break;
}
}
+ public virtual void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+ {
+ GraphicObject g = sender as GraphicObject;
+ switch (arg.LayoutType) {
+ case LayoutingType.X:
+ break;
+ case LayoutingType.Y:
+ break;
+ case LayoutingType.Width:
+ if (this.Bounds.Width < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Width);
+ break;
+ case LayoutingType.Height:
+ if (this.Bounds.Height < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Height);
+ break;
+ }
+ }
public override Rectangle ContextCoordinates (Rectangle r)
{