Пример #1
0
        private DynamicDropDownMenu CreateMenu(Direction direction = Direction.Down)
        {
            DropDownMenuFactory menuFactory = new DropDownMenuFactory();

            menuFactory.normalFillColor  = this.normalFillColor;
            menuFactory.hoverFillColor   = this.hoverFillColor;
            menuFactory.pressedFillColor = this.pressedFillColor;
            menuFactory.pressedFillColor = this.pressedFillColor;

            menuFactory.normalBorderColor   = this.normalBorderColor;
            menuFactory.hoverBorderColor    = this.hoverBorderColor;
            menuFactory.pressedBorderColor  = this.pressedBorderColor;
            menuFactory.disabledBorderColor = this.disabledBorderColor;

            menuFactory.normalTextColor   = this.normalTextColor;
            menuFactory.hoverTextColor    = this.hoverTextColor;
            menuFactory.pressedTextColor  = this.pressedTextColor;
            menuFactory.disabledTextColor = this.disabledTextColor;

            DynamicDropDownMenu menu = menuFactory.Generate(direction: direction);

            menu.Height           = FixedHeight;
            menu.BorderColor      = normalBorderColor;
            menu.HoverArrowColor  = this.hoverTextColor;
            menu.NormalArrowColor = this.normalTextColor;
            menu.BackgroundColor  = normalFillColor;

            return(menu);
        }
Пример #2
0
        private DynamicDropDownMenu CreateDropDown(Direction direction)
        {
            DynamicDropDownMenu menu = new DynamicDropDownMenu("", direction);

            menu.VAnchor           = VAnchor.ParentCenter;
            menu.MenuAsWideAsItems = false;
            menu.AlignToRightEdge  = true;
            menu.Height            = defaultButton.Height;

            return(menu);
        }
Пример #3
0
        public SplitButton(Button button, DynamicDropDownMenu menu)
            : base(FlowDirection.LeftToRight, HAnchor.FitToChildren, VAnchor.FitToChildren)
        {
            defaultButton = button;
            altChoices    = menu;

            defaultButton.VAnchor = VAnchor.ParentCenter;

            AddChild(defaultButton);
            AddChild(altChoices);
        }
Пример #4
0
        public SplitButton(string buttonText, Direction direction = Direction.Down)
            : base(FlowDirection.LeftToRight, HAnchor.FitToChildren, VAnchor.FitToChildren)
        {
            defaultButton = CreateDefaultButton(buttonText);
            altChoices    = CreateDropDown(direction);

            defaultButton.VAnchor = VAnchor.ParentCenter;

            AddChild(defaultButton);
            AddChild(altChoices);
        }
Пример #5
0
        public SplitButton Generate(TupleList <string, Func <bool> > buttonList, Direction direction = Direction.Down, string imageName = null)
        {
            this.imageName = imageName;

            DynamicDropDownMenu menu = CreateMenu(direction);

            menu.Margin = new BorderDouble();
            Button button = CreateButton(buttonList [0]);

            for (int index = 1; index < buttonList.Count; index++)
            {
                menu.addItem(buttonList[index].Item1, buttonList[index].Item2);
            }

            SplitButton splitButton = new SplitButton(button, menu);

            return(splitButton);
        }
        public DynamicDropDownMenu Generate(string label = "", TupleList <string, Func <bool> > optionList = null, Direction direction = Direction.Down)
        {
            DynamicDropDownMenu menu = new DynamicDropDownMenu(label, CreateButtonViewStates(label), direction);

            menu.VAnchor           = VAnchor.ParentCenter;
            menu.HAnchor           = HAnchor.FitToChildren;
            menu.MenuAsWideAsItems = false;
            menu.AlignToRightEdge  = true;
            menu.NormalColor       = normalFillColor;
            menu.HoverColor        = hoverFillColor;
            menu.BorderColor       = normalBorderColor;
            menu.BackgroundColor   = menu.NormalColor;

            if (optionList != null)
            {
                foreach (Tuple <string, Func <bool> > option in optionList)
                {
                    menu.addItem(option.Item1, option.Item2);
                }
            }

            return(menu);
        }