move godot events to wrapper

This commit is contained in:
Matt Parker
2025-10-07 21:01:55 +10:00
parent 9d4970aa67
commit a6b80c38f6
11 changed files with 45 additions and 107 deletions

View File

@@ -1,35 +1,16 @@
using SharpIDE.Application.Features.Analysis;
using SharpIDE.Application.Features.Events;
using SharpIDE.Application.Features.SolutionDiscovery;
using SharpIDE.Godot.Features.BottomPanel;
namespace SharpIDE.Godot;
public class GodotGlobalEvents
{
public static GodotGlobalEvents Instance { get; set; } = null!;
public event Func<BottomPanelType, Task> BottomPanelTabExternallySelected = _ => Task.CompletedTask;
public void InvokeBottomPanelTabExternallySelected(BottomPanelType type) => BottomPanelTabExternallySelected.InvokeParallelFireAndForget(type);
public event Func<BottomPanelType?, Task> BottomPanelTabSelected = _ => Task.CompletedTask;
public void InvokeBottomPanelTabSelected(BottomPanelType? type) => BottomPanelTabSelected.InvokeParallelFireAndForget(type);
public event Func<bool, Task> BottomPanelVisibilityChangeRequested = _ => Task.CompletedTask;
public void InvokeBottomPanelVisibilityChangeRequested(bool show) => BottomPanelVisibilityChangeRequested.InvokeParallelFireAndForget(show);
public event Func<SharpIdeFile, SharpIdeFileLinePosition?, Task> FileSelected = (_, _) => Task.CompletedTask;
public void InvokeFileSelected(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition = null) => FileSelected.InvokeParallelFireAndForget(file, fileLinePosition);
public async Task InvokeFileSelectedAndWait(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition) => await FileSelected.InvokeParallelAsync(file, fileLinePosition);
public event Func<SharpIdeFile, SharpIdeFileLinePosition?, Task> FileExternallySelected = (_, _) => Task.CompletedTask;
public void InvokeFileExternallySelected(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition = null) => FileExternallySelected.InvokeParallelFireAndForget(file, fileLinePosition);
public async Task InvokeFileExternallySelectedAndWait(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition = null) => await FileExternallySelected.InvokeParallelAsync(file, fileLinePosition);
}
public enum BottomPanelType
{
Run,
Debug,
Build,
Problems,
IdeDiagnostics
public EventWrapper<BottomPanelType, Task> BottomPanelTabExternallySelected { get; } = new(_ => Task.CompletedTask);
public EventWrapper<BottomPanelType?, Task> BottomPanelTabSelected { get; } = new(_ => Task.CompletedTask);
public EventWrapper<bool, Task> BottomPanelVisibilityChangeRequested { get; } = new(_ => Task.CompletedTask);
public EventWrapper<SharpIdeFile, SharpIdeFileLinePosition?, Task> FileSelected { get; } = new((_, _) => Task.CompletedTask);
public EventWrapper<SharpIdeFile, SharpIdeFileLinePosition?, Task> FileExternallySelected { get; } = new((_, _) => Task.CompletedTask);
}