Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
annotate 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 |
rev | line source |
---|---|
142
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (ValidationFailureWidget.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2011 IBBoard |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // 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. |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System; |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System.Collections.Generic; |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using System.Text; |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 namespace IBBoard.WarFoundry.GUI.GTK |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 { |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 [System.ComponentModel.ToolboxItem(true)] |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 public partial class ValidationFailureWidget : Gtk.Bin |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 { |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 public ValidationFailureWidget() |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 { |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 this.Build(); |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 public ValidationFailureWidget(ICollection<string> messages) : this() |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 { |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 SetMessages(messages); |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 public void SetMessages(ICollection<string> messages) |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 { |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 StringBuilder sb = new StringBuilder(); |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 foreach (string msg in messages) |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 { |
144
929ef50c3919
Fixes #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
142
diff
changeset
|
29 sb.AppendLine(" • " + msg); |
142
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 validationMessages.Text = sb.ToString(); |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 } |
f23e5b40ca9d
Re #344: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 |