public void Merge(GH_MenuCollection other) { for (int i = 0; i < other._menus.Count; i++) { AddMenu(other._menus[i]); } }
public GH_SwitcherComponentAttributes(GH_SwitcherComponent component) : base(component) { collection = new GH_MenuCollection(); composedCollection = new GH_MenuCollection(); composedCollection.Merge(collection); CreateUnitDropDown(); InitializeUnitParameters(); }
private void ComposeMenu() { GH_SwitcherComponent gH_SwitcherComponent = (GH_SwitcherComponent)base.Owner; composedCollection = new GH_MenuCollection(); EvaluationUnit activeUnit = gH_SwitcherComponent.ActiveUnit; if (activeUnit != null && activeUnit.Context.Collection != null) { composedCollection.Merge(gH_SwitcherComponent.ActiveUnit.Context.Collection); } if (collection != null) { composedCollection.Merge(collection); } if (unitMenuCollection != null) { composedCollection.Merge(unitMenuCollection); } }
protected void CreateUnitDropDown() { GH_SwitcherComponent gH_SwitcherComponent = (GH_SwitcherComponent)base.Owner; if (gH_SwitcherComponent.EvalUnits != null && gH_SwitcherComponent.EvalUnits.Count != 0 && (gH_SwitcherComponent.EvalUnits.Count != 1 || gH_SwitcherComponent.UnitlessExistence)) { MenuPanel menuPanel = new MenuPanel(0, "panel_units"); menuPanel.Header = "Unit selection"; string text = gH_SwitcherComponent.UnitMenuName; if (text == null) { text = "Evaluation Units"; } string text2 = gH_SwitcherComponent.UnitMenuHeader; if (text2 == null) { text2 = "Select evaluation unit"; } unitMenuCollection = new GH_MenuCollection(); GH_ExtendableMenu gH_ExtendableMenu = new GH_ExtendableMenu(0, "menu_units"); gH_ExtendableMenu.Name = text; gH_ExtendableMenu.Header = text2; gH_ExtendableMenu.AddControl(menuPanel); _UnitDrop = new MenuDropDown(0, "dropdown_units", "units"); _UnitDrop.VisibleItemCount = 10; _UnitDrop.ValueChanged += _UnitDrop__valueChanged; _UnitDrop.Header = "Evaluation unit selector"; menuPanel.AddControl(_UnitDrop); List <EvaluationUnit> evalUnits = gH_SwitcherComponent.EvalUnits; if (gH_SwitcherComponent.UnitlessExistence) { _UnitDrop.AddItem("--NONE--", null); } for (int i = 0; i < evalUnits.Count; i++) { _UnitDrop.AddItem(evalUnits[i].Name, evalUnits[i].DisplayName, evalUnits[i]); } gH_ExtendableMenu.Expand(); unitMenuCollection.AddMenu(gH_ExtendableMenu); } }
public EvaluationUnitContext(EvaluationUnit unit) { this.unit = unit; collection = new GH_MenuCollection(); }
public GH_ExtendableComponentAttributes(IGH_Component nComponent) : base(nComponent) { _collection = new GH_MenuCollection(); }