aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/WrappedWidgetGroup.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2014-12-18 22:41:10 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2014-12-18 22:41:10 +0100
commitd5a5d9516969d7a0fb665a72be7269e7bd51ad58 (patch)
tree64807d55e1994b3c700e9628ac7a6ba602a4426f /src/WrappedWidgetGroup.cs
parent02fed0f59e37aa66381023ec1543cca9a54ac118 (diff)
misa a jour
Diffstat (limited to 'src/WrappedWidgetGroup.cs')
-rw-r--r--src/WrappedWidgetGroup.cs154
1 files changed, 0 insertions, 154 deletions
diff --git a/src/WrappedWidgetGroup.cs b/src/WrappedWidgetGroup.cs
deleted file mode 100644
index fd886cb9..00000000
--- a/src/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 = clientBounds.X;
- currentYForWidget = clientBounds.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 > clientBounds.Right && !HorizontalScrolling)
- return false;
- if (currentYForWidget > clientBounds.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 > clientBounds.Right && !HorizontalScrolling)
- {
- if (Orientation == Orientation.Vertical)
- {
- //not scrolling
- }
- else
- {
- currentXForWidget = clientBounds.X;
- currentYForWidget += widgetSpacing + highestWidget;
- highestWidget = 0;
- }
- }
- if (currentYForWidget > clientBounds.Bottom && !VerticalScrolling)
- {
- if (Orientation == Orientation.Horizontal)
- {
- //not scrolling
- }
- else
- {
- currentXForWidget += widgetSpacing + largestWidget;
- currentYForWidget = clientBounds.Y;
- largestWidget = 0;
- }
-
- }
- }
- }
- }
-}