Files
RobustToolbox/Robust.Client/UserInterface/Controls/Panel.cs
T
Pieter-Jan BriersandGitHub cb5f2ffae1 Refactor UI system. (#843)
* 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.
2019-08-14 22:03:51 +02:00

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;
}
}
}