1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

CheckBox -> Checkbox.

This commit is contained in:
Dean Herbert 2017-03-31 17:38:33 +09:00
parent f42935eccf
commit 24d06fa92d
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
5 changed files with 23 additions and 23 deletions

View File

@ -12,7 +12,7 @@ using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class Nub : CircularContainer, IStateful<CheckBoxState>
public class Nub : CircularContainer, IStateful<CheckboxState>
{
public const float COLLAPSED_SIZE = 20;
public const float EXPANDED_SIZE = 40;
@ -84,9 +84,9 @@ namespace osu.Game.Graphics.UserInterface
}
}
private CheckBoxState state;
private CheckboxState state;
public CheckBoxState State
public CheckboxState State
{
get
{
@ -98,10 +98,10 @@ namespace osu.Game.Graphics.UserInterface
switch (state)
{
case CheckBoxState.Checked:
case CheckboxState.Checked:
fill.FadeIn(200, EasingTypes.OutQuint);
break;
case CheckBoxState.Unchecked:
case CheckboxState.Unchecked:
fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times
break;
}

View File

@ -16,7 +16,7 @@ using OpenTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public class OsuCheckbox : CheckBox
public class OsuCheckbox : Checkbox
{
private Bindable<bool> bindable;
@ -29,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface
bindable = value;
if (bindable != null)
{
bool state = State == CheckBoxState.Checked;
bool state = State == CheckboxState.Checked;
if (state != bindable.Value)
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked;
bindable.ValueChanged += bindableValueChanged;
}
@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface
private void bindableValueChanged(object sender, EventArgs e)
{
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked;
}
protected override void Dispose(bool isDisposing)
@ -122,7 +122,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnChecked()
{
sampleChecked?.Play();
nub.State = CheckBoxState.Checked;
nub.State = CheckboxState.Checked;
if (bindable != null)
bindable.Value = true;
@ -131,7 +131,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnUnchecked()
{
sampleUnchecked?.Play();
nub.State = CheckBoxState.Unchecked;
nub.State = CheckboxState.Unchecked;
if (bindable != null)
bindable.Value = false;

View File

@ -50,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface
nub = new Nub
{
Origin = Anchor.TopCentre,
State = CheckBoxState.Unchecked,
State = CheckboxState.Unchecked,
Expanded = true,
}
};
@ -94,13 +94,13 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
nub.State = CheckBoxState.Checked;
nub.State = CheckboxState.Checked;
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
nub.State = CheckBoxState.Unchecked;
nub.State = CheckboxState.Unchecked;
return base.OnMouseUp(state, args);
}

View File

@ -16,15 +16,15 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// A checkbox styled to be placed in line with an <see cref="OsuTabControl{T}"/>
/// A Checkbox styled to be placed in line with an <see cref="OsuTabControl{T}"/>
/// </summary>
public class OsuTabControlCheckBox : CheckBox
public class OsuTabControlCheckbox : Checkbox
{
private readonly Box box;
private readonly SpriteText text;
private readonly TextAwesome icon;
public event EventHandler<CheckBoxState> Action;
public event EventHandler<CheckboxState> Action;
private Color4? accentColour;
public Color4 AccentColour
@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
{
accentColour = value;
if (State != CheckBoxState.Checked)
if (State != CheckboxState.Checked)
{
text.Colour = AccentColour;
icon.Colour = AccentColour;
@ -84,7 +84,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnHoverLost(InputState state)
{
if (State == CheckBoxState.Unchecked)
if (State == CheckboxState.Unchecked)
fadeOut();
base.OnHoverLost(state);
@ -97,7 +97,7 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = colours.Blue;
}
public OsuTabControlCheckBox()
public OsuTabControlCheckbox()
{
AutoSizeAxes = Axes.Both;

View File

@ -17,14 +17,14 @@ namespace osu.Game.Screens.Select
public class BeatmapDetailAreaTabControl : Container
{
public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckBox modsCheckbox;
private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl<BeatmapDetailTab> tabs;
public Action<BeatmapDetailTab, bool> OnFilter; //passed the selected tab and if mods is checked
private void invokeOnFilter()
{
OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckBoxState.Checked);
OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckboxState.Checked);
}
[BackgroundDependencyLoader]
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
},
modsCheckbox = new OsuTabControlCheckBox
modsCheckbox = new OsuTabControlCheckbox
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,