mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 02:27:08 +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.
41 lines
843 B
C#
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();
|
|
}
|
|
}
|
|
}
|