mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 09:37:03 +02:00
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.
38 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|