handle button toggling
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[gd_resource type="ButtonGroup" format=3 uid="uid://c2nmo2x3va0gi"]
|
||||
|
||||
[resource]
|
||||
allow_unpress = true
|
||||
@@ -5,6 +5,7 @@ namespace SharpIDE.Godot.Features.LeftSideBar;
|
||||
public partial class LeftSideBar : Panel
|
||||
{
|
||||
private Button _slnExplorerButton = null!;
|
||||
// These are in a ButtonGroup, which handles mutual exclusivity of being toggled on
|
||||
private Button _problemsButton = null!;
|
||||
private Button _runButton = null!;
|
||||
private Button _buildButton = null!;
|
||||
@@ -16,8 +17,8 @@ public partial class LeftSideBar : Panel
|
||||
_runButton = GetNode<Button>("%RunButton");
|
||||
_buildButton = GetNode<Button>("%BuildButton");
|
||||
|
||||
_problemsButton.Pressed += () => GodotGlobalEvents.InvokeLeftSideBarButtonClicked(BottomPanelType.Problems);
|
||||
_runButton.Pressed += () => GodotGlobalEvents.InvokeLeftSideBarButtonClicked(BottomPanelType.Run);
|
||||
_buildButton.Pressed += () => GodotGlobalEvents.InvokeLeftSideBarButtonClicked(BottomPanelType.Build);
|
||||
_problemsButton.Toggled += toggledOn => GodotGlobalEvents.InvokeBottomPanelTabSelected(toggledOn ? BottomPanelType.Problems : null);
|
||||
_runButton.Toggled += toggledOn => GodotGlobalEvents.InvokeBottomPanelTabSelected(toggledOn ? BottomPanelType.Run : null);
|
||||
_buildButton.Toggled += toggledOn => GodotGlobalEvents.InvokeBottomPanelTabSelected(toggledOn ? BottomPanelType.Build : null);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://biyhfwx36ium8"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://biyhfwx36ium8"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bkty6563cthj8" path="res://Features/Run/Resources/Run.svg" id="1_6wc7d"]
|
||||
[ext_resource type="Script" uid="uid://bddno1bbvvp5q" path="res://Features/LeftSideBar/LeftSideBar.cs" id="1_rgaf0"]
|
||||
[ext_resource type="ButtonGroup" uid="uid://c2nmo2x3va0gi" path="res://Features/LeftSideBar/LeftBottomSidebarButtonGroup.tres" id="2_1aad6"]
|
||||
|
||||
[node name="LeftSideBar" type="Panel"]
|
||||
custom_minimum_size = Vector2(80, 0)
|
||||
@@ -49,6 +50,7 @@ layout_mode = 2
|
||||
focus_mode = 0
|
||||
theme_override_font_sizes/font_size = 13
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("2_1aad6")
|
||||
text = "Problems"
|
||||
icon = ExtResource("1_6wc7d")
|
||||
icon_alignment = 1
|
||||
@@ -61,6 +63,7 @@ layout_mode = 2
|
||||
focus_mode = 0
|
||||
theme_override_font_sizes/font_size = 13
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("2_1aad6")
|
||||
text = "Run"
|
||||
icon = ExtResource("1_6wc7d")
|
||||
icon_alignment = 1
|
||||
@@ -73,6 +76,7 @@ layout_mode = 2
|
||||
focus_mode = 0
|
||||
theme_override_font_sizes/font_size = 13
|
||||
toggle_mode = true
|
||||
button_group = ExtResource("2_1aad6")
|
||||
text = "Build"
|
||||
icon = ExtResource("1_6wc7d")
|
||||
icon_alignment = 1
|
||||
|
||||
Reference in New Issue
Block a user