// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.GUI
{
///
/// Status strip GUI control.
///
///
public class StatusBar : ContainerControl
{
///
/// The default height.
///
public const int DefaultHeight = 22;
///
/// Gets or sets the color of the status strip.
///
public Color StatusColor
{
get => BackgroundColor;
set => BackgroundColor = value;
}
///
/// Gets or sets the status text.
///
public string Text { get; set; }
///
/// Gets or sets the status text color
///
public Color TextColor { get; set; } = Style.Current.Foreground;
///
/// Initializes a new instance of the class.
///
public StatusBar()
{
AutoFocus = false;
AnchorPreset = AnchorPresets.HorizontalStretchBottom;
}
///
public override void Draw()
{
base.Draw();
var style = Style.Current;
// Draw size grip
if (Root is WindowRootControl window && !window.IsMaximized)
Render2D.DrawSprite(style.StatusBarSizeGrip, new Rectangle(Width - 12, 10, 12, 12), style.Foreground);
// Draw status text
Render2D.DrawText(style.FontSmall, Text, new Rectangle(4, 0, Width - 20, Height), TextColor, TextAlignment.Near, TextAlignment.Center);
}
}
}