From 9e7f05bfc4a9f47bf11ca44842c0dd92def4d5aa Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 5 Feb 2016 20:38:00 +0100 Subject: new layouting update through events --- src/GraphicObjects/GenericStack.cs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/GraphicObjects/GenericStack.cs') diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 92e944bb..d4e3ae5d 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -105,6 +105,7 @@ namespace Crow c.RegisterForLayouting ((int)LayoutingType.X); } } + bmp = null; } public override void RegisterForLayouting (int layoutType) @@ -171,6 +172,42 @@ namespace Crow }else base.UpdateLayout(layoutType); } + public override void OnLayoutChanges (LayoutingType layoutType) + { + base.OnLayoutChanges (layoutType); + + if (Orientation == Orientation.Horizontal){ + if(layoutType == LayoutingType.Width) + this.RegisterForLayouting ((int)LayoutingType.PositionChildren); + }else if (layoutType == LayoutingType.Height) + this.RegisterForLayouting ((int)LayoutingType.PositionChildren); + } + public override void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg) + { + base.OnChildLayoutChanges (sender, arg); + + GraphicObject g = sender as GraphicObject; + switch (arg.LayoutType) { + case LayoutingType.X: + break; + case LayoutingType.Y: + break; + case LayoutingType.Width: + if (Orientation == Orientation.Horizontal) { + if (this.Bounds.Width < 0) + this.RegisterForLayouting ((int)LayoutingType.Width); + this.RegisterForLayouting ((int)LayoutingType.PositionChildren); + } + break; + case LayoutingType.Height: + if (Orientation == Orientation.Vertical) { + if (this.Bounds.Height < 0) + this.RegisterForLayouting ((int)LayoutingType.Height); + this.RegisterForLayouting ((int)LayoutingType.PositionChildren); + } + break; + } + } #endregion -- cgit v1.3.1-4-g156e