diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-15 17:32:04 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-15 17:32:04 +0200 |
| commit | 1fdbaaf4ae209e26ef8767ae13ebb9aa9d1f79c7 (patch) | |
| tree | 5586932c635ca68a67bddcb83918b74ecad79758 /src/GraphicObjects/Group.cs | |
| parent | 570f6f9b7c9ed25adf618b02f5cfe0f1b3e9afe7 (diff) | |
Revert "replace foreach loops with for ones"
This reverts commit 1c3263454961eb207a01b67c51d0acf88376d522.
Diffstat (limited to 'src/GraphicObjects/Group.cs')
| -rw-r--r-- | src/GraphicObjects/Group.cs | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index ad0d28a0..549ca219 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -135,10 +135,9 @@ namespace Crow { base.OnDataSourceChanged (this, e); lock (children) { - for (int i = 0; i < children.Count; i++) { - if (children[i].localDataSourceIsNull & children[i].localLogicalParentIsNull) - children[i].OnDataSourceChanged (sender, e); - } + foreach (GraphicObject g in children) + if (g.localDataSourceIsNull & g.localLogicalParentIsNull) + g.OnDataSourceChanged (sender, e); } } public override GraphicObject FindByName (string nameToFind) @@ -147,8 +146,8 @@ namespace Crow return this; GraphicObject tmp = null; lock (children) { - for (int i = 0; i < children.Count; i++) { - tmp = children[i].FindByName (nameToFind); + foreach (GraphicObject w in Children) { + tmp = w.FindByName (nameToFind); if (tmp != null) break; } @@ -157,10 +156,10 @@ namespace Crow } public override bool Contains (GraphicObject goToFind) { - for (int i = 0; i < children.Count; i++) { - if (children[i] == goToFind) + foreach (GraphicObject w in Children) { + if (w == goToFind) return true; - if (children[i].Contains (goToFind)) + if (w.Contains (goToFind)) return true; } return false; @@ -196,19 +195,19 @@ namespace Crow //position smaller objects in group when group size is fit switch (layoutType) { case LayoutingType.Width: - for (int i = 0; i < children.Count; i++) { - if (children[i].Width.Units == Unit.Percent) - children[i].RegisterForLayouting (LayoutingType.Width); + foreach (GraphicObject c in Children){ + if (c.Width.Units == Unit.Percent) + c.RegisterForLayouting (LayoutingType.Width); else - children[i].RegisterForLayouting (LayoutingType.X); + c.RegisterForLayouting (LayoutingType.X); } break; case LayoutingType.Height: - for (int i = 0; i < children.Count; i++) { - if (children[i].Height.Units == Unit.Percent) - children[i].RegisterForLayouting (LayoutingType.Height); + foreach (GraphicObject c in Children) { + if (c.Height.Units == Unit.Percent) + c.RegisterForLayouting (LayoutingType.Height); else - children[i].RegisterForLayouting (LayoutingType.Y); + c.RegisterForLayouting (LayoutingType.Y); } break; } @@ -226,8 +225,8 @@ namespace Crow } lock (children) { - for (int i = 0; i < children.Count; i++) { - children[i].Paint (ref gr); + foreach (GraphicObject g in Children) { + g.Paint (ref gr); } } gr.Restore (); @@ -248,12 +247,11 @@ namespace Crow gr.Clip (); lock (Children) { - for (int i = 0; i < children.Count; i++) { - if (!children[i].Visible) - continue; - if (Clipping.Contains (children[i].Slot + ClientRectangle.Position) == RegionOverlap.Out) + foreach (GraphicObject c in Children) { + if (!c.Visible) continue; - children[i].Paint (ref gr); + if (Clipping.intersect (c.Slot + ClientRectangle.Position)) + c.Paint (ref gr); } } |