Files
RobustToolbox/Robust.Client/UserInterface/Controls/Button.cs
T
ShadowCommanderandGitHub 2f819cf781 Refactor Controls to default to MouseFilterMode.Ignore (#1011)
* Refactor Controls to default to MouseFilterMode.Ignore

* Clean up MouseFilterMode.Ignore from Controls

* Fix BoxContainer eating UI clicks

* Fix ScrollContainer using the wrong variable

* Refactor ContainerButtons to use a StyleClass for formatting instead of typeof

* Refactor BaseButton to work when child has MouseFilter.Pass
2020-03-15 07:29:51 +01:00

44 lines
1.3 KiB
C#

using Robust.Shared.ViewVariables;
using static Robust.Client.UserInterface.Controls.Label;
namespace Robust.Client.UserInterface.Controls
{
/// <summary>
/// Most common button type that draws text in a fancy box.
/// </summary>
public class Button : ContainerButton
{
public Label Label { get; }
public Button() : base()
{
AddStyleClass(StyleClassButton);
Label = new Label
{
StyleClasses = { StyleClassButton }
};
AddChild(Label);
}
/// <summary>
/// How to align the text inside the button.
/// </summary>
[ViewVariables]
public AlignMode TextAlign { get => Label.Align; set => Label.Align = value; }
/// <summary>
/// If true, the button will allow shrinking and clip text
/// to prevent the text from going outside the bounds of the button.
/// If false, the minimum size will always fit the contained text.
/// </summary>
[ViewVariables]
public bool ClipText { get => Label.ClipText; set => Label.ClipText = value; }
/// <summary>
/// The text displayed by the button.
/// </summary>
[ViewVariables]
public string Text { get => Label.Text; set => Label.Text = value; }
}
}