// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.Surface
{
///
/// Base class for element controls. Implements .
///
///
///
[HideInEditor]
public abstract class SurfaceNodeElementControl : Control, ISurfaceNodeElement
{
///
public SurfaceNode ParentNode { get; }
///
public NodeElementArchetype Archetype { get; }
///
/// Gets the surface.
///
public VisjectSurface Surface => ParentNode.Surface;
///
/// Initializes a new instance of the class.
///
/// The parent node.
/// The element archetype.
/// The location.
/// The size.
/// if set to true can focus this control.
protected SurfaceNodeElementControl(SurfaceNode parentNode, NodeElementArchetype archetype, Float2 location, Float2 size, bool autoFocus)
: base(location, size)
{
AutoFocus = autoFocus;
TooltipText = archetype.Tooltip;
ParentNode = parentNode;
Archetype = archetype;
}
///
/// Called when surface can edit state gets changed. Can be used to enable/disable UI elements that are surface data editing.
///
/// True if can edit surface data, otherwise false.
public virtual void OnSurfaceCanEditChanged(bool canEdit)
{
}
}
}