mirror of
https://github.com/ppy/osu
synced 2025-01-25 07:13:22 +00:00
Add ability to override text in PageTabItem
This commit is contained in:
parent
f9c6a8c5b7
commit
c3c2efe35c
@ -63,7 +63,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Margin = new MarginPadding { Top = 8, Bottom = 8 },
|
Margin = new MarginPadding { Top = 8, Bottom = 8 },
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Text = (value as Enum)?.GetDescription() ?? value.ToString(),
|
Text = CreateText(),
|
||||||
Font = OsuFont.GetFont(size: 14)
|
Font = OsuFont.GetFont(size: 14)
|
||||||
},
|
},
|
||||||
box = new Box
|
box = new Box
|
||||||
@ -81,6 +81,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual string CreateText() => (Value as Enum)?.GetDescription() ?? Value.ToString();
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (!Active.Value)
|
if (!Active.Value)
|
||||||
|
Loading…
Reference in New Issue
Block a user