// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using FlaxEditor.GUI;
using FlaxEngine;
namespace FlaxEditor.Surface.GUI
{
///
/// A context navigation bar button. Allows to change the current context and view the context path.
///
///
[HideInEditor]
public class VisjectContextNavigationButton : NavigationButton
{
///
/// Gets the parent surface.
///
public VisjectSurface Surface { get; }
///
/// Gets the target context.
///
public ISurfaceContext Context { get; }
///
/// Initializes a new instance of the class.
///
/// The parent surface.
/// The target context.
/// The x position.
/// The y position.
/// The height.
public VisjectContextNavigationButton(VisjectSurface surface, ISurfaceContext context, float x, float y, float height)
: base(x, y, height)
{
Surface = surface;
Context = context;
Text = context.SurfaceName + "/";
}
///
protected override void OnClick()
{
// Navigate
Surface.ChangeContext(Context);
base.OnClick();
}
}
}