mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #18063 from GSculerlor/split-searchbox
Split `SearchTextBox` implementation for reusability
This commit is contained in:
commit
04fb0f5e63
26
osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs
Normal file
26
osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public class BasicSearchTextBox : SearchTextBox
|
||||||
|
{
|
||||||
|
public BasicSearchTextBox()
|
||||||
|
{
|
||||||
|
Add(new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Search,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 10 },
|
||||||
|
Size = new Vector2(20),
|
||||||
|
});
|
||||||
|
|
||||||
|
TextFlow.Padding = new MarginPadding { Right = 35 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -18,16 +15,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
public SearchTextBox()
|
public SearchTextBox()
|
||||||
{
|
{
|
||||||
Height = 35;
|
Height = 35;
|
||||||
Add(new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Search,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Margin = new MarginPadding { Right = 10 },
|
|
||||||
Size = new Vector2(20),
|
|
||||||
});
|
|
||||||
|
|
||||||
TextFlow.Padding = new MarginPadding { Right = 35 };
|
|
||||||
PlaceholderText = HomeStrings.SearchPlaceholder;
|
PlaceholderText = HomeStrings.SearchPlaceholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="SearchTextBox"/> which does not handle left/right arrow keys for seeking.
|
/// A <see cref="SearchTextBox"/> which does not handle left/right arrow keys for seeking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SeekLimitedSearchTextBox : SearchTextBox
|
public class SeekLimitedSearchTextBox : BasicSearchTextBox
|
||||||
{
|
{
|
||||||
public override bool HandleLeftRightArrows => false;
|
public override bool HandleLeftRightArrows => false;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
public void TakeFocus() => textBox.TakeFocus();
|
public void TakeFocus() => textBox.TakeFocus();
|
||||||
|
|
||||||
private class BeatmapSearchTextBox : SearchTextBox
|
private class BeatmapSearchTextBox : BasicSearchTextBox
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Any time the text box receives key events (even while masked).
|
/// Any time the text box receives key events (even while masked).
|
||||||
|
@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
base.PopOut();
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HeaderSearchTextBox : SearchTextBox
|
private class HeaderSearchTextBox : BasicSearchTextBox
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
Collection = collectionDropdown.Current.Value?.Collection
|
Collection = collectionDropdown.Current.Value?.Collection
|
||||||
};
|
};
|
||||||
|
|
||||||
public class FilterTextBox : SearchTextBox
|
public class FilterTextBox : BasicSearchTextBox
|
||||||
{
|
{
|
||||||
protected override bool AllowCommit => true;
|
protected override bool AllowCommit => true;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = Header.HEIGHT,
|
Height = Header.HEIGHT,
|
||||||
Child = searchTextBox = new SearchTextBox
|
Child = searchTextBox = new BasicSearchTextBox
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user