Add GroupElement.AddSettingsButton for editor ui

This commit is contained in:
Wojtek Figat
2023-04-29 11:10:48 +02:00
parent 8de2e6a424
commit 4d1ac04e5c
3 changed files with 28 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Elements
@@ -25,5 +26,27 @@ namespace FlaxEditor.CustomEditors.Elements
/// <inheritdoc />
public override ContainerControl ContainerControl => Panel;
/// <summary>
/// Adds utility settings button to the group header.
/// </summary>
/// <returns>The created control.</returns>
public Image AddSettingsButton()
{
var style = Style.Current;
var settingsButtonSize = Panel.HeaderHeight;
return new Image
{
TooltipText = "Settings",
AutoFocus = true,
AnchorPreset = AnchorPresets.TopRight,
Parent = Panel,
Bounds = new Rectangle(Panel.Width - settingsButtonSize, 0, settingsButtonSize, settingsButtonSize),
IsScrollable = false,
Color = style.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(style.Settings),
};
}
}
}