Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
annotate Widgets/TransformXmlWidget.cs @ 135:fda46380dd68
Re #329: "Points" system should be used in UI
* Replace fixed "pts" or "pt" with game system's text
(May be fixed, but needs more testing)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 09 Oct 2011 21:03:09 +0100 |
parents | cff58ea990c4 |
children | 9808adf2d566 |
rev | line source |
---|---|
127 | 1 // This file (TransformXmlWidget.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2011 IBBoard |
2 // | |
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. | |
4 using System; | |
5 using System.IO; | |
6 using System.Collections.Generic; | |
7 using IBBoard.GtkSharp; | |
132
cff58ea990c4
Fixes #361: Add XML export UI to GTK#
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
8 using IBBoard.GtkSharp.Translatable; |
127 | 9 |
10 namespace IBBoard.WarFoundry.GUI.GTK | |
11 { | |
12 [System.ComponentModel.ToolboxItem(true)] | |
13 public partial class TransformXmlWidget : Gtk.Bin | |
14 { | |
15 public event EventHandler TransformChanged; | |
16 | |
17 public TransformXmlWidget() | |
18 { | |
19 this.Build(); | |
20 FillXsltList(); | |
132
cff58ea990c4
Fixes #361: Add XML export UI to GTK#
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
21 ControlTranslator.TranslateWidget(this); |
127 | 22 } |
23 | |
24 private void FillXsltList() | |
25 { | |
26 DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl")); | |
27 List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl")); | |
28 ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; }); | |
29 } | |
30 | |
31 public bool IsValid | |
32 { | |
33 get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<FileInfo>(transformList) != null; } | |
34 } | |
35 | |
36 public bool TransformEnabled | |
37 { | |
38 get { return doTransformWidget.Active; } | |
39 } | |
40 | |
41 public string GetXsltPath() | |
42 { | |
43 return ComboBoxUtils.GetSelectedItem<FileInfo>(transformList).FullName; | |
44 } | |
45 | |
46 protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e) | |
47 { | |
48 bool enabled = doTransformWidget.Active; | |
49 lblTransform.Sensitive = enabled; | |
50 transformList.Sensitive = enabled; | |
51 FireTransformChanged(); | |
52 } | |
53 | |
54 protected void OnTransformListChanged(object sender, System.EventArgs e) | |
55 { | |
56 FireTransformChanged(); | |
57 } | |
58 | |
59 private void FireTransformChanged() | |
60 { | |
61 if (TransformChanged!= null) | |
62 { | |
63 TransformChanged(this, EventArgs.Empty); | |
64 } | |
65 } | |
66 } | |
67 } | |
68 |