<commit_before>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;

namespace osu.Game.Screens.Edit.Menus
{
    public class EditorMenuBar : OsuMenu
    {
        public EditorMenuBar()
            : base(Direction.Horizontal, true)
        {
            RelativeSizeAxes = Axes.X;

            ItemsContainer.Padding = new MarginPadding { Left = 100 };
            BackgroundColour = OsuColour.FromHex("111");

            AddRangeInternal(new Drawable[]
            {
                new ScreenSelectionTabControl
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                    X = -15
                }
            });
        }

        protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();

        protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableEditorBarMenuItem(item);

        private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
        {
            private Color4 openedForegroundColour;
            private Color4 openedBackgroundColour;


            public DrawableEditorBarMenuItem(MenuItem item)
                : base(item)
            {
                Anchor = Anchor.CentreLeft;
                Origin = Anchor.CentreLeft;
            }

            public override void SetFlowDirection(Direction direction)
            {
                AutoSizeAxes = Axes.Both;
            }

            [BackgroundDependencyLoader]
            private void load(OsuColour colours)
            {
                ForegroundColour = ForegroundColourHover = colours.BlueLight;
                BackgroundColour = BackgroundColourHover = Color4.Transparent;
                openedForegroundColour = Color4.White;
                openedBackgroundColour = colours.Gray3;
            }

            protected override void UpdateBackgroundColour()
            {
                if (State == MenuItemState.Selected)
                    Background.FadeColour(openedBackgroundColour);
                else
                    base.UpdateBackgroundColour();
            }

            protected override void UpdateForegroundColour()
            {
                if (State == MenuItemState.Selected)
                    Foreground.FadeColour(openedForegroundColour);
                else
                    base.UpdateForegroundColour();
            }

            protected override void Update()
            {
                base.Update();
            }

            protected override Drawable CreateBackground() => new Container
            {
                RelativeSizeAxes = Axes.Both,
                Masking = true,
                Child = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Height = 2,
                    Masking = true,
                    CornerRadius = 4,
                    Child = new Box { RelativeSizeAxes = Axes.Both }
                }
            };

            protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
<commit_msg>Set the hover background colour as dictated by flyte<commit_after>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;

namespace osu.Game.Screens.Edit.Menus
{
    public class EditorMenuBar : OsuMenu
    {
        public EditorMenuBar()
            : base(Direction.Horizontal, true)
        {
            RelativeSizeAxes = Axes.X;

            ItemsContainer.Padding = new MarginPadding { Left = 100 };
            BackgroundColour = OsuColour.FromHex("111");

            AddRangeInternal(new Drawable[]
            {
                new ScreenSelectionTabControl
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                    X = -15
                }
            });
        }

        protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();

        protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableEditorBarMenuItem(item);

        private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
        {

            public DrawableEditorBarMenuItem(MenuItem item)
                : base(item)
            {
                Anchor = Anchor.CentreLeft;
                Origin = Anchor.CentreLeft;
            }

            [BackgroundDependencyLoader]
            private void load(OsuColour colours)
            {
                ForegroundColour = colours.BlueLight;
                BackgroundColour = Color4.Transparent;
                ForegroundColourHover = Color4.White;
                BackgroundColourHover = colours.Gray3;
            }

            public override void SetFlowDirection(Direction direction)
            {
                AutoSizeAxes = Axes.Both;
            }

            protected override void UpdateBackgroundColour()
            {
                if (State == MenuItemState.Selected)
                    Background.FadeColour(BackgroundColourHover);
                else
                    base.UpdateBackgroundColour();
            }

            protected override void UpdateForegroundColour()
            {
                if (State == MenuItemState.Selected)
                    Foreground.FadeColour(ForegroundColourHover);
                else
                    base.UpdateForegroundColour();
            }

            protected override void Update()
            {
                base.Update();
            }

            protected override Drawable CreateBackground() => new Container
            {
                RelativeSizeAxes = Axes.Both,
                Masking = true,
                Child = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Height = 2,
                    Masking = true,
                    CornerRadius = 4,
                    Child = new Box { RelativeSizeAxes = Axes.Both }
                }
            };

            protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();

{'fraction_non_alphanumeric': 0.07033727298933411, 'fraction_numerical': 0.006341885269530124, 'mean_word_length': 1.6008245877061469, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5097968', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1597, 'n_words': 346}