Implement OverlaySortTabControl component

This commit is contained in:
Andrei Zavatski
2020-02-17 02:20:53 +03:00
parent e80c310ab2
commit a9f366fda3
5 changed files with 159 additions and 135 deletions

View File

@ -16,8 +16,6 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsHeader : CompositeDrawable
{
private const int font_size = 14;
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
public readonly BindableBool ShowDeleted = new BindableBool();
@ -40,29 +38,11 @@ namespace osu.Game.Overlays.Comments
Padding = new MarginPadding { Horizontal = 50 },
Children = new Drawable[]
{
new FillFlowContainer
new OverlaySortTabControl<CommentsSortCriteria>
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: font_size),
Text = @"Sort by"
},
new SortTabControl
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = Sort
}
}
Current = Sort
},
new ShowDeletedButton
{
@ -106,7 +86,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: font_size),
Font = OsuFont.GetFont(size: 12),
Text = @"Show deleted"
}
},
@ -126,4 +106,11 @@ namespace osu.Game.Overlays.Comments
}
}
}
public enum CommentsSortCriteria
{
New,
Old,
Top
}
}