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

using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;

namespace osu.Framework.Graphics.UserInterface
{
    public class ContextMenuItem : MenuItem
    {
        private readonly Container textContainer;

        /// <summary>
        /// Creates an autosize container which will be positioned at the centre-right of the <see cref="ContextMenuItem"/>.
        /// </summary>
        protected readonly FillFlowContainer ContentContainer;

        /// <summary>
        /// Draw width of <see cref="textContainer"/>
        /// </summary>
        public float TextDrawWidth => textContainer.DrawWidth;

        /// <summary>
        /// Draw width of <see cref="ContentContainer"/>
        /// </summary>
        public float ContentDrawWidth => ContentContainer.DrawWidth;

        /// <summary>
        /// Creates a new container with text which will be displayed at the centre-left of this item.
        /// </summary>
        /// <param name="title">The text displayed on this container</param>
        protected virtual Container CreateTextContainer(string title) => new Container
        {
            AutoSizeAxes = Axes.Both,
            Anchor = Anchor.CentreLeft,
            Origin = Anchor.CentreLeft,
            Children = new Drawable[]
            {
                new SpriteText
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    TextSize = 17,
                    Text = title,
                }
            }
        };

        public ContextMenuItem(string title)
        {
            Add(textContainer = CreateTextContainer(title));
            Add(ContentContainer = new FillFlowContainer
            {
                Direction = FillDirection.Horizontal,
                AutoSizeAxes = Axes.Both,
                Anchor = Anchor.CentreRight,
                Origin = Anchor.CentreRight,
            });
        }
    }
}
<commit_msg>Using a neater way to handling content<commit_after>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;

namespace osu.Framework.Graphics.UserInterface
{
    public class ContextMenuItem : MenuItem
    {
        private readonly Container textContainer;

        /// <summary>
        /// Creates an autosize container which will be positioned at the centre-right of the <see cref="ContextMenuItem"/>.
        /// </summary>
        private readonly FillFlowContainer сontentContainer;

        /// <summary>
        /// Draw width of <see cref="textContainer"/>
        /// </summary>
        public float TextDrawWidth => textContainer.DrawWidth;

        /// <summary>
        /// Draw width of <see cref="сontentContainer"/>
        /// </summary>
        public float ContentDrawWidth => сontentContainer.DrawWidth;

        /// <summary>
        /// Creates a new container with text which will be displayed at the centre-left of this item.
        /// </summary>
        /// <param name="title">The text displayed on this container</param>
        protected virtual Container CreateTextContainer(string title) => new Container
        {
            AutoSizeAxes = Axes.Both,
            Anchor = Anchor.CentreLeft,
            Origin = Anchor.CentreLeft,
            Children = new Drawable[]
            {
                new SpriteText
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    TextSize = 17,
                    Text = title,
                }
            }
        };

        protected override Container<Drawable> Content => сontentContainer;

        public ContextMenuItem(string title)
        {
            base.Content.Add(new Drawable[]
            {
                textContainer = CreateTextContainer(title),
                сontentContainer = new FillFlowContainer
                {
                    Direction = FillDirection.Horizontal,
                    AutoSizeAxes = Axes.Both,
                    Anchor = Anchor.CentreRight,
                    Origin = Anchor.CentreRight,
                }
            });
        }
    }
}

{'fraction_non_alphanumeric': 0.09025663331883428, 'fraction_numerical': 0.004349717268377556, 'mean_word_length': 1.5592654424040067, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 41, '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': '6268168', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1068, 'n_words': 289}