diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-30 16:25:41 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-30 16:25:41 +0100 |
| commit | b68c2ebb337936f952cd7fdae829ee9b04315ac1 (patch) | |
| tree | 772ad7994322015b0660ba5f6d3dcecc0d19b88d /src/GraphicObjects | |
| parent | 71d2eb36a346afa72fae5f425dc1862c919e7407 (diff) | |
test appveyor
Diffstat (limited to 'src/GraphicObjects')
| -rwxr-xr-x | src/GraphicObjects/WrappedWidgetGroup.cs | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/src/GraphicObjects/WrappedWidgetGroup.cs b/src/GraphicObjects/WrappedWidgetGroup.cs deleted file mode 100755 index fa033b5e..00000000 --- a/src/GraphicObjects/WrappedWidgetGroup.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using OpenTK.Graphics.OpenGL; -using System.Diagnostics; - -namespace go -{ - public class WrappedWidgetGroup : Group - { - - public int widgetSpacing = 2; - - public Orientation Orientation = Orientation.Horizontal; - - - public WrappedWidgetGroup() - : base() - { - BorderWidth = 0; - } - - int currentXForWidget = 0; - int currentYForWidget = 0; - - int highestWidget = 0; - int largestWidget = 0; - - - public override void UpdateLayout() - { - //while (!layoutIsValid) - //{ - //if (!(sizeIsValid && positionIsValid)) - base.UpdateLayout(); - - //if (!base.layoutIsValid) - // return; - - currentXForWidget = ClientRectangle.X; - currentYForWidget = ClientRectangle.Y; - - highestWidget = 0; - largestWidget = 0; - - Rectangle contentBounds = Rectangle.Zero; - - GraphicObject[] widgets = new GraphicObject[Children.Count]; - Children.CopyTo(widgets); - foreach (GraphicObject w in widgets) - { - if (w.renderBounds.Width > largestWidget) - largestWidget = w.renderBounds.Width; - if (w.renderBounds.Height > highestWidget) - highestWidget = w.renderBounds.Height; - - if (!enoughtSpaceForWidget(w)) - advance(w); - - if (enoughtSpaceForWidget(w)) - { - w.renderBounds.X = currentXForWidget; - w.renderBounds.Y = currentYForWidget; - - w.positionIsValid = true; - - contentBounds += w.renderBounds; - - advance(w); - } - else - break; - } - - contentBounds.Width += BorderWidth + Margin; - contentBounds.Height += BorderWidth + Margin; - - if (SizeToContent) - renderBounds.Size = contentBounds.Size; - else if (VerticalScrolling) - renderBounds.Size = new Size(renderBounds.Size.Width, contentBounds.Size.Height); - else if (HorizontalScrolling) - renderBounds.Size = new Size(contentBounds.Size.Width, renderBounds.Size.Height); - - if (layoutIsValid) - registerForRedraw(); - } - - - bool enoughtSpaceForWidget(GraphicObject w) - { - int nextXForWidget = 0; - int nextYForWidget = 0; - - if (Orientation == Orientation.Horizontal) - nextXForWidget = currentXForWidget + w.renderBounds.Width; - else - nextYForWidget = nextYForWidget + w.renderBounds.Height; - - if (!SizeToContent) - { - if (nextXForWidget > ClientRectangle.Right && !HorizontalScrolling) - return false; - if (currentYForWidget > ClientRectangle.Bottom && !VerticalScrolling) - return false; - } - return true; - } - void advance(GraphicObject w) - { - if (Orientation == Orientation.Horizontal) - { - //if (w is LabelWidget) - // Debugger.Break(); - currentXForWidget = currentXForWidget + widgetSpacing + w.renderBounds.Width; - } - else - currentYForWidget = currentYForWidget + widgetSpacing + w.renderBounds.Height; - - if (!SizeToContent) - { - if (currentXForWidget > ClientRectangle.Right && !HorizontalScrolling) - { - if (Orientation == Orientation.Vertical) - { - //not scrolling - } - else - { - currentXForWidget = ClientRectangle.X; - currentYForWidget += widgetSpacing + highestWidget; - highestWidget = 0; - } - } - if (currentYForWidget > ClientRectangle.Bottom && !VerticalScrolling) - { - if (Orientation == Orientation.Horizontal) - { - //not scrolling - } - else - { - currentXForWidget += widgetSpacing + largestWidget; - currentYForWidget = ClientRectangle.Y; - largestWidget = 0; - } - - } - } - } - } -} |