using System.Drawing;
using System.Windows.Forms;

namespace QCRPG.Framework;

public class UserControlBase : UserControl
{
	private GenericNotifier<LogMessage> logMessageNotifier = new GenericNotifier<LogMessage>();

	protected string displayName;

	public string DisplayName => displayName;

	public UserControlBase()
	{
	}

	public UserControlBase(string displayName)
	{
		this.displayName = displayName;
	}

	public void RegisterLogMessageObserver(IObserver<LogMessage> observer)
	{
		logMessageNotifier.RegisterObserver(observer);
	}

	public void UnregisterLogMessageObserver(IObserver<LogMessage> observer)
	{
		logMessageNotifier.UnregisterObserver(observer);
	}

	protected void NotifyLogMessageObservers(LogMessage logMessage)
	{
		logMessageNotifier.NotifyObservers(logMessage);
	}

	private void InitializeComponent()
	{
		base.SuspendLayout();
		base.Name = "UserControlBase";
		base.Size = new System.Drawing.Size(400, 300);
		base.ResumeLayout(false);
	}
}
