aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-08 09:12:54 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-08 09:12:54 +0100
commitb915ff1d6d8fdefb5482b7faa3d68734a14047eb (patch)
tree8bf687925e5d0e60031135bcc7da53011d4eb30b /src
parente7f1d4eac6b5023810152bf1f6c45f563bd0e202 (diff)
ensure Groups use Children property (overridable) instead of children field
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/ComboBox.cs2
-rw-r--r--src/GraphicObjects/GenericStack.cs8
-rw-r--r--src/GraphicObjects/Grid.cs8
-rw-r--r--src/GraphicObjects/Group.cs44
-rw-r--r--src/GraphicObjects/ListBox.cs2
-rw-r--r--src/OpenTKGameWindow.cs108
6 files changed, 86 insertions, 86 deletions
diff --git a/src/GraphicObjects/ComboBox.cs b/src/GraphicObjects/ComboBox.cs
index aee7da9b..c071cb5e 100644
--- a/src/GraphicObjects/ComboBox.cs
+++ b/src/GraphicObjects/ComboBox.cs
@@ -173,7 +173,7 @@ namespace Crow
if (!threadedLoadingFinished && pendingChildrenAddition.Count < 50)
return;
while (pendingChildrenAddition.Count > 0) {
- _list.addChild (pendingChildrenAddition.Dequeue ());
+ _list.AddChild (pendingChildrenAddition.Dequeue ());
}
}
}
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index d2338362..665ba65d 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -28,15 +28,15 @@ namespace Crow
Orientation _orientation;
#endregion
- public override T addChild<T> (T child)
+ public override T AddChild<T> (T child)
{
- T tmp = base.addChild (child);
+ T tmp = base.AddChild (child);
this.RegisterForLayouting (LayoutingType.PositionChildren);
return tmp;
}
- public override void removeChild (GraphicObject child)
+ public override void RemoveChild (GraphicObject child)
{
- base.removeChild (child);
+ base.RemoveChild (child);
this.RegisterForLayouting (LayoutingType.PositionChildren);
}
diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs
index fc3d8988..c242899f 100644
--- a/src/GraphicObjects/Grid.cs
+++ b/src/GraphicObjects/Grid.cs
@@ -29,15 +29,15 @@ namespace Crow
int _rowCount;
#endregion
- public override T addChild<T> (T child)
+ public override T AddChild<T> (T child)
{
- T tmp = base.addChild (child);
+ T tmp = base.AddChild (child);
this.RegisterForLayouting (LayoutingType.PositionChildren);
return tmp;
}
- public override void removeChild (GraphicObject child)
+ public override void RemoveChild (GraphicObject child)
{
- base.removeChild (child);
+ base.RemoveChild (child);
this.RegisterForLayouting (LayoutingType.PositionChildren);
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 8737b866..9d9abbc6 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -42,21 +42,21 @@ namespace Crow
}
- public virtual T addChild<T>(T child)
+ public virtual T AddChild<T>(T child)
{
GraphicObject g = child as GraphicObject;
- Children.Add(g);
+ children.Add(g);
g.Parent = this as GraphicObject;
g.RegisterForLayouting (LayoutingType.Sizing);
g.LayoutChanged += OnChildLayoutChanges;
return (T)child;
}
- public virtual void removeChild(GraphicObject child)
+ public virtual void RemoveChild(GraphicObject child)
{
child.LayoutChanged -= OnChildLayoutChanges;
child.ClearBinding ();
child.Parent = null;
- Children.Remove(child);
+ children.Remove(child);
this.RegisterForLayouting (LayoutingType.Sizing);
}
public virtual void ClearChildren()
@@ -66,25 +66,25 @@ namespace Crow
g.LayoutChanged -= OnChildLayoutChanges;
g.ClearBinding ();
g.Parent = null;
- Children.RemoveAt(children.Count-1);
+ children.RemoveAt(children.Count-1);
}
this.RegisterForLayouting (LayoutingType.Sizing);
ChildrenCleared.Raise (this, new EventArgs ());
}
public void putWidgetOnTop(GraphicObject w)
{
- if (Children.Contains(w))
+ if (children.Contains(w))
{
- Children.Remove(w);
- Children.Add(w);
+ children.Remove(w);
+ children.Add(w);
}
}
public void putWidgetOnBottom(GraphicObject w)
{
- if (Children.Contains(w))
+ if (children.Contains(w))
{
- Children.Remove(w);
- Children.Insert(0, w);
+ children.Remove(w);
+ children.Insert(0, w);
}
}
@@ -93,7 +93,7 @@ namespace Crow
get {
if (!base.DrawingIsValid)
return false;
- foreach (GraphicObject g in Children) {
+ foreach (GraphicObject g in children) {
if (!g.DrawingIsValid)
return false;
}
@@ -103,7 +103,7 @@ namespace Crow
public override void ResolveBindings ()
{
base.ResolveBindings ();
- foreach (GraphicObject w in Children)
+ foreach (GraphicObject w in children)
w.ResolveBindings ();
}
public override GraphicObject FindByName (string nameToFind)
@@ -111,7 +111,7 @@ namespace Crow
if (Name == nameToFind)
return this;
- foreach (GraphicObject w in Children) {
+ foreach (GraphicObject w in children) {
GraphicObject r = w.FindByName (nameToFind);
if (r != null)
return r;
@@ -120,7 +120,7 @@ namespace Crow
}
public override bool Contains (GraphicObject goToFind)
{
- foreach (GraphicObject w in Children) {
+ foreach (GraphicObject w in children) {
if (w == goToFind)
return true;
if (w.Contains (goToFind))
@@ -140,14 +140,14 @@ namespace Crow
//position smaller objects in group when group size is fit
switch (layoutType) {
case LayoutingType.Width:
- foreach (GraphicObject c in Children) {
+ foreach (GraphicObject c in children) {
if (!c.Visible)
continue;
c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
}
break;
case LayoutingType.Height:
- foreach (GraphicObject c in Children) {
+ foreach (GraphicObject c in children) {
if (!c.Visible)
continue;
c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height); }
@@ -212,7 +212,7 @@ namespace Crow
{
base.onDraw (gr);
- foreach (GraphicObject g in Children) {
+ foreach (GraphicObject g in children) {
g.Paint (ref gr);
}
}
@@ -252,7 +252,7 @@ namespace Crow
#if DEBUG_CLIP_RECTANGLE
clip.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
#endif
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in children.Where(ch=>ch.Visible)) {
Rectangles childClip = clip.intersectingRects (ContextCoordinates(c.Slot));
if (!c.DrawingIsValid || childClip.count > 0)
c.Paint (ref gr, childClip);//, localClip);
@@ -275,7 +275,7 @@ namespace Crow
HostContainer.hoverWidget = this;
onMouseEnter (this, e);
}
- foreach (GraphicObject g in Children)
+ foreach (GraphicObject g in children)
{
if (g.MouseIsIn(e.Position))
{
@@ -313,7 +313,7 @@ namespace Crow
throw new Exception ("Crow." + subTree.Name + " type not found");
GraphicObject go = (GraphicObject)Activator.CreateInstance(t);
(go as IXmlSerializable).ReadXml(subTree);
- addChild(go);
+ AddChild(go);
}
}
}
@@ -321,7 +321,7 @@ namespace Crow
{
base.WriteXml(writer);
- foreach (GraphicObject go in Children)
+ foreach (GraphicObject go in children)
{
writer.WriteStartElement(go.GetType().Name);
(go as IXmlSerializable).WriteXml(writer);
diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs
index dfa248cf..3822275e 100644
--- a/src/GraphicObjects/ListBox.cs
+++ b/src/GraphicObjects/ListBox.cs
@@ -101,7 +101,7 @@ namespace Crow
ms.Seek(0,SeekOrigin.Begin);
GraphicObject g = Interface.Load (ms, t);
g.MouseClick += itemClick;
- _list.addChild (g);
+ _list.AddChild (g);
g.DataSource = item;
}
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs
index 12099e48..2083346c 100644
--- a/src/OpenTKGameWindow.cs
+++ b/src/OpenTKGameWindow.cs
@@ -249,76 +249,76 @@ namespace Crow
updateTime.Restart ();
#endif
- surf = new ImageSurface(bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height,ClientRectangle.Width*4);
- ctx = new Context(surf);
+ using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+ using (ctx = new Context (surf)){
- GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
- GraphicObjects.CopyTo (invGOList,0);
- invGOList = invGOList.Reverse ().ToArray ();
+ GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
+ GraphicObjects.CopyTo (invGOList, 0);
+ invGOList = invGOList.Reverse ().ToArray ();
- #if MEASURE_TIME
- layoutTime.Start ();
- #endif
- //Debug.WriteLine ("======= Layouting queue start =======");
-
- while (Interface.LayoutingQueue.Count > 0) {
- LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
- lqi.ProcessLayouting ();
- }
+ #if MEASURE_TIME
+ layoutTime.Start ();
+ #endif
+ //Debug.WriteLine ("======= Layouting queue start =======");
- #if MEASURE_TIME
- layoutTime.Stop ();
- #endif
+ while (Interface.LayoutingQueue.Count > 0) {
+ LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+ lqi.ProcessLayouting ();
+ }
- //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
- //final redraw clips should be added only when layout is completed among parents,
- //that's why it take place in a second pass
- GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
- gobjsToRedraw.CopyTo (gotr);
- gobjsToRedraw.Clear ();
- foreach (GraphicObject p in gotr) {
- p.registerClipRect ();
- }
+ #if MEASURE_TIME
+ layoutTime.Stop ();
+ #endif
- #if MEASURE_TIME
- updateTime.Stop ();
- drawingTime.Start ();
- #endif
+ //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
+ //final redraw clips should be added only when layout is completed among parents,
+ //that's why it take place in a second pass
+ GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
+ gobjsToRedraw.CopyTo (gotr);
+ gobjsToRedraw.Clear ();
+ foreach (GraphicObject p in gotr) {
+ p.registerClipRect ();
+ }
- lock (redrawClip) {
- if (redrawClip.count > 0) {
- #if DEBUG_CLIP_RECTANGLE
- redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
+ #if MEASURE_TIME
+ updateTime.Stop ();
+ drawingTime.Start ();
#endif
- redrawClip.clearAndClip (ctx);
- //Link.draw (ctx);
- foreach (GraphicObject p in invGOList) {
- if (p.Visible) {
+ lock (redrawClip) {
+ if (redrawClip.count > 0) {
+ #if DEBUG_CLIP_RECTANGLE
+ redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
+ #endif
+ redrawClip.clearAndClip (ctx);
+
+ //Link.draw (ctx);
+ foreach (GraphicObject p in invGOList) {
+ if (p.Visible) {
- ctx.Save ();
- if (redrawClip.count > 0) {
- Rectangles clip = redrawClip.intersectingRects (p.Slot);
+ ctx.Save ();
+ if (redrawClip.count > 0) {
+ Rectangles clip = redrawClip.intersectingRects (p.Slot);
- if (clip.count > 0)
- p.Paint (ref ctx, clip);
+ if (clip.count > 0)
+ p.Paint (ref ctx, clip);
+ }
+ ctx.Restore ();
+ }
}
- ctx.Restore ();
+ ctx.ResetClip ();
+ #if DEBUG_CLIP_RECTANGLE
+ redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));
+ #endif
+ redrawClip.Reset ();
}
}
- ctx.ResetClip ();
- #if DEBUG_CLIP_RECTANGLE
- redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));
+ #if MEASURE_TIME
+ drawingTime.Stop ();
#endif
- redrawClip.Reset ();
+ //surf.WriteToPng (@"/mnt/data/test.png");
}
}
- #if MEASURE_TIME
- drawingTime.Stop ();
- #endif
- //surf.WriteToPng (@"/mnt/data/test.png");
- ctx.Dispose ();
- surf.Dispose ();
// if (ToolTip.isVisible) {
// ToolTip.panel.processkLayouting();
// if (ToolTip.panel.layoutIsValid)