aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GenericStack.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-04-28 17:50:42 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-04-28 17:50:42 +0200
commitc88d3c2e0b3e9e69df5f1879b9d8935d3ae0d390 (patch)
treeebb5c969b09654c16995c9aff2bc0c0076806ea2 /src/GraphicObjects/GenericStack.cs
parent7b8ff62e3ee75e19d9eeeabd31bedef371215554 (diff)
Layouting queue test 2
Diffstat (limited to 'src/GraphicObjects/GenericStack.cs')
-rw-r--r--src/GraphicObjects/GenericStack.cs40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 36d41f99..04e63d15 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -22,6 +22,17 @@ namespace go
Orientation _orientation;
#endregion
+ public override T addChild<T> (T child)
+ {
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ return base.addChild (child);
+ }
+ public override void removeChild (GraphicObject child)
+ {
+ base.removeChild (child);
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ }
+
#region Public Properties
[XmlAttributeAttribute()][DefaultValue(2)]
public int Spacing
@@ -85,23 +96,30 @@ namespace go
}
}
}
- public override void RegisterForLayouting ()
- {
- base.RegisterForLayouting ();
+// public void RegisterForLayouting ()
+// {
+// base.RegisterForLayouting ();
+//
+// int idx = Interface.LayoutingQueue.IndexOf (Interface.LayoutingQueue.Where (lq => lq.GraphicObject.Parent == this).LastOrDefault ());
+// if (idx < 0)
+// return;
+// Interface.LayoutingQueue.Insert (
+// idx+1,
+// new LayoutingQueueItem (LayoutingType.PositionChildren, this));
+// }
+ public override void RegisterForLayouting (int layoutType)
+ {
+ base.RegisterForLayouting (layoutType);
- int idx = Interface.LayoutingQueue.IndexOf (Interface.LayoutingQueue.Where (lq => lq.GraphicObject.Parent == this).LastOrDefault ());
- if (idx < 0)
- return;
- Interface.LayoutingQueue.Insert (
- idx+1,
- new LayoutingQueueItem (LayoutingType.PositionChildren, this));
+ if ((layoutType & (int)LayoutingType.PositionChildren) > 0)
+ Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);
}
public override void UpdateLayout (LayoutingType layoutType)
{
if (layoutType == LayoutingType.PositionChildren)
ComputeChildrenPositions ();
-
- base.UpdateLayout(layoutType);
+ else
+ base.UpdateLayout(layoutType);
}
#endregion