Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
comparison UIControl/AddEquipmentUIControl.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 | 7028e24b67ec |
children | 986fc923c0fa |
comparison
equal
deleted
inserted
replaced
69:3b4a646b4054 | 70:4b82515586ac |
---|---|
17 { | 17 { |
18 //Do nothing extra | 18 //Do nothing extra |
19 } | 19 } |
20 | 20 |
21 //TODO Make abstract | 21 //TODO Make abstract |
22 | |
22 protected override IAddEquipmentUI CreateEquipmentUI() | 23 protected override IAddEquipmentUI CreateEquipmentUI() |
23 { | 24 { |
24 return new FrmAddEquipment(); | 25 return new FrmAddEquipment(); |
25 } | 26 } |
26 | 27 |
32 } | 33 } |
33 | 34 |
34 private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip) | 35 private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip) |
35 { | 36 { |
36 equipItem = equip; | 37 equipItem = equip; |
37 | 38 SetUnitEquipmentLimits(equip); |
38 if (equip != null) | |
39 { | |
40 bool equipIsRatioLimit = UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip); | |
41 maxPercentage = GetMaxPercentageLimit(equip); | |
42 minPercentage = GetMinPercentageLimit(equip); | |
43 maxNumber = GetMaxNumericLimit(equip); | |
44 minNumber = GetMinNumericLimit(equip); | |
45 | |
46 ui.SetUnitEquipmentLimits(equipIsRatioLimit, minPercentage, maxPercentage, minNumber, maxNumber); | |
47 ui.SetUnitEquipmentLimitsEnabled(true); | |
48 ui.SetOkayEnabledState(HasNonZeroEquipmentAmount()); | |
49 SetEquipmentAmountControlEnabledStates(); | |
50 } | |
51 else | |
52 { | |
53 maxPercentage = minPercentage = 0; | |
54 maxNumber = minNumber = 0; | |
55 ui.SetUnitEquipmentLimits(false, minPercentage, maxPercentage, minNumber, maxNumber); | |
56 ui.SetUnitEquipmentLimitsEnabled(false); | |
57 ui.SetOkayEnabledState(false); | |
58 } | |
59 } | 39 } |
60 | 40 |
61 protected override void DoProcessing() | 41 protected override void DoProcessing() |
62 { | 42 { |
63 if (isRatioAmount) | 43 if (isRatioAmount) |