Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
diff FrmNewUnit.cs @ 76:7055b24cfc79
Re #308: Make GTK# UI translatable
* Extend new TranslatableDialog
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 23 Nov 2010 21:03:46 +0000 |
parents | a191d0655f55 |
children | 68804784bf6f |
line wrap: on
line diff
--- a/FrmNewUnit.cs Tue Nov 23 20:17:18 2010 +0000 +++ b/FrmNewUnit.cs Tue Nov 23 21:03:46 2010 +0000 @@ -4,18 +4,18 @@ using System; using System.Collections.Generic; +using Gtk; +using IBBoard.GtkSharp.Translatable; using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Requirements; -using Gtk; using log4net; namespace IBBoard.WarFoundry.GTK { - public partial class FrmNewUnit : Gtk.Dialog + public partial class FrmNewUnit : TranslatableDialog { private ILog logger = LogManager.GetLogger(typeof(FrmNewUnit)); - - private UnitType unitType; + private UnitType unitType; private Army unitArmy; public FrmNewUnit(Race race, Category cat, Army army) @@ -23,12 +23,12 @@ this.Build(); unitArmy = army; - TreeViewColumn unitTypeColumn = new TreeViewColumn (); + TreeViewColumn unitTypeColumn = new TreeViewColumn(); unitTypeColumn.Title = "Unit Type"; - CellRendererText unitTypeCell = new CellRendererText (); + CellRendererText unitTypeCell = new CellRendererText(); unitTypeColumn.PackStart(unitTypeCell, true); lstUnitTypes.AppendColumn(unitTypeColumn); - unitTypeColumn.SetCellDataFunc (unitTypeCell, new TreeCellDataFunc(RenderUnitTypeName)); + unitTypeColumn.SetCellDataFunc(unitTypeCell, new TreeCellDataFunc(RenderUnitTypeName)); ListStore store = new ListStore(typeof(UnitType)); UnitType[] types = race.GetUnitTypes(cat); logger.DebugFormat("Listing {0} unit types in {1}", types.Length, cat.Name); @@ -40,7 +40,7 @@ } lstUnitTypes.Model = store; - lstUnitTypes.Selection.Changed+= new EventHandler(OnSelectionChanged); + lstUnitTypes.Selection.Changed += new EventHandler(OnSelectionChanged); } private void RenderUnitTypeName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) @@ -63,12 +63,12 @@ { TreeModel model; TreeIter iter; - lstUnitTypes.Selection.GetSelected (out model, out iter); + lstUnitTypes.Selection.GetSelected(out model, out iter); UnitType toReturn = null; - if (model!=null) + if (model != null) { - toReturn = (UnitType) model.GetValue(iter, 0); + toReturn = (UnitType)model.GetValue(iter, 0); } return toReturn; @@ -78,7 +78,7 @@ { UnitType type = GetSelectedUnitType(); - if (type!=null) + if (type != null) { buttonOk.Sensitive = true; List<FailedUnitRequirement> fails = unitArmy.CanAddUnitType(type); @@ -97,18 +97,18 @@ } } - protected virtual void OnButtonCancelActivated (object sender, System.EventArgs e) + protected virtual void OnButtonCancelActivated(object sender, System.EventArgs e) { Respond(ResponseType.Cancel); } - protected virtual void OnRowActivated (object o, Gtk.RowActivatedArgs args) + protected virtual void OnRowActivated(object o, Gtk.RowActivatedArgs args) { unitType = GetSelectedUnitType(); Respond(ResponseType.Ok); } - protected virtual void OnButtonOkClicked (object sender, System.EventArgs e) + protected virtual void OnButtonOkClicked(object sender, System.EventArgs e) { unitType = GetSelectedUnitType(); Respond(ResponseType.Ok);