Files
RobustToolbox/Robust.Client/UserInterface/Controls/Popup.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

41 lines
843 B
C#

using System;
using Robust.Shared.Maths;
namespace Robust.Client.UserInterface.Controls
{
public class Popup : Control
{
public Popup()
{
Visible = false;
}
public event Action OnPopupHide;
public void Open(UIBox2? box = null)
{
if (Visible)
{
UserInterfaceManagerInternal.RemoveModal(this);
}
if (box != null)
{
Position = box.Value.TopLeft;
Size = box.Value.Size;
}
Visible = true;
UserInterfaceManagerInternal.PushModal(this);
}
protected internal override void ModalRemoved()
{
base.ModalRemoved();
Visible = false;
OnPopupHide?.Invoke();
}
}
}