comparison FrmAddEquipment.cs @ 55:eb7db8495bb5

Re #60: Add UI to add/remove/edit weapons in GTK * Make some manual changes to the Steic-generated file until MonoDevelop bug 634447 is resolved * Add logging to UI * Make control close once we're done with it * Set values for equipment controls
author IBBoard <dev@ibboard.co.uk>
date Wed, 25 Aug 2010 19:51:23 +0000
parents f9f6e9db5350
children 0c5fbb54bfb0
comparison
equal deleted inserted replaced
54:f9f6e9db5350 55:eb7db8495bb5
5 using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces; 5 using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces;
6 using IBBoard.WarFoundry.API.Objects; 6 using IBBoard.WarFoundry.API.Objects;
7 using Gtk; 7 using Gtk;
8 using IBBoard.WarFoundry.GUI.GTK.Util; 8 using IBBoard.WarFoundry.GUI.GTK.Util;
9 using IBBoard.GtkSharp; 9 using IBBoard.GtkSharp;
10 using log4net.Repository.Hierarchy;
11 using log4net;
10 namespace IBBoard.WarFoundry.GUI.GTK 12 namespace IBBoard.WarFoundry.GUI.GTK
11 { 13 {
12 public partial class FrmAddEquipment : Gtk.Dialog, IAddEquipmentUI 14 public partial class FrmAddEquipment : Dialog, IAddEquipmentUI
13 { 15 {
16 private static ILog log = LogManager.GetLogger(typeof(FrmAddEquipment));
17
14 public event SingleArgMethodInvoker<UnitEquipmentItem> UnitEquipmentItemChoiceChanged; 18 public event SingleArgMethodInvoker<UnitEquipmentItem> UnitEquipmentItemChoiceChanged;
15 19
16 public FrmAddEquipment() 20 public FrmAddEquipment()
17 { 21 {
18 this.Build(); 22 this.Build();
45 lstEquipment.Model = store; 49 lstEquipment.Model = store;
46 } 50 }
47 51
48 public void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber) 52 public void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber)
49 { 53 {
50 54 log.DebugFormat("IsRatio? {0}. Limits: {1}->{2}, {3}%->{4}%", isRatioLimit, minNumber, maxNumber, minPercent, maxPercent);
55 rbEquipNumeric.Sensitive = isRatioLimit;
56 numericAmount.Sensitive = isRatioLimit;
57 numericAmount.SetRange(minNumber, maxNumber);
58 percentageAmount.SetRange(minPercent, maxPercent);
51 } 59 }
52 60
53 public void SetUnitEquipmentLimitsEnabled(bool isEnabled) 61 public void SetUnitEquipmentLimitsEnabled(bool isEnabled)
54 { 62 {
55
56 } 63 }
57 64
58 public bool ShowControl() 65 public bool ShowControl()
59 { 66 {
60 return Run() == (int)ResponseType.Ok; 67 int result = Run();
68 bool okayClicked = (result == (int)ResponseType.Ok);
69 this.Hide();
70 this.Dispose();
71 return okayClicked;
61 } 72 }
62 73
63 protected virtual void CancelButtonClicked (object sender, System.EventArgs e) 74 protected virtual void CancelButtonClicked(object sender, System.EventArgs e)
64 { 75 {
76 log.Debug("Cancel clicked");
65 Respond(ResponseType.Cancel); 77 Respond(ResponseType.Cancel);
66 } 78 }
67 } 79 }
68 } 80 }
69 81