Example #1
0
        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);
            }
        }
Example #2
0
 public void AddMenu(GH_ExtendableMenu menu)
 {
     collection.AddMenu(menu);
 }
Example #3
0
 public void AddMenu(GH_ExtendableMenu _menu)
 {
     _collection.AddMenu(_menu);
 }