aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-06 07:11:22 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-06 07:11:22 +0100
commit643d44f381962d6814d3676cee322c41018406eb (patch)
tree313429713063c06ec57e675682e7a6c176e62e22 /src/GraphicObjects
parent27c400b4aa2195ee0ea17af803919ae677b9fff7 (diff)
2 step, 1=> Simple Register, 2=> Enqueue with priority checking
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GenericStack.cs7
-rw-r--r--src/GraphicObjects/GraphicObject.cs19
-rw-r--r--src/GraphicObjects/Grid.cs6
3 files changed, 19 insertions, 13 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index d4e3ae5d..e2bdcf7a 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -108,16 +108,15 @@ namespace Crow
bmp = null;
}
- public override void RegisterForLayouting (int layoutType)
+ public override void EnqueueForLayouting ()
{
if (Parent == null)
return;
- base.RegisterForLayouting (layoutType);
+ base.EnqueueForLayouting ();
- if ((layoutType & (int)LayoutingType.PositionChildren) > 0)
+ if (RegisteredLayoutings.HasFlag(LayoutingType.PositionChildren))
Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);
-
}
public override void UpdateLayout (LayoutingType layoutType)
{
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 53dee9cc..97afaa7e 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -509,9 +509,16 @@ namespace Crow
RegisteredLQINodes.Remove (lqis [i]);
}
}
+ public LayoutingType RegisteredLayoutings = 0;
+
+ public virtual void RegisterForLayouting(int layoutType){
+ if (RegisteredLayoutings == LayoutingType.None)
+ Interface.RegisteredGOForLayouting.Enqueue (this);
+ RegisteredLayoutings |= (LayoutingType)layoutType;
+ }
/// <summary> clear current layoutingQueue items for object and
/// trigger a new layouting pass for a layoutType </summary>
- public virtual void RegisterForLayouting(int layoutType)
+ public virtual void EnqueueForLayouting()
{
if (Parent == null)
return;
@@ -519,8 +526,8 @@ namespace Crow
Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString());
#endif
- deleteLQI (layoutType);
- if ((layoutType & (int)LayoutingType.Width) > 0) {
+ //deleteLQI (RegisteredLayoutings);
+ if (RegisteredLayoutings.HasFlag(LayoutingType.Width)) {
if (Bounds.Width == 0) //stretch in parent
Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
else if (Bounds.Width < 0) //fit
@@ -531,7 +538,7 @@ namespace Crow
new LayoutingQueueItem (LayoutingType.Width, this)));
}
- if ((layoutType & (int)LayoutingType.Height) > 0) {
+ if (RegisteredLayoutings.HasFlag(LayoutingType.Height)) {
if (Bounds.Height == 0) //stretch in parent
Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Height, this);
else if (Bounds.Height < 0) //fit
@@ -544,11 +551,11 @@ namespace Crow
}
}
- if ((layoutType & (int)LayoutingType.X) > 0)
+ if (RegisteredLayoutings.HasFlag(LayoutingType.X))
//for x positionning, sizing of parent and this have to be done
Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.X, this);
- if ((layoutType & (int)LayoutingType.Y) > 0)
+ if (RegisteredLayoutings.HasFlag(LayoutingType.Y))
//for x positionning, sizing of parent and this have to be done
Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.Y, this);
}
diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs
index 1981fc60..571fdc0f 100644
--- a/src/GraphicObjects/Grid.cs
+++ b/src/GraphicObjects/Grid.cs
@@ -125,11 +125,11 @@ namespace Crow
}
}
- public override void RegisterForLayouting (int layoutType)
+ public override void EnqueueForLayouting ()
{
- base.RegisterForLayouting (layoutType);
+ base.EnqueueForLayouting ();
- if ((layoutType & (int)LayoutingType.PositionChildren) > 0)
+ if (RegisteredLayoutings.HasFlag(LayoutingType.PositionChildren))
Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);
}
public override void UpdateLayout (LayoutingType layoutType)