Merge remote-tracking branch 'origin/1.1' into linux-editor

# Conflicts:
#	Source/Engine/Core/Math/BoundingSphere.cs
#	Source/Engine/Debug/DebugDraw.cpp
#	Source/Engine/Platform/Win32/Win32Platform.cpp
#	Source/Engine/Platform/Win32/Win32Platform.h
This commit is contained in:
Wojtek Figat
2021-02-23 22:32:17 +01:00
129 changed files with 6085 additions and 1891 deletions

View File

@@ -194,11 +194,22 @@ namespace FlaxEditor.GUI.Docking
bool isMouseOver = IsMouseOver && headerRect.Contains(MousePosition);
Render2D.FillRectangle(headerRect, containsFocus ? style.BackgroundSelected : isMouseOver ? style.BackgroundHighlighted : style.LightBackground);
float iconWidth = tab.Icon.IsValid ? DockPanel.DefaultButtonsSize + DockPanel.DefaultLeftTextMargin : 0;
if (tab.Icon.IsValid)
{
Render2D.DrawSprite(
tab.Icon,
new Rectangle(DockPanel.DefaultLeftTextMargin, (DockPanel.DefaultHeaderHeight - DockPanel.DefaultButtonsSize) / 2, DockPanel.DefaultButtonsSize, DockPanel.DefaultButtonsSize),
style.Foreground);
}
// Draw text
Render2D.DrawText(
style.FontMedium,
tab.Title,
new Rectangle(DockPanel.DefaultLeftTextMargin, 0, Width - DockPanel.DefaultLeftTextMargin - DockPanel.DefaultButtonsSize - 2 * DockPanel.DefaultButtonsMargin, DockPanel.DefaultHeaderHeight),
new Rectangle(DockPanel.DefaultLeftTextMargin + iconWidth, 0, Width - DockPanel.DefaultLeftTextMargin - DockPanel.DefaultButtonsSize - 2 * DockPanel.DefaultButtonsMargin, DockPanel.DefaultHeaderHeight),
style.Foreground,
TextAlignment.Near,
TextAlignment.Center);
@@ -223,7 +234,8 @@ namespace FlaxEditor.GUI.Docking
var tab = _panel.GetTab(i);
Color tabColor = Color.Black;
var titleSize = tab.TitleSize;
float width = titleSize.X + DockPanel.DefaultButtonsSize + 2 * DockPanel.DefaultButtonsMargin + DockPanel.DefaultLeftTextMargin + DockPanel.DefaultRightTextMargin;
float iconWidth = tab.Icon.IsValid ? DockPanel.DefaultButtonsSize + DockPanel.DefaultLeftTextMargin : 0;
float width = titleSize.X + DockPanel.DefaultButtonsSize + 2 * DockPanel.DefaultButtonsMargin + DockPanel.DefaultLeftTextMargin + DockPanel.DefaultRightTextMargin + iconWidth;
var tabRect = new Rectangle(x, 0, width, DockPanel.DefaultHeaderHeight);
bool isMouseOver = IsMouseOver && tabRect.Contains(MousePosition);
bool isSelected = _panel.SelectedTab == tab;
@@ -241,11 +253,20 @@ namespace FlaxEditor.GUI.Docking
Render2D.FillRectangle(tabRect, tabColor);
}
if (tab.Icon.IsValid)
{
Render2D.DrawSprite(
tab.Icon,
new Rectangle(x + DockPanel.DefaultLeftTextMargin, (DockPanel.DefaultHeaderHeight - DockPanel.DefaultButtonsSize) / 2, DockPanel.DefaultButtonsSize, DockPanel.DefaultButtonsSize),
style.Foreground);
}
// Draw text
Render2D.DrawText(
style.FontMedium,
tab.Title,
new Rectangle(x + DockPanel.DefaultLeftTextMargin, 0, 10000, DockPanel.DefaultHeaderHeight),
new Rectangle(x + DockPanel.DefaultLeftTextMargin + iconWidth, 0, 10000, DockPanel.DefaultHeaderHeight),
style.Foreground,
TextAlignment.Near,
TextAlignment.Center);

View File

@@ -88,6 +88,11 @@ namespace FlaxEditor.GUI.Docking
}
}
/// <summary>
/// Gets or sets the window icon
/// </summary>
public SpriteHandle Icon { get; set; }
/// <summary>
/// Gets the size of the title.
/// </summary>