aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-04-23 14:16:33 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-04-23 14:16:33 +0200
commitea355fe15d538b1d1dca230aa816a99556013924 (patch)
treedd3f4860ea2eac854833137c7864569a2a69be69 /src
parentb3c2c1f21e96418d6b3a91ff75a182e84cb5b6a5 (diff)
update test before changes
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/GenericStack.cs2
-rw-r--r--src/GraphicObjects/GraphicObject.cs89
2 files changed, 52 insertions, 39 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 455ed928..dd385201 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -218,6 +218,8 @@ namespace Crow
{
base.OnChildLayoutChanges (sender, arg);
+ GraphicObject go = sender as GraphicObject;
+
switch (arg.LayoutType) {
case LayoutingType.Width:
if (Orientation == Orientation.Horizontal) {
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 4e230d4f..e4d17351 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -747,7 +747,7 @@ namespace Crow
if (Left == 0) {
if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
- RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
switch (HorizontalAlignment) {
@@ -763,21 +763,12 @@ namespace Crow
}
} else
Slot.X = Left;
-
- if (LastSlots.X == Slot.X)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.X = Slot.X;
break;
case LayoutingType.Y:
if (Top == 0) {
if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
- RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ RegisteredLayoutings.HasFlag (LayoutingType.Height))
return false;
switch (VerticalAlignment) {
@@ -791,17 +782,8 @@ namespace Crow
Slot.Y = Parent.ClientRectangle.Height / 2 - Slot.Height / 2;
break;
}
- }else
+ } else
Slot.Y = Top;
-
- if (LastSlots.Y == Slot.Y)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.Y = Slot.Y;
break;
case LayoutingType.Width:
if (Width.IsFixed)
@@ -813,7 +795,7 @@ namespace Crow
else if (Width == Measure.Stretched)
Slot.Width = Parent.ClientRectangle.Width;
else
- Slot.Width = (int)Math.Round((double)(Parent.ClientRectangle.Width * Width) / 100.0);
+ Slot.Width = (int)Math.Round ((double)(Parent.ClientRectangle.Width * Width) / 100.0);
if (Slot.Width < 0)
return false;
@@ -826,15 +808,6 @@ namespace Crow
Slot.Width = MaximumSize.Width;
NotifyValueChanged ("WidthPolicy", Measure.Stretched);
}
-
- if (LastSlots.Width == Slot.Width)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.Width = Slot.Width;
break;
case LayoutingType.Height:
if (Height.IsFixed)
@@ -846,7 +819,7 @@ namespace Crow
else if (Height == Measure.Stretched)
Slot.Height = Parent.ClientRectangle.Height;
else
- Slot.Height = (int)Math.Round((double)(Parent.ClientRectangle.Height * Height) / 100.0);
+ Slot.Height = (int)Math.Round ((double)(Parent.ClientRectangle.Height * Height) / 100.0);
if (Slot.Height < 0)
return false;
@@ -859,23 +832,61 @@ namespace Crow
Slot.Height = MaximumSize.Height;
NotifyValueChanged ("HeightPolicy", Measure.Stretched);
}
+ break;
+ }
- if (LastSlots.Height == Slot.Height)
+ updateSlot (layoutType);
+
+ //if no layouting remains in queue for item, registre for redraw
+ if (this.registeredLayoutings == LayoutingType.None && bmp == null)
+ this.AddToRedrawList ();
+
+ return true;
+ }
+ protected void updateSlot(LayoutingType layoutType)
+ {
+ switch (layoutType) {
+ case LayoutingType.X:
+ if (LastSlots.X == Slot.X)
break;
bmp = null;
OnLayoutChanges (layoutType);
- LastSlots.Height = Slot.Height;
+ LastSlots.X = Slot.X;
break;
- }
+ case LayoutingType.Y:
+ if (LastSlots.Y == Slot.Y)
+ break;
- //if no layouting remains in queue for item, registre for redraw
- if (this.registeredLayoutings == LayoutingType.None && bmp == null)
- this.AddToRedrawList ();
+ bmp = null;
- return true;
+ OnLayoutChanges (layoutType);
+
+ LastSlots.Y = Slot.Y;
+ break;
+ case LayoutingType.Width:
+ if (LastSlots.Width == Slot.Width)
+ break;
+
+ bmp = null;
+
+ OnLayoutChanges (layoutType);
+
+ LastSlots.Width = Slot.Width;
+ break;
+ case LayoutingType.Height:
+ if (LastSlots.Height == Slot.Height)
+ break;
+
+ bmp = null;
+
+ OnLayoutChanges (layoutType);
+
+ LastSlots.Height = Slot.Height;
+ break;
+ }
}
#endregion