Add tooltip to sliderbars. Move interface.

This commit is contained in:
Dean Herbert 2017-04-20 17:33:07 +09:00
parent ce5763ed97
commit c87657707f
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
4 changed files with 8 additions and 10 deletions

View File

@ -19,7 +19,7 @@ namespace osu.Desktop.VisualTests.Tests
public override void Reset()
{
base.Reset();
TooltipSlider slider;
OsuSliderBar<int> slider;
Children = new Drawable[]
{
@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests
Text = "a box with a tooltip",
Size = new Vector2(300,30),
},
slider = new TooltipSlider
slider = new OsuSliderBar<int>
{
Width = 300,
},
@ -75,10 +75,5 @@ namespace osu.Desktop.VisualTests.Tests
{
public string TooltipText => Text;
}
private class TooltipSlider : OsuSliderBar<int>, IHasTooltip
{
public string TooltipText => Current.Value.ToString();
}
}
}

View File

@ -3,7 +3,7 @@
using osu.Framework.Graphics;
namespace osu.Game.Graphics.Cursor
namespace osu.Game.Graphics
{
public interface IHasTooltip : IDrawable
{

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@ -12,7 +13,7 @@ using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public class OsuSliderBar<U> : SliderBar<U> where U : struct
public class OsuSliderBar<U> : SliderBar<U>, IHasTooltip where U : struct
{
private SampleChannel sample;
private double lastSampleTime;
@ -21,6 +22,8 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box leftBox;
private readonly Box rightBox;
public string TooltipText => Current.Value.ToString();
public OsuSliderBar()
{
Height = 12;

View File

@ -88,12 +88,12 @@
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
<Compile Include="Graphics\IHasAccentColour.cs" />
<Compile Include="Graphics\IHasTooltip.cs" />
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
<Compile Include="Graphics\UserInterface\BackButton.cs" />
<Compile Include="Graphics\UserInterface\Bar.cs" />
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />
<Compile Include="Graphics\Cursor\IHasTooltip.cs" />
<Compile Include="Graphics\UserInterface\Nub.cs" />
<Compile Include="Graphics\UserInterface\OsuMenu.cs" />
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />