/// <summary>
        /// Initializes a new Text Editor window and registers it to the specified parent element.
        /// You can leave the parent null and use the parent element's register method if you prefer.
        /// </summary>
        public TextEditor(HudParentBase parent = null) : base(parent)
        {
            textBox = new EditorTextBox(body)
            {
                ParentAlignment = ParentAlignments.Bottom | ParentAlignments.InnerV,
                DimAlignment    = DimAlignments.Width
            };

            toolBar = new EditorToolBar(header)
            {
                DimAlignment    = DimAlignments.Width,
                ParentAlignment = ParentAlignments.Bottom,
                Format          = textBox.text.Format,
                BulderMode      = textBox.text.BuilderMode,
            };

            toolBar.FormatChanged    += ChangeFormat;
            toolBar.BuildModeChanged += ChangeBuilderMode;

            // Window styling:
            BodyColor   = new Color(41, 54, 62, 150);
            BorderColor = new Color(58, 68, 77);

            header.Format = new GlyphFormat(GlyphFormat.Blueish.Color, TextAlignment.Center, 1.08f);
            header.Height = 30f;

            HeaderText = "Example Text Editor";
            Size       = new Vector2(500f, 300f);
        }
        public static void AddUnitBrush(this List <ImageBrushPair> list, EditorToolBar toolBar, Image image, EntityId id, Tile tile)
        {
            var brush = new UnitBrush(
                metadata: new UnitMetadata(
                    entityId: id,
                    tile: tile,
                    owner: null
                    ));

            toolBar.PlayerSelected += (s, e) => brush.ChangePlayer(e.Colour);

            list.Add(new ImageBrushPair(brush, image));
        }