using System;
using MGTK.Controls;

namespace Rothko.GUI.MonoGame.Views
{
	public abstract partial class CRUDBaseView<T>
	{
		protected Label _LabelListBox;
		protected ListBox _ListBox;

		protected Button _ButtonNew;
		protected Button _ButtonSave;
		protected Button _ButtonDelete;

		protected int _RTBaseWidth = 472;
		protected int _RTBaseHeight = 320;

		void InitializeComponent()
		{

			Width = _RTBaseWidth;
			Height = _RTBaseHeight;

			_LabelListBox = new Label(this)
			{
				X = 8, Y = 8, Height = 8, Width = 192, Text = "Records"
			};
			_ListBox = new ListBox(this)
			{
				X = 8, Y = _LabelListBox.Y + 16, Height = _RTBaseHeight - 64, Width = 192, 
				SelectedIndex = -1,
				Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top
			};

			_ButtonDelete = new Button(this)
			{
				X = _RTBaseWidth - 8 - 64,
				Y = _RTBaseHeight - 8 - 24,
				Width = 64,
				Height = 24,
				Text = "Delete",
				Anchor = AnchorStyles.Right | AnchorStyles.Bottom
			};
			_ButtonSave = new Button(this)
			{
				X = _ButtonDelete.X - 64,
				Y = _ButtonDelete.Y,
				Width = 64,
				Height = 24,
				Text = "Save",
				Anchor = AnchorStyles.Right | AnchorStyles.Bottom
			};
			_ButtonNew = new Button(this)
			{
				X = _ButtonSave.X - 64,
				Y = _ButtonSave.Y,
				Width = 64,
				Height = 24,
				Text = "New",
				Anchor = AnchorStyles.Right | AnchorStyles.Bottom
			};

			Controls.AddRange(new Control[]
          	{
				_LabelListBox,
				_ListBox,
				_ButtonNew,
				_ButtonSave,
				_ButtonDelete
			});
		}
	}
}

