Files
FlaxEngine/Source/Editor/GUI/Tree/TreeNodeWithAddons.cs
Wojciech Figat a7e428a21c Merge branch 'master' into 1.5
# Conflicts:
#	Content/Shaders/GI/DDGI.flax
#	Content/Shaders/GI/GlobalSurfaceAtlas.flax
#	Content/Shaders/TAA.flax
#	Content/Shaders/VolumetricFog.flax
#	Source/Editor/CustomEditors/Editors/ActorTagEditor.cs
#	Source/Engine/Core/Config/GraphicsSettings.cpp
#	Source/Engine/Engine/PostProcessEffect.cs
#	Source/Engine/Graphics/GPUResourcesCollection.cpp
#	Source/Engine/Graphics/GPUResourcesCollection.h
#	Source/Engine/Graphics/PostProcessBase.h
#	Source/FlaxEngine.Gen.cs
2023-01-10 15:37:55 +01:00

122 lines
3.6 KiB
C#

// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using FlaxEngine;
using FlaxEngine.GUI;
using System.Collections.Generic;
namespace FlaxEditor.GUI.Tree
{
/// <summary>
/// Tree node control with in-built checkbox.
/// </summary>
[HideInEditor]
public class TreeNodeWithAddons : TreeNode
{
/// <summary>
/// The additional controls (eg. added to the header).
/// </summary>
public List<Control> Addons = new List<Control>();
/// <inheritdoc />
public override void Draw()
{
base.Draw();
foreach (var child in Addons)
{
Render2D.PushTransform(ref child._cachedTransform);
child.Draw();
Render2D.PopTransform();
}
}
/// <inheritdoc />
public override bool OnMouseDown(Float2 location, MouseButton button)
{
foreach (var child in Addons)
{
if (child.Visible && child.Enabled)
{
if (IntersectsChildContent(child, location, out var childLocation))
{
if (child.OnMouseDown(childLocation, button))
return true;
}
}
}
return base.OnMouseDown(location, button);
}
/// <inheritdoc />
public override bool OnMouseUp(Float2 location, MouseButton button)
{
foreach (var child in Addons)
{
if (child.Visible && child.Enabled)
{
if (IntersectsChildContent(child, location, out var childLocation))
{
if (child.OnMouseUp(childLocation, button))
return true;
}
}
}
return base.OnMouseUp(location, button);
}
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
foreach (var child in Addons)
{
if (child.Visible && child.Enabled)
{
if (IntersectsChildContent(child, location, out var childLocation))
{
if (child.OnMouseDoubleClick(childLocation, button))
return true;
}
}
}
return base.OnMouseDoubleClick(location, button);
}
/// <inheritdoc />
public override void OnMouseMove(Float2 location)
{
base.OnMouseMove(location);
if (IsCollapsed)
{
foreach (var child in Addons)
{
if (child.Visible && child.Enabled)
{
if (IntersectsChildContent(child, location, out var childLocation))
{
if (child.IsMouseOver)
{
// Move
child.OnMouseMove(childLocation);
}
else
{
// Enter
child.OnMouseEnter(childLocation);
}
}
else if (child.IsMouseOver)
{
// Leave
child.OnMouseLeave();
}
}
}
}
}
}
}