aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GenericStack.cs
diff options
context:
space:
mode:
authorj-p <jp.bruyere@live.be>2016-08-02 00:25:42 +0200
committerGitHub <noreply@github.com>2016-08-02 00:25:42 +0200
commit7aa1b2660fa257e570fb75f4c03bb33f1d7d151e (patch)
tree639804dec0ca0d0cfd96cec38489808f9fce197e /src/GraphicObjects/GenericStack.cs
parentfd5b776826028a0c12a92f11d1daf4065d4c6024 (diff)
parent77f7028debf55a8d6faff8e88c18e33500867774 (diff)
Merge pull request #13 from jpbruyere/UpdateQueuingReview
Update queuing review and styling debug
Diffstat (limited to 'src/GraphicObjects/GenericStack.cs')
-rw-r--r--src/GraphicObjects/GenericStack.cs41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 3ec29fb5..efa98d1a 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -1,6 +1,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
+using System;
namespace Crow
{
@@ -99,7 +100,7 @@ namespace Crow
//if no layouting remains in queue for item, registre for redraw
if (RegisteredLayoutings == LayoutingType.None && bmp == null)
- RegisterForGraphicUpdate ();
+ Interface.CurrentInterface.EnqueueForRepaint (this);
return true;
}
@@ -126,15 +127,22 @@ namespace Crow
contentSize.Width += go.Slot.Width - go.LastSlots.Width;
if (stretchedGO != null) {
- stretchedGO.Slot.Width = this.ClientRectangle.Width - contentSize.Width - Spacing * (Children.Count - 1);
- stretchedGO.bmp = null;
+ int newW = Math.Max (
+ this.ClientRectangle.Width - contentSize.Width - Spacing * (Children.Count - 1),
+ stretchedGO.MinimumSize.Width);
+ if (stretchedGO.MaximumSize.Width > 0)
+ newW = Math.Min (newW, stretchedGO.MaximumSize.Width);
+ if (newW != stretchedGO.Slot.Width) {
+ stretchedGO.Slot.Width = newW;
+ stretchedGO.bmp = null;
#if DEBUG_LAYOUTING
Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString());
#endif
- stretchedGO.LayoutChanged -= OnChildLayoutChanges;
- stretchedGO.OnLayoutChanges (LayoutingType.Width);
- stretchedGO.LayoutChanged += OnChildLayoutChanges;
- stretchedGO.LastSlots.Width = stretchedGO.Slot.Width;
+ stretchedGO.LayoutChanged -= OnChildLayoutChanges;
+ stretchedGO.OnLayoutChanges (LayoutingType.Width);
+ stretchedGO.LayoutChanged += OnChildLayoutChanges;
+ stretchedGO.LastSlots.Width = stretchedGO.Slot.Width;
+ }
}
if (Width == Measure.Fit)
@@ -158,15 +166,22 @@ namespace Crow
contentSize.Height += go.Slot.Height - go.LastSlots.Height;
if (stretchedGO != null) {
- stretchedGO.Slot.Height = this.ClientRectangle.Height - contentSize.Height - Spacing * (Children.Count -1);
- stretchedGO.bmp = null;
+ int newH = Math.Max (
+ this.ClientRectangle.Height - contentSize.Height - Spacing * (Children.Count - 1),
+ stretchedGO.MinimumSize.Height);
+ if (stretchedGO.MaximumSize.Height > 0)
+ newH = Math.Min (newH, stretchedGO.MaximumSize.Height);
+ if (newH != stretchedGO.Slot.Height) {
+ stretchedGO.Slot.Height = newH;
+ stretchedGO.bmp = null;
#if DEBUG_LAYOUTING
Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString());
#endif
- stretchedGO.LayoutChanged -= OnChildLayoutChanges;
- stretchedGO.OnLayoutChanges (LayoutingType.Height);
- stretchedGO.LayoutChanged += OnChildLayoutChanges;
- stretchedGO.LastSlots.Height = stretchedGO.Slot.Height;
+ stretchedGO.LayoutChanged -= OnChildLayoutChanges;
+ stretchedGO.OnLayoutChanges (LayoutingType.Height);
+ stretchedGO.LayoutChanged += OnChildLayoutChanges;
+ stretchedGO.LastSlots.Height = stretchedGO.Slot.Height;
+ }
}
if (Height == Measure.Fit)