Files
PJB3005 fee79d8aa5 Make popups/modals in secondary windows work
We were relying on a global PopupRoot & ModalRoot, which only existed in the main window. This means things like OptionButton would pop out on the *main* window when put on secondary windows.

These two roots are now on the UIRoot instead. WindowRoot needs to have a function called to create these if you're using it manually, OSWindow supports it automatically.
2025-08-30 00:58:52 +02:00

38 lines
1.0 KiB
C#

using System;
using Robust.Client.Graphics;
using Robust.Shared.Maths;
namespace Robust.Client.UserInterface.Controls
{
public abstract class UIRoot : Control
{
public const string StylePropBackground = "background";
public override UIRoot? Root
{
get => this;
internal set => throw new InvalidOperationException();
}
public new virtual IClydeWindow? Window => null;
public Color? BackgroundColor { get; set; }
public virtual LayoutContainer PopupRoot => throw new NotSupportedException();
public virtual PopupContainer ModalRoot => throw new NotSupportedException();
private Color _styleBgColor;
internal Color ActualBgColor => BackgroundColor ?? _styleBgColor;
internal Control? StoredKeyboardFocus;
protected override void StylePropertiesChanged()
{
base.StylePropertiesChanged();
_styleBgColor = TryGetStyleProperty(StylePropBackground, out Color color) ? color : default;
}
}
}