

using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using Gtk;

using Hiperscan.Unix;
using Hiperscan.Extensions;


namespace Hiperscan.Extensions.UserDefinedPlotType
{

	public class Plugin : IPlugin
	{
		public static readonly string name    = Catalog.GetString("User Defined Plot Types");
		public static readonly string version = "1.0.0";
		public static readonly string vendor  = "Hiperscan GmbH";
		public static readonly string description = Catalog.GetString("Provides user defined plot types");
		public static readonly Guid guid = new Guid("24ee5140-1ca3-11e0-ac64-0800200c9a66");
		public static readonly string PlotDefinitionFile = "user_defined_plot_type.xml";
		
		internal static List<UserDefinedPlotTypeInfo> plot_type_infos = new List<UserDefinedPlotTypeInfo>();
		
		internal static IHost host;
		private bool active = true;
		private MenuInfo[] menu_infos;
		
		public Plugin ()
		{
			MenuInfo menu_info = new MenuInfo(Catalog.GetString("User-defined plot types"));

			menu_info.Invoked += delegate(object sender, EventArgs e) {
				new UserDefinedPlotDialog();
			};
			
			this.menu_infos = new MenuInfo[] {menu_info};
		}
		
		public void ReplaceGui()
		{
		}
		
		public MenuInfo[] MenuInfos
		{
			get { return this.menu_infos; }
		}
		
		public ToolbarInfo[] ToolbarInfos
		{
			get { return null; }
		}
		
		public PlotTypeInfo[] PlotTypeInfos
		{
			get { return Plugin.plot_type_infos.ToArray(); }
		}

		public FileTypeInfo[] FileTypeInfos
		{
			get { return null; }
		}

		public void Initialize(IHost host)
		{
			Plugin.host = host;

			UserDefinedPlotDialog.InitPlotTypeInfos();
		}
		
		public string Name
		{
			get { return Plugin.name; }
		}
		
		public string Version
		{
			get { return Plugin.version; }
		}
		
		public string Vendor
		{
			get { return Plugin.vendor; }
		}

		public Assembly Assembly
		{
			get { return Assembly.GetExecutingAssembly(); }
		}

		public string Description
		{
			get { return Plugin.description; }
		}
		
		public Guid Guid
		{
			get { return Plugin.guid; }
		}
		
		public bool Active
		{
			get { return this.active;  }
			set { this.active = value; }
		}

		public bool CanReplaceGui
		{
			get { return false; }
		}
	}
}
