diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs
index 745c989b3b..2cb3af61c8 100644
--- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs
+++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs
@@ -14,14 +14,20 @@ using osu.Framework.Extensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Localisation;
using osu.Game.Database;
using osu.Game.Graphics.UserInterfaceV2;
using osuTK;
namespace osu.Game.Screens.Edit.Setup
{
- internal class LabelledFileChooser : LabelledTextBoxWithPopover, ICanAcceptFiles
+ ///
+ /// A labelled drawable displaying file chooser on click, with placeholder text support.
+ /// todo: this should probably not use PopoverTextBox just to display placeholder text, but is the best way for now.
+ ///
+ internal class LabelledFileChooser : LabelledDrawable, IHasCurrentValue, ICanAcceptFiles, IHasPopover
{
private readonly string[] handledExtensions;
@@ -34,13 +40,25 @@ namespace osu.Game.Screens.Edit.Setup
private readonly BindableWithCurrent current = new BindableWithCurrent();
- public override Bindable Current
+ public Bindable Current
{
get => current.Current;
set => current.Current = value;
}
+ public LocalisableString Text
+ {
+ get => Component.PlaceholderText;
+ set => Component.PlaceholderText = value;
+ }
+
+ public CompositeDrawable TabbableContentContainer
+ {
+ set => Component.TabbableContentContainer = value;
+ }
+
public LabelledFileChooser(params string[] handledExtensions)
+ : base(false)
{
this.handledExtensions = handledExtensions;
}
@@ -78,7 +96,16 @@ namespace osu.Game.Screens.Edit.Setup
game.UnregisterImportHandler(this);
}
- public override Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile);
+ protected override LabelledTextBoxWithPopover.PopoverTextBox CreateComponent() => new LabelledTextBoxWithPopover.PopoverTextBox
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ RelativeSizeAxes = Axes.X,
+ CornerRadius = CORNER_RADIUS,
+ OnFocused = this.ShowPopover,
+ };
+
+ public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile);
private class FileChooserPopover : OsuPopover
{
diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
index 36edb5dd83..b4e350b94b 100644
--- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
+++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
@@ -121,7 +121,7 @@ namespace osu.Game.Screens.Edit.Setup
private void backgroundChanged(ValueChangedEvent filePath)
{
- backgroundChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue)
+ backgroundChooser.Text = string.IsNullOrEmpty(filePath.NewValue)
? "Click to select a background image"
: "Click to replace the background image";
@@ -134,7 +134,7 @@ namespace osu.Game.Screens.Edit.Setup
private void audioTrackChanged(ValueChangedEvent filePath)
{
- audioTrackChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue)
+ audioTrackChooser.Text = string.IsNullOrEmpty(filePath.NewValue)
? "Click to select a track"
: "Click to replace the track";