Ignore:
Timestamp:
09/03/13 15:46:01 (6 years ago)
Author:
ascheibe
Message:

#1730 merged r9587,r9590, r9600, r9607, r9626, r9658, r9659, r9699, r9906 into stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ControlExtensions.cs

    r9456 r9931  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Runtime.InteropServices;
    2425using System.Windows.Forms;
     
    4546      }
    4647    }
     48
     49    public static IEnumerable<Control> GetNestedControls(this Control control, Func<Control, bool> condition = null) {
     50      if (control == null) yield break;
     51      if (condition == null) condition = (c) => true;
     52
     53      Queue<Control> unprocessed = new Queue<Control>();
     54      unprocessed.Enqueue(control);
     55
     56      while (unprocessed.Count > 0) {
     57        Control c = unprocessed.Dequeue();
     58        if (condition(c)) yield return c;
     59        foreach (Control child in c.Controls)
     60          unprocessed.Enqueue(child);
     61      }
     62    }
    4763  }
    4864}
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r9456 r9931  
    386386      ToolStripMenuItem item = new ToolStripMenuItem();
    387387      this.SetToolStripItemProperties(item, menuItem);
     388      this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), item, menuStrip.Items);
    388389      if (menuItem is MenuItem) {
    389390        MenuItem menuItemBase = (MenuItem)menuItem;
     
    392393        item.DisplayStyle = menuItemBase.ToolStripItemDisplayStyle;
    393394      }
    394       this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), item, menuStrip.Items);
    395395    }
    396396
Note: See TracChangeset for help on using the changeset viewer.