open recent sln on click
This commit is contained in:
@@ -8,8 +8,10 @@ public partial class PreviousSlnEntry : MarginContainer
|
||||
private Label _slnPathLabel = null!;
|
||||
private Label _slnNameLabel = null!;
|
||||
private Panel _slnColourPanel = null!;
|
||||
private Button _slnEntryButton = null!;
|
||||
|
||||
public RecentSln RecentSln { get; set; } = null!;
|
||||
public Action<string>? Clicked;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -17,8 +19,10 @@ public partial class PreviousSlnEntry : MarginContainer
|
||||
_slnNameLabel = GetNode<Label>("%SlnNameLabel");
|
||||
_slnPathLabel = GetNode<Label>("%SlnPathLabel");
|
||||
_slnColourPanel = GetNode<Panel>("%Panel");
|
||||
_slnEntryButton = GetNode<Button>("Button");
|
||||
_slnNameLabel.Text = RecentSln.Name;
|
||||
_slnPathLabel.Text = RecentSln.FilePath;
|
||||
_slnColourPanel.Modulate = RandomRecentSlnColours.GetColourForFilePath(RecentSln.FilePath);
|
||||
_slnEntryButton.Pressed += () => Clicked?.Invoke(RecentSln.FilePath);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public partial class SlnPicker : Control
|
||||
{
|
||||
var node = _previousSlnEntryScene.Instantiate<PreviousSlnEntry>();
|
||||
node.RecentSln = previousSln;
|
||||
node.Clicked = path => _tcs.SetResult(path);
|
||||
_previousSlnsVBoxContainer.AddChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user