From c1dbaf46279e7589f1952daa02252c2345512655 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:57:25 +1000 Subject: [PATCH] switch between bottom panels --- .../BottomPanel/BottomPanelManager.cs | 36 +++++++++++++++++++ .../Features/LeftSideBar/LeftSideBar.cs | 23 ++++++++++++ .../Features/LeftSideBar/LeftSideBar.cs.uid | 1 + .../Features/LeftSideBar/LeftSideBar.tscn | 10 ++++-- .../Features/Problems/ProblemsPanel.tscn | 9 +++++ src/SharpIDE.Godot/GodotGlobalEvents.cs | 14 ++++++++ src/SharpIDE.Godot/GodotGlobalEvents.cs.uid | 1 + src/SharpIDE.Godot/IdeRoot.tscn | 11 ++++-- 8 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 src/SharpIDE.Godot/Features/LeftSideBar/LeftSideBar.cs create mode 100644 src/SharpIDE.Godot/Features/LeftSideBar/LeftSideBar.cs.uid create mode 100644 src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn create mode 100644 src/SharpIDE.Godot/GodotGlobalEvents.cs create mode 100644 src/SharpIDE.Godot/GodotGlobalEvents.cs.uid diff --git a/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs b/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs index 84abff4..80748fe 100644 --- a/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs +++ b/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs @@ -4,5 +4,41 @@ namespace SharpIDE.Godot.Features.BottomPanel; public partial class BottomPanelManager : Panel { + private Control _runPanel = null!; + private Control _buildPanel = null!; + private Control _problemsPanel = null!; + + private Dictionary _panelTypeMap = []; + private BottomPanelType? _currentPanelType = BottomPanelType.Run; + public override void _Ready() + { + _runPanel = GetNode("%RunPanel"); + _buildPanel = GetNode("%BuildPanel"); + _problemsPanel = GetNode("%ProblemsPanel"); + _panelTypeMap = new Dictionary + { + { BottomPanelType.Run, _runPanel }, + { BottomPanelType.Build, _buildPanel }, + { BottomPanelType.Problems, _problemsPanel } + }; + + GodotGlobalEvents.LeftSideBarButtonClicked += OnLeftSideBarButtonClicked; + } + + private async Task OnLeftSideBarButtonClicked(BottomPanelType type) + { + await this.InvokeAsync(() => + { + if (type == _currentPanelType) + { + _currentPanelType = null; + // TODO: Ask parent to to collapse slider. + } + foreach (var kvp in _panelTypeMap) + { + kvp.Value.Visible = kvp.Key == type; + } + }); + } } \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/LeftSideBar/LeftSideBar.cs b/src/SharpIDE.Godot/Features/LeftSideBar/LeftSideBar.cs new file mode 100644 index 0000000..298bde1 --- /dev/null +++ b/src/SharpIDE.Godot/Features/LeftSideBar/LeftSideBar.cs @@ -0,0 +1,23 @@ +using Godot; + +namespace SharpIDE.Godot.Features.LeftSideBar; + +public partial class LeftSideBar : Panel +{ + private Button _slnExplorerButton = null!; + private Button _problemsButton = null!; + private Button _runButton = null!; + private Button _buildButton = null!; + + public override void _Ready() + { + _slnExplorerButton = GetNode