From e8b13fbea6cab4f01af769a1246c49c588fa2f3e Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Mon, 22 Dec 2014 08:08:36 +0100 Subject: CompilerServices for EventHandler statements in XML attributes Improve code formatting debug --- src/GraphicObjects/GenericStack.cs | 86 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 42 deletions(-) (limited to 'src/GraphicObjects/GenericStack.cs') diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 90e0d132..a36cd7b1 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -10,57 +10,56 @@ namespace go { public class GenericStack : Group { - int currentXForWidget = 0; - int currentYForWidget = 0; - bool childrenArePositionned = false; - int _widgetSpacing; - Orientation _orientation; - - [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValue(-1)] - public override int Width { - get { return base.Width; } - set { base.Width = value; } + #region CTOR + public GenericStack() + : base() + { } + #endregion - [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValue(-1)] - public override int Height { - get { return base.Height; } - set { base.Height = value; } - } + #region Private fields + bool childrenArePositionned = false; + int _spacing; + Orientation _orientation; + #endregion - [XmlAttributeAttribute()] - [DefaultValue(2)] - public int WidgetSpacing + #region Public Properties + [XmlAttributeAttribute()][DefaultValue(2)] + public int Spacing { - get { return _widgetSpacing; } - set { _widgetSpacing = value; } + get { return _spacing; } + set { _spacing = value; } } - - [XmlAttributeAttribute()] - [DefaultValue(Orientation.Horizontal)] + [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)] public virtual Orientation Orientation { get { return _orientation; } set { _orientation = value; } } + #endregion - public GenericStack() - : base() - { - } - - public override bool LayoutIsValid { + #region GraphicObject Overrides + [XmlAttributeAttribute()][DefaultValue(-1)] + public override int Width { + get { return base.Width; } + set { base.Width = value; } + } + [XmlAttributeAttribute()][DefaultValue(-1)] + public override int Height { + get { return base.Height; } + set { base.Height = value; } + } + [XmlIgnore]public override bool LayoutIsValid { get { return childrenArePositionned && base.LayoutIsValid; } set { base.LayoutIsValid = value; } } + public override void InvalidateLayout () { childrenArePositionned = false; base.InvalidateLayout (); } - public override Size measureRawSize () + protected override Size measureRawSize () { Size raw = Bounds.Size; Size tmp = new Size (); @@ -72,7 +71,7 @@ namespace go if (raw.Width < 0) { if (c.WIsValid) { if (Orientation == Orientation.Horizontal && c.Bounds.Width != 0) - tmp.Width += c.Slot.Width + WidgetSpacing; + tmp.Width += c.Slot.Width + Spacing; else tmp.Width = Math.Max (tmp.Width, c.Slot.Right); }else @@ -81,7 +80,7 @@ namespace go if (raw.Height < 0) { if (c.HIsValid) { if (Orientation == Orientation.Vertical && c.Bounds.Height != 0) - tmp.Height += c.Slot.Height + WidgetSpacing; + tmp.Height += c.Slot.Height + Spacing; else tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom); }else @@ -90,9 +89,9 @@ namespace go } if (raw.Width < 0) - tmp.Width += 2*(BorderWidth+Margin); + tmp.Width += 2*Margin; if (raw.Height < 0) - tmp.Height += 2*(BorderWidth+Margin); + tmp.Height += 2*Margin; return tmp; } @@ -106,7 +105,7 @@ namespace go c.Slot.X = d; c.XIsValid = true; - d += c.Slot.Width + WidgetSpacing; + d += c.Slot.Width + Spacing; } } else { foreach (GraphicObject c in Children) { @@ -115,7 +114,7 @@ namespace go c.Slot.Y = d; c.YIsValid = true; - d += c.Slot.Height + WidgetSpacing; + d += c.Slot.Height + Spacing; } } childrenArePositionned = true; @@ -130,7 +129,9 @@ namespace go if (LayoutIsValid) registerForRedraw(); } -// + #endregion + + // // bool enoughtSpaceForWidget(GraphicObject w) // { // if (!SizeToContent) @@ -144,9 +145,9 @@ namespace go // nextYForWidget = nextYForWidget + w.Slot.Height; // // -// if (nextXForWidget > clientBounds.Right ) +// if (nextXForWidget > ClientRectangle.Right ) // return false; -// if (currentYForWidget > clientBounds.Bottom ) +// if (currentYForWidget > ClientRectangle.Bottom ) // return false; // } // return true; @@ -159,5 +160,6 @@ namespace go // currentYForWidget = currentYForWidget + WidgetSpacing + w.Slot.Height; // // } - } + + } } -- cgit v1.3.1-4-g156e