comparison UIControl/ReplaceEquipmentUIControl.cs @ 70:4b82515586ac

Re #60: Add UI to add/remove/edit weapons in GTK * Fix widget enabling/disabling (sometimes enabling ratio input for numeric limit) * Correct behaviour of Edit dialog (setting wrong value on edit) * Add setting of limits based on specific equipment item to base dialog controller * Make sure that we catch all radio button click events from Edit dialog * Add ability to ignore and listen to widgets to make sure that changes don't cascade TODO: See if code can be tidied up and common classes created
author IBBoard <dev@ibboard.co.uk>
date Sat, 06 Nov 2010 17:03:13 +0000
parents 3b4a646b4054
children
comparison
equal deleted inserted replaced
69:3b4a646b4054 70:4b82515586ac
39 } 39 }
40 40
41 private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip) 41 private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip)
42 { 42 {
43 equipItem = equip; 43 equipItem = equip;
44 44 SetUnitEquipmentLimits(equip);
45 if (equip != null)
46 {
47 bool equipIsRatioLimit = UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip);
48 maxPercentage = GetMaxPercentageLimit(equip);
49 minPercentage = GetMinPercentageLimit(equip);
50 maxNumber = GetMaxNumericLimit(equip);
51 minNumber = GetMinNumericLimit(equip);
52
53 ui.SetUnitEquipmentLimits(equipIsRatioLimit, minPercentage, maxPercentage, minNumber, maxNumber);
54 ui.SetUnitEquipmentLimitsEnabled(true);
55 ui.SetOkayEnabledState(HasNonZeroEquipmentAmount());
56 SetEquipmentAmountControlEnabledStates();
57 }
58 else
59 {
60 maxPercentage = minPercentage = 0;
61 maxNumber = minNumber = 0;
62 ui.SetUnitEquipmentLimits(false, minPercentage, maxPercentage, minNumber, maxNumber);
63 ui.SetUnitEquipmentLimitsEnabled(false);
64 ui.SetOkayEnabledState(false);
65 }
66 } 45 }
67 46
68 protected override void DoProcessing() 47 protected override void DoProcessing()
69 { 48 {
70 if (isRatioAmount) 49 if (isRatioAmount)