// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
namespace FlaxEngine.GUI
{
///
/// Button control
///
[ActorToolbox("GUI")]
public class Button : Label
{
///
/// The default height for the buttons.
///
public const float DefaultHeight = 24.0f;
///
/// True if button is being pressed (by mouse or touch).
///
protected bool _isPressed;
///
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// [Deprecated on 18.09.2024, expires on 18.09.2026]
///
[Serialize, Obsolete("Use Material property instead."), NoUndo]
public MaterialBase TextMaterial
{
get => Material;
set => Material = value;
}
///
/// Gets or sets the background color when button is highlighted.
///
[EditorDisplay("Background Style"), EditorOrder(2001)]
public Color BackgroundColorHighlighted { get; set; }
///
/// Gets or sets the background color when button is selected.
///
[EditorDisplay("Background Style"), EditorOrder(2002)]
public Color BackgroundColorSelected { get; set; }
///
/// Gets or sets whether the button has a border.
///
[EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups]
public bool HasBorder { get; set; } = true;
///
/// Gets or sets the border thickness.
///
[EditorDisplay("Border Style"), EditorOrder(2011), Limit(0)]
public float BorderThickness { get; set; } = 1.0f;
///
/// Gets or sets the color of the border.
///
[EditorDisplay("Border Style"), EditorOrder(2012)]
public Color BorderColor { get; set; }
///
/// Gets or sets the border color when button is highlighted.
///
[EditorDisplay("Border Style"), EditorOrder(2013)]
public Color BorderColorHighlighted { get; set; }
///
/// Gets or sets the border color when button is selected.
///
[EditorDisplay("Border Style"), EditorOrder(2013)]
public Color BorderColorSelected { get; set; }
///
/// Event fired when user clicks on the button.
///
public event Action Clicked;
///
/// Event fired when user clicks on the button.
///
public event Action