Example #1
0
        public void AddButton(LocalisableString firstLine, string secondLine, IconUsage icon, Color4 colour, Action action)
        {
            var button = new BeatmapOptionsButton
            {
                FirstLineText  = firstLine,
                SecondLineText = secondLine,
                Icon           = icon,
                ButtonColour   = colour,
                Action         = () =>
                {
                    Hide();
                    action?.Invoke();
                },
            };

            buttonsContainer.Add(button);
        }
Example #2
0
        /// <param name="firstLine">Text in the first line.</param>
        /// <param name="secondLine">Text in the second line.</param>
        /// <param name="colour">Colour of the button.</param>
        /// <param name="icon">Icon of the button.</param>
        /// <param name="hotkey">Hotkey of the button.</param>
        /// <param name="action">Binding the button does.</param>
        public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action, Key?hotkey = null)
        {
            var button = new BeatmapOptionsButton
            {
                FirstLineText  = firstLine,
                SecondLineText = secondLine,
                Icon           = icon,
                ButtonColour   = colour,
                Action         = () =>
                {
                    Hide();
                    action?.Invoke();
                },
                HotKey = hotkey
            };

            buttonsContainer.Add(button);
        }
Example #3
0
        /// <param name="firstLine">Text in the first line.</param>
        /// <param name="secondLine">Text in the second line.</param>
        /// <param name="colour">Colour of the button.</param>
        /// <param name="icon">Icon of the button.</param>
        /// <param name="hotkey">Hotkey of the button.</param>
        /// <param name="action">Binding the button does.</param>
        /// <param name="depth">
        /// <para>Lower depth to be put on the left, and higher to be put on the right.</para>
        /// <para>Notice this is different to <see cref="Footer"/>!</para>
        /// </param>
        public void AddButton(string firstLine, string secondLine, FontAwesome icon, Color4 colour, Action action, Key?hotkey = null, float depth = 0)
        {
            var button = new BeatmapOptionsButton
            {
                FirstLineText  = firstLine,
                SecondLineText = secondLine,
                Icon           = icon,
                ButtonColour   = colour,
                Depth          = depth,
                Action         = () =>
                {
                    Hide();
                    action?.Invoke();
                },
                HotKey = hotkey
            };

            buttonsContainer.Add(button);
            buttonsContainer.SetLayoutPosition(button, depth);
        }
Example #4
0
        protected override bool OnKeyDown(KeyDownEvent e)
        {
            // don't absorb control as ToolbarRulesetSelector uses control + number to navigate
            if (e.ControlPressed)
            {
                return(false);
            }

            if (!e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9)
            {
                int requested = e.Key - Key.Number1;

                // go reverse as buttonsContainer is a ReverseChildIDFillFlowContainer
                BeatmapOptionsButton found = buttonsContainer.Children.ElementAtOrDefault((buttonsContainer.Children.Count - 1) - requested);

                if (found != null)
                {
                    found.TriggerClick();
                    return(true);
                }
            }

            return(base.OnKeyDown(e));
        }