// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Elements
{
///
/// The layout group element.
///
///
public class GroupElement : LayoutElementsContainer
{
///
/// The drop panel.
///
public readonly DropPanel Panel = new DropPanel
{
ArrowImageClosed = new SpriteBrush(Style.Current.ArrowRight),
ArrowImageOpened = new SpriteBrush(Style.Current.ArrowDown),
EnableDropDownIcon = true,
ItemsMargin = new Margin(7, 7, 3, 3),
HeaderHeight = 18.0f,
EnableContainmentLines = true,
};
///
public override ContainerControl ContainerControl => Panel;
///
/// Adds utility settings button to the group header.
///
/// The created control.
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),
};
}
}
}