mirror of
https://github.com/ppy/osu
synced 2025-03-30 07:06:56 +00:00
Move implementation to ctor instead of bdl method
This commit is contained in:
parent
e03d086305
commit
a35502a834
@ -22,17 +22,27 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const float corner_radius = 7;
|
private const float corner_radius = 7;
|
||||||
private const float height = 42;
|
private const float height = 42;
|
||||||
private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
|
private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
|
||||||
|
private readonly Box background;
|
||||||
public FocusedTextBox TextBox;
|
private readonly Box searchBoxBackground;
|
||||||
|
private readonly SearchTextBox textBox;
|
||||||
|
|
||||||
public Bindable<string> Current
|
public Bindable<string> Current
|
||||||
{
|
{
|
||||||
get => TextBox.Current;
|
get => textBox.Current;
|
||||||
set => TextBox.Current = value;
|
set => textBox.Current = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
public bool HoldFocus
|
||||||
private void load(OverlayColourProvider colourProvider)
|
{
|
||||||
|
get => textBox.HoldFocus;
|
||||||
|
set => textBox.HoldFocus = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TakeFocus() => textBox.TakeFocus();
|
||||||
|
|
||||||
|
public void KillFocus() => textBox.KillFocus();
|
||||||
|
|
||||||
|
public ShearedSearchTextBox()
|
||||||
{
|
{
|
||||||
Height = height;
|
Height = height;
|
||||||
Shear = shear;
|
Shear = shear;
|
||||||
@ -43,9 +53,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Background3,
|
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
new GridContainer
|
new GridContainer
|
||||||
@ -63,12 +72,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
searchBoxBackground = new Box
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Background4,
|
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
TextBox = new SearchTextBox
|
textBox = new InnerSearchTextBox
|
||||||
{
|
{
|
||||||
Shear = -shear,
|
Shear = -shear,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -108,11 +116,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleNonPositionalInput => TextBox.HandleNonPositionalInput;
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
background.Colour = colourProvider.Background3;
|
||||||
|
searchBoxBackground.Colour = colourProvider.Background4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HandleNonPositionalInput => textBox.HandleNonPositionalInput;
|
||||||
|
|
||||||
private class InnerSearchTextBox : SearchTextBox
|
private class InnerSearchTextBox : SearchTextBox
|
||||||
{
|
{
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user