aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/WrappedWidgetGroup.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
commit2b087282dd73152d21140ea7312a90e046c84f61 (patch)
tree5d03225090e39c1d14465bdbaf1882e87026402b /src/GraphicObjects/WrappedWidgetGroup.cs
parent73b7c1d82226e4d10708e858a011991e3f598655 (diff)
Fix CRLF
Diffstat (limited to 'src/GraphicObjects/WrappedWidgetGroup.cs')
-rwxr-xr-xsrc/GraphicObjects/WrappedWidgetGroup.cs308
1 files changed, 154 insertions, 154 deletions
diff --git a/src/GraphicObjects/WrappedWidgetGroup.cs b/src/GraphicObjects/WrappedWidgetGroup.cs
index afd54e6c..fa033b5e 100755
--- a/src/GraphicObjects/WrappedWidgetGroup.cs
+++ b/src/GraphicObjects/WrappedWidgetGroup.cs
@@ -1,154 +1,154 @@
-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;
- }
-
- }
- }
- }
- }
-}
+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;
+ }
+
+ }
+ }
+ }
+ }
+}