GUITabGroup

The GUITabGroup is a utility class to draw animated tab groups.

namespace Sirenix.Utilities.Editor
{
public class GUITabGroup
}

Requirements

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

See Also

Fields

Return Type Definition Description
float AnimationSpeed The animation speed (1 / s)

Properties

Return Type Definition Description
GUITabPage CurrentPage Gets the current page.
bool FixedHeight If true, the tab group will have the height equal to the biggest page. Otherwise the tab group will animate in height as well when changing page.
Rect InnerRect The inner rect of the current tab page.
Rect OuterRect Gets the outer rect of the entire tab group.
float T Gets the t.

Methods

Return Type Definition Description
void BeginGroup(bool, GUIStyle) Begins the group.
void EndGroup() Ends the group.
void GoToNextPage() Goes to next page.
void GoToPage(GUITabPage) Goes to page.
void GoToPreviousPage() Goes to previous page.
GUITabPage RegisterTab(string) Registers the tab.
void SetCurrentPage(GUITabPage) Sets the current page.

Example

var tabGroup = SirenixEditorGUI.CreateAnimatedTabGroup(someKey);
// Register your tabs before starting BeginGroup.
var tab1 = tabGroup.RegisterTab("tab 1");
var tab2 = tabGroup.RegisterTab("tab 2");

tabGroup.BeginGroup(drawToolbar: true);
{
    if (tab1.BeginPage())
    {
        // Draw GUI for the first tab page;
    }
    tab1.EndPage();

    if (tab2.BeginPage())
    {
        // Draw GUI for the second tab page;
    }
    tab2.EndPage();
}
tabGroup.EndGroup();

// Control the animation speed.
tabGroup.AnimationSpeed = 0.2f;

// If true, the tab group will have the height equal to the biggest page. Otherwise the tab group will animate in height as well when changing page.
tabGroup.FixedHeight = true;

// You can change page by calling:
tabGroup.GoToNextPage();
tabGroup.GoToPreviousPage();