mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 10:37:05 +02:00
* Refactor UI system. Deferred updating is used for styling & layout. This fixes the awful time complexity of containers. Removed SetDefaults and Initialize. They were a bad idea alright. * Fix build on .NET Framework.
50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using Robust.Client.Graphics.Drawing;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.UserInterface.Controls
|
|
{
|
|
public class Panel : Control
|
|
{
|
|
public const string StylePropertyPanel = "panel";
|
|
|
|
private StyleBox _panelOverride;
|
|
|
|
public StyleBox PanelOverride
|
|
{
|
|
get => _panelOverride;
|
|
set => _panelOverride = value;
|
|
}
|
|
|
|
private StyleBox ActualPanel
|
|
{
|
|
get
|
|
{
|
|
if (_panelOverride != null)
|
|
{
|
|
return _panelOverride;
|
|
}
|
|
|
|
if (TryGetStyleProperty(StylePropertyPanel, out StyleBox panel))
|
|
{
|
|
return panel;
|
|
}
|
|
|
|
return UserInterfaceManager.ThemeDefaults.PanelPanel;
|
|
}
|
|
}
|
|
|
|
protected internal override void Draw(DrawingHandleScreen handle)
|
|
{
|
|
base.Draw(handle);
|
|
|
|
var panel = ActualPanel;
|
|
panel.Draw(handle, PixelSizeBox);
|
|
}
|
|
|
|
protected override Vector2 CalculateMinimumSize()
|
|
{
|
|
return ActualPanel.MinimumSize/UIScale;
|
|
}
|
|
}
|
|
}
|