aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-06 17:01:28 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-06 17:01:28 +0100
commit1c7f2d63a7230cb487faf915b9431784653f48ef (patch)
tree810803b4065b7fc7f4de5f078aa70f4108adff5c /src
parentcb91338f8038afbade79f12e04d0294b94f75228 (diff)
resolved Checkbox bug (template was modified), adjust several layout registering
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/GenericStack.cs55
-rw-r--r--src/GraphicObjects/GraphicObject.cs8
-rw-r--r--src/GraphicObjects/Group.cs19
-rw-r--r--src/GraphicObjects/PrivateContainer.cs12
4 files changed, 52 insertions, 42 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 5de21fac..291d300d 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -66,14 +66,18 @@ namespace Crow
Size tmp = new Size ();
if (Orientation == Orientation.Horizontal) {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
tmp.Width += c.Slot.Width + Spacing;
tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
}
if (tmp.Width > 0)
tmp.Width -= Spacing;
} else {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
tmp.Height += c.Slot.Height + Spacing;
}
@@ -93,18 +97,20 @@ namespace Crow
#endif
int d = 0;
if (Orientation == Orientation.Horizontal) {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
c.Slot.X = d;
d += c.Slot.Width + Spacing;
- if (c.Height != 0)
- c.RegisterForLayouting (LayoutingType.Y);
+ c.RegisterForLayouting (LayoutingType.Y);
}
} else {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
c.Slot.Y = d;
d += c.Slot.Height + Spacing;
- if (c.Width != 0)
- c.RegisterForLayouting (LayoutingType.X);
+ c.RegisterForLayouting (LayoutingType.X);
}
}
bmp = null;
@@ -114,6 +120,19 @@ namespace Crow
{
RegisteredLayoutings &= (~layoutType);
+ LayoutingType childSizeToCheck;
+ if (Orientation == Orientation.Horizontal)
+ childSizeToCheck = LayoutingType.Width;
+ else
+ childSizeToCheck = LayoutingType.Height;
+
+ foreach (GraphicObject g in Children) {
+ if (!g.Visible)
+ continue;
+ if (g.RegisteredLayoutings.HasFlag (childSizeToCheck))
+ return false;
+ }
+
if (layoutType == LayoutingType.PositionChildren) {
//allow 1 child to have size to 0 if stack has fixed or streched size,
//this child will occupy remaining space
@@ -170,16 +189,16 @@ namespace Crow
return base.UpdateLayout(layoutType);
}
- public override void OnLayoutChanges (LayoutingType layoutType)
- {
- base.OnLayoutChanges (layoutType);
-
- if (Orientation == Orientation.Horizontal){
- if(layoutType == LayoutingType.Width)
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- }else if (layoutType == LayoutingType.Height)
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- }
+// public override void OnLayoutChanges (LayoutingType layoutType)
+// {
+// base.OnLayoutChanges (layoutType);
+//
+// if (Orientation == Orientation.Horizontal){
+// if(layoutType == LayoutingType.Width)
+// this.RegisterForLayouting (LayoutingType.PositionChildren);
+// }else if (layoutType == LayoutingType.Height)
+// this.RegisterForLayouting (LayoutingType.PositionChildren);
+// }
public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
{
base.OnChildLayoutChanges (sender, arg);
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 4d00b99a..40f5dcf7 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -549,13 +549,11 @@ namespace Crow
#endif
switch (layoutType) {
- case LayoutingType.Width:
- if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
- this.RegisterForLayouting (LayoutingType.X);
+ case LayoutingType.Width:
+ this.RegisterForLayouting (LayoutingType.X);
break;
case LayoutingType.Height:
- if (Height != 0 && Parent.getBounds().Height >=0) //update position in parent
- this.RegisterForLayouting (LayoutingType.Y);
+ this.RegisterForLayouting (LayoutingType.Y);
break;
}
LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 457187c6..9006191d 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -145,20 +145,17 @@ namespace Crow
//position smaller objects in group when group size is fit
switch (layoutType) {
case LayoutingType.Width:
- foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
- if (c.getBounds ().Width == 0)
- c.RegisterForLayouting (LayoutingType.Width);
- else
- c.RegisterForLayouting (LayoutingType.X);
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
}
break;
case LayoutingType.Height:
- foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
- if (c.getBounds ().Height == 0)
- c.RegisterForLayouting (LayoutingType.Height);
- else
- c.RegisterForLayouting (LayoutingType.Y);
- }
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height); }
break;
}
}
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index 15d3ce06..9f787eac 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -103,18 +103,14 @@ namespace Crow
switch (layoutType) {
case LayoutingType.Width:
if (child != null) {
- if (child.getBounds ().Width == 0)
- child.RegisterForLayouting (LayoutingType.Width);
- else
- child.RegisterForLayouting (LayoutingType.X);
+ if (child.Visible)
+ child.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
}
break;
case LayoutingType.Height:
if (child != null) {
- if (child.getBounds ().Height == 0)
- child.RegisterForLayouting (LayoutingType.Height);
- else
- child.RegisterForLayouting (LayoutingType.Y);
+ if (child.Visible)
+ child.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
}
break;
}