// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System; using FlaxEngine; using FlaxEngine.GUI; namespace FlaxEditor.GUI.Tabs { /// /// Single tab control used by . /// /// [HideInEditor] public class Tab : ContainerControl { /// /// Gets or sets the text. /// public string Text; /// /// Gets or sets the icon. /// public SpriteHandle Icon; /// /// Occurs when tab gets selected. /// public event Action Selected; /// /// Occurs when tab gets deselected. /// public event Action Deselected; /// /// Initializes a new instance of the class. /// /// The icon. public Tab(SpriteHandle icon) : this(string.Empty, icon) { } /// /// Initializes a new instance of the class. /// /// The text. public Tab(string text) : this(text, SpriteHandle.Invalid) { } /// /// Initializes a new instance of the class. /// /// The text. /// The icon. public Tab(string text, SpriteHandle icon) { Text = text; Icon = icon; } /// /// Called when tab gets selected. /// public virtual void OnSelected() { Selected?.Invoke(this); } /// /// Called when tab gets deselected. /// public virtual void OnDeselected() { Deselected?.Invoke(this); } /// /// Factory method for tabs header control (UI for the tabs strip to represent this tab). /// /// The tab header control. public virtual Tabs.TabHeader CreateHeader() { return new Tabs.TabHeader((Tabs)Parent, this); } } }