diff --git a/Source/Editor/GUI/ColumnDefinition.cs b/Source/Editor/GUI/ColumnDefinition.cs index 241e6bec3..5c462c903 100644 --- a/Source/Editor/GUI/ColumnDefinition.cs +++ b/Source/Editor/GUI/ColumnDefinition.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. using FlaxEngine; +using FlaxEngine.GUI; namespace FlaxEditor.GUI { @@ -43,10 +44,20 @@ namespace FlaxEditor.GUI public Color TitleColor = Color.White; /// - /// The column title background background. + /// The column title background color. /// public Color TitleBackgroundColor = Color.Brown; + /// + /// The column title horizontal text alignment + /// + public TextAlignment TitleAlignment = TextAlignment.Near; + + /// + /// The column title margin. + /// + public Margin TitleMargin = new Margin(4, 4, 0, 0); + /// /// The minimum size (in pixels) of the column. /// diff --git a/Source/Editor/GUI/Table.cs b/Source/Editor/GUI/Table.cs index 88c1d9e50..eb7aa3767 100644 --- a/Source/Editor/GUI/Table.cs +++ b/Source/Editor/GUI/Table.cs @@ -130,12 +130,14 @@ namespace FlaxEditor.GUI var style = Style.Current; var font = column.TitleFont ?? style.FontMedium; - Render2D.DrawText(font, column.Title, rect, column.TitleColor, TextAlignment.Center, TextAlignment.Center); + var textRect = rect; + column.TitleMargin.ShrinkRectangle(ref textRect); + Render2D.DrawText(font, column.Title, textRect, column.TitleColor, column.TitleAlignment, TextAlignment.Center); if (columnIndex < _columns.Length - 1) { - var splitRect = new Rectangle(rect.Right - 1, 2, 2, rect.Height - 4); - Render2D.FillRectangle(splitRect, _movingSplit == columnIndex || splitRect.Contains(_mousePos) ? style.BorderNormal : column.TitleBackgroundColor * 0.9f); + var splitRect = new Rectangle(rect.Right - 2, 2, 4, rect.Height - 4); + Render2D.FillRectangle(splitRect, _movingSplit == columnIndex || splitRect.Contains(_mousePos) ? style.BorderNormal : style.Background * 0.9f); } } @@ -151,7 +153,7 @@ namespace FlaxEditor.GUI { rect.Width = GetColumnWidth(i); - var splitRect = new Rectangle(rect.Right - 1, 2, 2, rect.Height - 4); + var splitRect = new Rectangle(rect.Right - 2, 2, 4, rect.Height - 4); if (splitRect.Contains(location)) { // Start moving splitter @@ -193,6 +195,31 @@ namespace FlaxEditor.GUI PerformLayout(); } + else + { + if (_columns != null && _splits != null) + { + Rectangle rect = new Rectangle(0, 0, 0, _headerHeight); + for (int i = 0; i < _columns.Length - 1; i++) + { + rect.Width = GetColumnWidth(i); + + var splitRect = new Rectangle(rect.Right - 2, 2, 4, rect.Height - 4); + if (splitRect.Contains(location)) + { + // Start moving splitter + Cursor = CursorType.SizeWE; + break; + } + else + { + Cursor = CursorType.Default; + } + + rect.X += rect.Width; + } + } + } base.OnMouseMove(location); }