Merge pull request #4254 from peppy/add-button-tooltip

Add tooltip to key configuration button
This commit is contained in:
Dan Balasescu 2019-02-20 11:53:38 +09:00 committed by GitHub
commit 5ac1288f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
}); });
} }
public IEnumerable<string> FilterTerms => new[] { Text }; public virtual IEnumerable<string> FilterTerms => new[] { Text };
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new SettingsButton new SettingsButton
{ {
Text = "Key configuration", Text = "Key configuration",
TooltipText = "Change global shortcut keys and gameplay bindings",
Action = keyConfig.ToggleVisibility Action = keyConfig.ToggleVisibility
}, },
}; };

View File

@ -1,17 +1,33 @@
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
public class SettingsButton : TriangleButton public class SettingsButton : TriangleButton, IHasTooltip
{ {
public SettingsButton() public SettingsButton()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }; Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
} }
public string TooltipText { get; set; }
public override IEnumerable<string> FilterTerms
{
get
{
if (TooltipText != null)
return base.FilterTerms.Append(TooltipText);
return base.FilterTerms;
}
}
} }
} }