1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 11:27:24 +08:00

Rename all DropDown -> Dropdown.

This commit is contained in:
Huo Yaoyuan 2017-03-22 22:32:32 +08:00
parent 6a4ca08578
commit 0dbc232ebf
15 changed files with 41 additions and 41 deletions

View File

@ -8,9 +8,9 @@ using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuDropDown<T> : DropDown<T> public class OsuDropdown<T> : Dropdown<T>
{ {
protected override DropDownHeader CreateHeader() => new OsuDropDownHeader { AccentColour = AccentColour }; protected override DropdownHeader CreateHeader() => new OsuDropdownHeader { AccentColour = AccentColour };
protected override Menu CreateMenu() => new OsuMenu(); protected override Menu CreateMenu() => new OsuMenu();
@ -22,8 +22,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
accentColour = value; accentColour = value;
if (Header != null) if (Header != null)
((OsuDropDownHeader)Header).AccentColour = value; ((OsuDropdownHeader)Header).AccentColour = value;
foreach (var item in MenuItems.OfType<OsuDropDownMenuItem<T>>()) foreach (var item in MenuItems.OfType<OsuDropdownMenuItem<T>>())
item.AccentColour = value; item.AccentColour = value;
} }
} }
@ -35,6 +35,6 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = colours.PinkDarker; AccentColour = colours.PinkDarker;
} }
protected override DropDownMenuItem<T> CreateMenuItem(string text, T value) => new OsuDropDownMenuItem<T>(text, value) { AccentColour = AccentColour }; protected override DropdownMenuItem<T> CreateMenuItem(string text, T value) => new OsuDropdownMenuItem<T>(text, value) { AccentColour = AccentColour };
} }
} }

View File

@ -12,7 +12,7 @@ using osu.Framework.Extensions.Color4Extensions;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuDropDownHeader : DropDownHeader public class OsuDropdownHeader : DropdownHeader
{ {
private SpriteText label; private SpriteText label;
protected override string Label protected override string Label
@ -32,7 +32,7 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public OsuDropDownHeader() public OsuDropdownHeader()
{ {
Foreground.Padding = new MarginPadding(4); Foreground.Padding = new MarginPadding(4);

View File

@ -12,9 +12,9 @@ using OpenTK.Graphics;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuDropDownMenuItem<U> : DropDownMenuItem<U> public class OsuDropdownMenuItem<T> : DropdownMenuItem<T>
{ {
public OsuDropDownMenuItem(string text, U value) : base(text, value) public OsuDropdownMenuItem(string text, T value) : base(text, value)
{ {
Foreground.Padding = new MarginPadding(2); Foreground.Padding = new MarginPadding(2);

View File

@ -16,11 +16,11 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class OsuTabControl<T> : TabControl<T> public class OsuTabControl<T> : TabControl<T>
{ {
protected override DropDown<T> CreateDropDown() => new OsuTabDropDown(); protected override Dropdown<T> CreateDropdown() => new OsuTabDropdown();
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem<T> { Value = value }; protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem<T> { Value = value };
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DropDown.Contains(screenSpacePos); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
public OsuTabControl() public OsuTabControl()
{ {
@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
set set
{ {
accentColour = value; accentColour = value;
var dropDown = DropDown as OsuTabDropDown; var dropDown = Dropdown as OsuTabDropdown;
if (dropDown != null) if (dropDown != null)
dropDown.AccentColour = value; dropDown.AccentColour = value;
foreach (var item in TabContainer.Children.OfType<OsuTabItem<T>>()) foreach (var item in TabContainer.Children.OfType<OsuTabItem<T>>())
@ -53,34 +53,34 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public class OsuTabDropDown : OsuDropDown<T> public class OsuTabDropdown : OsuDropdown<T>
{ {
protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader protected override DropdownHeader CreateHeader() => new OsuTabDropdownHeader
{ {
AccentColour = AccentColour, AccentColour = AccentColour,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}; };
protected override DropDownMenuItem<T> CreateMenuItem(string text, T value) protected override DropdownMenuItem<T> CreateMenuItem(string text, T value)
{ {
var item = base.CreateMenuItem(text, value); var item = base.CreateMenuItem(text, value);
item.ForegroundColourHover = Color4.Black; item.ForegroundColourHover = Color4.Black;
return item; return item;
} }
public OsuTabDropDown() public OsuTabDropdown()
{ {
DropDownMenu.Anchor = Anchor.TopRight; DropdownMenu.Anchor = Anchor.TopRight;
DropDownMenu.Origin = Anchor.TopRight; DropdownMenu.Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
DropDownMenu.Background.Colour = Color4.Black.Opacity(0.7f); DropdownMenu.Background.Colour = Color4.Black.Opacity(0.7f);
DropDownMenu.MaxHeight = 400; DropdownMenu.MaxHeight = 400;
} }
public class OsuTabDropDownHeader : OsuDropDownHeader public class OsuTabDropdownHeader : OsuDropdownHeader
{ {
public override Color4 AccentColour public override Color4 AccentColour
{ {
@ -104,7 +104,7 @@ namespace osu.Game.Graphics.UserInterface
base.OnHoverLost(state); base.OnHoverLost(state);
} }
public OsuTabDropDownHeader() public OsuTabDropdownHeader()
{ {
RelativeSizeAxes = Axes.None; RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;

View File

@ -13,9 +13,9 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionDropDown<T> : FillFlowContainer public class OptionDropdown<T> : FillFlowContainer
{ {
private DropDown<T> dropdown; private Dropdown<T> dropdown;
private SpriteText text; private SpriteText text;
public string LabelText public string LabelText
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Options
} }
} }
public OptionDropDown() public OptionDropdown()
{ {
Items = new KeyValuePair<string, T>[0]; Items = new KeyValuePair<string, T>[0];
@ -68,7 +68,7 @@ namespace osu.Game.Overlays.Options
text = new OsuSpriteText { text = new OsuSpriteText {
Alpha = 0, Alpha = 0,
}, },
dropdown = new OsuDropDown<T> dropdown = new OsuDropdown<T>
{ {
Margin = new MarginPadding { Top = 5 }, Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -8,9 +8,9 @@ using System.Collections.Generic;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionEnumDropDown<T> : OptionDropDown<T> public class OptionEnumDropdown<T> : OptionDropdown<T>
{ {
public OptionEnumDropDown() public OptionEnumDropdown()
{ {
if (!typeof(T).IsEnum) if (!typeof(T).IsEnum)
throw new InvalidOperationException("OptionsDropdown only supports enums as the generic type argument"); throw new InvalidOperationException("OptionsDropdown only supports enums as the generic type argument");

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio
protected override string Header => "Devices"; protected override string Header => "Devices";
private AudioManager audio; private AudioManager audio;
private OptionDropDown<string> dropdown; private OptionDropdown<string> dropdown;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio
Children = new Drawable[] Children = new Drawable[]
{ {
dropdown = new OptionDropDown<string> dropdown = new OptionDropdown<string>
{ {
Bindable = audio.AudioDevice Bindable = audio.AudioDevice
}, },

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Options.Sections.Debug
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionEnumDropDown<GCLatencyMode> new OptionEnumDropdown<GCLatencyMode>
{ {
LabelText = "Active mode", LabelText = "Active mode",
Bindable = config.GetBindable<GCLatencyMode>(FrameworkDebugConfig.ActiveGCMode) Bindable = config.GetBindable<GCLatencyMode>(FrameworkDebugConfig.ActiveGCMode)

View File

@ -23,12 +23,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
LabelText = "Background dim", LabelText = "Background dim",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel) Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel)
}, },
new OptionEnumDropDown<ProgressBarType> new OptionEnumDropdown<ProgressBarType>
{ {
LabelText = "Progress display", LabelText = "Progress display",
Bindable = config.GetBindable<ProgressBarType>(OsuConfig.ProgressBarType) Bindable = config.GetBindable<ProgressBarType>(OsuConfig.ProgressBarType)
}, },
new OptionEnumDropDown<ScoreMeterType> new OptionEnumDropdown<ScoreMeterType>
{ {
LabelText = "Score meter type", LabelText = "Score meter type",
Bindable = config.GetBindable<ScoreMeterType>(OsuConfig.ScoreMeter) Bindable = config.GetBindable<ScoreMeterType>(OsuConfig.ScoreMeter)

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Options.Sections.General
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionEnumDropDown<ReleaseStream> new OptionEnumDropdown<ReleaseStream>
{ {
LabelText = "Release stream", LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream), Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream),

View File

@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
LabelText = "Softening filter", LabelText = "Softening filter",
Bindable = config.GetBindable<bool>(OsuConfig.BloomSoftening) Bindable = config.GetBindable<bool>(OsuConfig.BloomSoftening)
}, },
new OptionEnumDropDown<ScreenshotFormat> new OptionEnumDropdown<ScreenshotFormat>
{ {
LabelText = "Screenshot", LabelText = "Screenshot",
Bindable = config.GetBindable<ScreenshotFormat>(OsuConfig.ScreenshotFormat) Bindable = config.GetBindable<ScreenshotFormat>(OsuConfig.ScreenshotFormat)

View File

@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionLabel { Text = "Resolution: TODO dropdown" }, new OptionLabel { Text = "Resolution: TODO dropdown" },
new OptionEnumDropDown<WindowMode> new OptionEnumDropdown<WindowMode>
{ {
LabelText = "Screen mode", LabelText = "Screen mode",
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode), Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
Children = new Drawable[] Children = new Drawable[]
{ {
// TODO: this needs to be a custom dropdown at some point // TODO: this needs to be a custom dropdown at some point
new OptionEnumDropDown<FrameSync> new OptionEnumDropdown<FrameSync>
{ {
LabelText = "Frame limiter", LabelText = "Frame limiter",
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync) Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options.Sections.Input
LabelText = "Map absolute raw input to the osu! window", LabelText = "Map absolute raw input to the osu! window",
Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow) Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow)
}, },
new OptionEnumDropDown<ConfineMouseMode> new OptionEnumDropdown<ConfineMouseMode>
{ {
LabelText = "Confine mouse cursor", LabelText = "Confine mouse cursor",
Bindable = config.GetBindable<ConfineMouseMode>(OsuConfig.ConfineMouse), Bindable = config.GetBindable<ConfineMouseMode>(OsuConfig.ConfineMouse),

View File

@ -161,9 +161,9 @@
<Compile Include="Overlays\Notifications\SimpleNotification.cs" /> <Compile Include="Overlays\Notifications\SimpleNotification.cs" />
<Compile Include="Overlays\Options\OptionDropDown.cs" /> <Compile Include="Overlays\Options\OptionDropDown.cs" />
<Compile Include="Overlays\Options\OptionLabel.cs" /> <Compile Include="Overlays\Options\OptionLabel.cs" />
<Compile Include="Graphics\UserInterface\OsuDropDownHeader.cs" /> <Compile Include="Graphics\UserInterface\OsuDropdownHeader.cs" />
<Compile Include="Graphics\UserInterface\OsuDropDown.cs" /> <Compile Include="Graphics\UserInterface\OsuDropdown.cs" />
<Compile Include="Graphics\UserInterface\OsuDropDownMenuItem.cs" /> <Compile Include="Graphics\UserInterface\OsuDropdownMenuItem.cs" />
<Compile Include="Overlays\Options\OptionsFooter.cs" /> <Compile Include="Overlays\Options\OptionsFooter.cs" />
<Compile Include="Overlays\Options\Sections\DebugSection.cs" /> <Compile Include="Overlays\Options\Sections\DebugSection.cs" />
<Compile Include="Overlays\Options\Sections\Debug\GeneralOptions.cs" /> <Compile Include="Overlays\Options\Sections\Debug\GeneralOptions.cs" />