diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs
index 69c27702f8..e68e581942 100644
--- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs
+++ b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs
@@ -8,22 +8,27 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
+using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Cursor;
+using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Database;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
+using osuTK;
namespace osu.Game.Screens.Edit.Setup
{
///
/// A labelled textbox which reveals an inline file chooser when clicked.
///
- internal class FileChooserLabelledTextBox : LabelledTextBox, ICanAcceptFiles
+ internal class FileChooserLabelledTextBox : LabelledTextBox, ICanAcceptFiles, IHasPopover
{
private readonly string[] handledExtensions;
+
public IEnumerable HandledExtensions => handledExtensions;
///
@@ -51,23 +56,9 @@ namespace osu.Game.Screens.Edit.Setup
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
CornerRadius = CORNER_RADIUS,
- OnFocused = DisplayFileChooser
+ OnFocused = this.ShowPopover
};
- public void DisplayFileChooser()
- {
- OsuFileSelector fileSelector;
-
- Target.Child = fileSelector = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions)
- {
- RelativeSizeAxes = Axes.X,
- Height = 400,
- CurrentFile = { BindTarget = currentFile }
- };
-
- sectionsContainer.ScrollTo(fileSelector);
- }
-
protected override void LoadComplete()
{
base.LoadComplete();
@@ -111,5 +102,23 @@ namespace osu.Game.Screens.Edit.Setup
GetContainingInputManager().TriggerFocusContention(this);
}
}
+
+ public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile);
+
+ private class FileChooserPopover : OsuPopover
+ {
+ public FileChooserPopover(string[] handledExtensions, Bindable currentFile)
+ {
+ Child = new Container
+ {
+ Size = new Vector2(600, 400),
+ Child = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions)
+ {
+ RelativeSizeAxes = Axes.Both,
+ CurrentFile = { BindTarget = currentFile }
+ },
+ };
+ }
+ }
}
}