Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
diff Widgets/ValidationFailureWidget.cs @ 142:f23e5b40ca9d
Re #344: Show unit requirement failures
* Add new widget for displaying failures nicely
* Use widget for displaying failures in main window
* Use widget for displaying failures in new unit dialog
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 18 Oct 2011 21:03:35 +0100 |
parents | |
children | 929ef50c3919 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Widgets/ValidationFailureWidget.cs Tue Oct 18 21:03:35 2011 +0100 @@ -0,0 +1,36 @@ +// 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(); + } + } +} +