changeset 75:2ceae5d685d8

Re #86: Complete initial GTK# UI * Fix default game system selecting
author IBBoard <dev@ibboard.co.uk>
date Tue, 23 Nov 2010 20:17:18 +0000
parents 52b731576845
children 7055b24cfc79
files FrmNewArmy.cs
diffstat 1 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/FrmNewArmy.cs	Tue Nov 23 20:05:37 2010 +0000
+++ b/FrmNewArmy.cs	Tue Nov 23 20:17:18 2010 +0000
@@ -27,6 +27,15 @@
 			GameSystem[] gameSystems = WarFoundryLoader.GetDefault().GetGameSystems();
 			ComboBoxUtils.FillCombo(systemCombo, gameSystems, delegate(GameSystem sys){return sys.Name;});
 			
+			lstRaces.Selection.Changed += new EventHandler(OnSelectionChanged);
+			
+			TreeViewColumn raceColumn = new TreeViewColumn();
+			raceColumn.Title = "Race";
+			CellRendererText raceCell = new CellRendererText();
+			raceColumn.PackStart(raceCell, true);
+			lstRaces.AppendColumn(raceColumn);
+			raceColumn.SetCellDataFunc(raceCell, GtkWarFoundryUtil.RenderWarFoundryObjectName);
+			
 			if (gameSystem != null)
 			{
 				ComboBoxUtils.SelectItem(systemCombo, gameSystem);
@@ -35,27 +44,18 @@
 			{
 				ComboBoxUtils.SelectIndex(systemCombo, 0);
 			}
-			
-			lstRaces.Selection.Changed+= new EventHandler(OnSelectionChanged);
-			
-			TreeViewColumn raceColumn = new TreeViewColumn ();
-			raceColumn.Title = "Race";
-			CellRendererText raceCell = new CellRendererText ();
-			raceColumn.PackStart (raceCell, true);
-			lstRaces.AppendColumn(raceColumn);
-			raceColumn.SetCellDataFunc(raceCell, GtkWarFoundryUtil.RenderWarFoundryObjectName);
+		}
 
-			
-			if (gameSystem!=null)
-			{
-				SetRaces(gameSystem);
-			}
-		}
-		
 		public string Text
 		{
-			get { return Title; }
-			set { Title = value; }
+			get
+			{
+				return Title;
+			}
+			set
+			{
+				Title = value;
+			}
 		}
 
 		protected virtual void OnSelectionChanged(object o, EventArgs e)
@@ -66,41 +66,41 @@
 		
 		private void SetOkayButtonState()
 		{
-			bttnCreate.Sensitive = (lstRaces.Selection.CountSelectedRows() == 1 && txtArmyName.Text!="" && sbPointsValue.Value > 0);
+			bttnCreate.Sensitive = (lstRaces.Selection.CountSelectedRows() == 1 && txtArmyName.Text != "" && sbPointsValue.Value > 0);
 		}
 
-		protected virtual void OnCreateClicked (object sender, System.EventArgs e)
+		protected virtual void OnCreateClicked(object sender, System.EventArgs e)
 		{
 			TreeModel model;
 			TreeIter iter;
-			lstRaces.Selection.GetSelected (out model, out iter);
-			race = (Race) model.GetValue(iter, 0);
+			lstRaces.Selection.GetSelected(out model, out iter);
+			race = (Race)model.GetValue(iter, 0);
 			armyName = txtArmyName.Text;
 			pointsValue = (int)sbPointsValue.Value;
 			Respond(ResponseType.Ok);
 		}
 
-		protected virtual void OnCancelClicked (object sender, System.EventArgs e)
+		protected virtual void OnCancelClicked(object sender, System.EventArgs e)
 		{
 			Respond(ResponseType.Cancel);
 		}
 
-		protected virtual void OnTextChanged (object sender, System.EventArgs e)
+		protected virtual void OnTextChanged(object sender, System.EventArgs e)
 		{
 			SetOkayButtonState();
 		}
 
-		protected virtual void OnSpinChangeValue (object o, Gtk.ChangeValueArgs args)
+		protected virtual void OnSpinChangeValue(object o, Gtk.ChangeValueArgs args)
 		{
 			SetOkayButtonState();
 		}
 
-		protected virtual void OnSpinValueChanged (object sender, System.EventArgs e)
+		protected virtual void OnSpinValueChanged(object sender, System.EventArgs e)
 		{
 			SetOkayButtonState();
 		}
 		
-		protected virtual void OnSystemComboChanged (object sender, System.EventArgs e)
+		protected virtual void OnSystemComboChanged(object sender, System.EventArgs e)
 		{
 			GameSystem system = ComboBoxUtils.GetSelectedItem<GameSystem>(systemCombo);
 			SetRaces(system);
@@ -133,7 +133,7 @@
 			get { return armyName; }
 		}
 		
-		public int ArmySize 
+		public int ArmySize
 		{
 			get { return pointsValue; }
 		}