view Widgets/ValidationFailureWidget.cs @ 144:929ef50c3919

Fixes #344: Show unit requirement failures * Remove border on scrollable area * Make text selectable, in case people want to copy it * Shrink size of New Unit window to remove spare space
author IBBoard <dev@ibboard.co.uk>
date Tue, 25 Oct 2011 20:32:47 +0100
parents f23e5b40ca9d
children
line wrap: on
line source

// This file (ValidationFailureWidget.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2011 IBBoard
// 
// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
using System;
using System.Collections.Generic;
using System.Text;

namespace IBBoard.WarFoundry.GUI.GTK
{
	[System.ComponentModel.ToolboxItem(true)]
	public partial class ValidationFailureWidget : Gtk.Bin
	{
		public ValidationFailureWidget()
		{
			this.Build();
		}

		public ValidationFailureWidget(ICollection<string> messages) : this()
		{
			SetMessages(messages);
		}

		public void SetMessages(ICollection<string> messages)
		{
			StringBuilder sb = new StringBuilder();
			
			foreach (string msg in messages)
			{
				sb.AppendLine(" • " + msg);
			}
			
			validationMessages.Text = sb.ToString();
		}
	}
}