Remove chatTabControl and transfer the logic into ChannelTabControl.

This commit is contained in:
miterosan
2018-07-29 21:18:37 +02:00
parent 7b653fab17
commit 95cb21299a
4 changed files with 56 additions and 101 deletions

View File

@ -9,6 +9,7 @@ using osu.Game.Online.Chat;
using OpenTK;
using osu.Framework.Configuration;
using System;
using System.Linq;
namespace osu.Game.Overlays.Chat.Tabs
{
@ -64,6 +65,33 @@ namespace osu.Game.Overlays.Chat.Tabs
}
}
/// <summary>
/// Adds a channel to the ChannelTabControl.
/// The first channel added will automaticly selected.
/// </summary>
/// <param name="channel">The channel that is going to be added.</param>
public void AddChannel(Channel channel)
{
if (!Items.Contains(channel))
AddItem(channel);
if (Current.Value == null)
Current.Value = channel;
}
/// <summary>
/// Removes a channel from the ChannelTabControl.
/// If the selected channel is the one that is beeing removed, the next available channel will be selected.
/// </summary>
/// <param name="channel">The channel that is going to be removed.</param>
public void RemoveChannel(Channel channel)
{
RemoveItem(channel);
if (Current.Value == channel)
Current.Value = Items.FirstOrDefault();
}
protected override void SelectTab(TabItem<Channel> tab)
{
if (tab is ChannelSelectorTabItem)