WIP Tooltip code
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Model.Feedback;
|
||||
|
||||
namespace Services.Website;
|
||||
|
||||
public class TooltipService : ITooltipService
|
||||
{
|
||||
private readonly List<TooltipModel> tooltips = new();
|
||||
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void AddTooltip(TooltipModel tooltip)
|
||||
{
|
||||
tooltips.Insert(0, tooltip);
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public void RemoveTooltip(TooltipModel tooltip)
|
||||
{
|
||||
tooltips.Remove(tooltip);
|
||||
}
|
||||
|
||||
public bool HasTooltips()
|
||||
{
|
||||
return tooltips.Count > 0;
|
||||
}
|
||||
|
||||
public List<TooltipModel> GetTooltips()
|
||||
{
|
||||
return tooltips;
|
||||
}
|
||||
|
||||
|
||||
public void ClearAllTooltips()
|
||||
{
|
||||
tooltips.Clear();
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private event Action OnChange = null!;
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user