view UIControl/Interfaces/IAddEquipmentUI.cs @ 57:293d204e40db

Re #60: Add UI to add/remove/edit weapons in GTK * Make enabling/disabling fit the values passed (copied from existing WinForms checks) * Add extra interface methods and properties to get necessary values from UI to use in command * Implement new interface methods * Implement command execution * Make use of IDisposable interface instead of defining Dispose ourselves Also: * Use existing method of printing exception stack traces in main window
author IBBoard <dev@ibboard.co.uk>
date Thu, 26 Aug 2010 19:30:22 +0000
parents 0c5fbb54bfb0
children e7ad676a7344
line wrap: on
line source

//  This file (IAddEquipmentUI.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard
// 
//  The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
using System;
using IBBoard.WarFoundry.API.Objects;
namespace IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces
{
	/// <summary>
	/// The interface that UI components should implement to represent "Add Equipment" dialogs or system equivalents (e.g. console areas or HTML fragments)
	/// </summary>
	public interface IAddEquipmentUI : IDisposable
	{
		/// <summary>
		/// Should be fired when unit equipment item choice changes.
		/// </summary>
		event SingleArgMethodInvoker<UnitEquipmentItem> UnitEquipmentItemChoiceChanged;
		
		/// <summary>
		/// Sets the equipment items that should be displayed on the form
		/// </summary>
		/// <param name='items'>
		/// The equipment items that should be displayed on the form
		/// </param>
		void SetUnitEquipmentItems(UnitEquipmentItem[] items);
		
		/// <summary>
		/// Sets the limits for the currently selected equipment item
		/// </summary>
		/// <param name='isRatioLimit'>
		/// <code>True</code> if the current limit is a ratio limit, else <code>false</code> for absolute limits
		/// </param>
		/// <param name='minPercent'>
		/// The minimum limit as a percentage
		/// </param>
		/// <param name='maxPercent'>
		/// The maximum limit as a percentage
		/// </param>
		/// <param name='minNumber'>
		/// The minimum number as an absolute figure
		/// </param>
		/// <param name='maxNumber'>
		/// The maximum number as an absolute figure
		/// </param>
		void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber);
		
		/// <summary>
		/// Sets whether the unit equipment limit UI components should be enabled and able to accept input.
		/// </summary>
		/// <param name='isEnabled'>
		/// <code>True</code> if the UI components should accept input, else <code>false</code>
		/// </param>
		void SetUnitEquipmentLimitsEnabled(bool isEnabled);
		
		/// <summary>
		/// Shows the control and awaits a user action (close or okay)
		/// </summary>
		/// <returns>
		/// <code>true</code> if the control was closed with "Okay", else <code>false</code>
		/// </returns>
		bool ShowControl();
		
		/// <summary>
		/// Gets the selected equipment item.
		/// </summary>
		/// <value>
		/// The selected equipment item.
		/// </value>
		UnitEquipmentItem SelectedUnitEquipmentItem { get; }
		
		/// <summary>
		/// Gets a value indicating whether the equipment amount is a ratio or an absolute number.
		/// </summary>
		/// <value>
		/// <c>true</c> if the selected amount is a ratio type (percentage or "all"); otherwise, <c>false</c>.
		/// </value>
		bool IsRatioEquipmentAmount { get; }
		
		/// <summary>
		/// Gets the numeric amount for the current equipment amount. This number is meaningless if <see cref="IsRatioEquipmentAmount"/> is <code>true</code>
		/// </summary>
		/// <value>
		/// The absolue number of items taken.
		/// </value>
		int EquipmentNumericAmount { get; }

		/// <summary>
		/// Gets the percentage amount for the current equipment amount. This number is meaningless if <see cref="IsRatioEquipmentAmount"/> is <code>false</code>
		/// </summary>
		/// <value>
		/// The number of items taken as a percentage of the unit size.
		/// </value>
		double EquipmentPercentageAmount { get; }
	}
}