/// <summary>
		/// Registered factory creation method
		/// </summary>
		/// <param name="aArgs">
		/// Arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		public static IMappedColumnItem DefaultFactoryCreate (FactoryInvocationArgs aArgs)
		{
			IMappedColumnItem wdg;
			if (aArgs.State == PropertyDefinition.ReadOnly)
				wdg = new MappedCellRendererPixbuf();
			else
				wdg = new MappedCellRendererPixbuf();
			wdg.MappedTo = aArgs.PropertyName;
			return (wdg);
		}
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IMappedColumnItem wdg;

            if (aArgs.State == PropertyDefinition.ReadOnly)
            {
                wdg = new MappedCellRendererPixbuf();
            }
            else
            {
                wdg = new MappedCellRendererPixbuf();
            }
            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates default widgets for properties which don't specify their property description
        /// </summary>
        /// <param name="aArgs">
        /// Widget creation arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        private static IMappedColumnItem CreateDefaultGtkCellWidget(FactoryInvocationArgs aArgs)
        {
            foreach (CellFactoryInvokerClass invoker in AllCellWidgetsForType(aArgs.PropertyInfo.PropertyType))
            {
                return(invoker.Invoke(aArgs));
            }

            // Silly fallback if registration is not done
            IMappedColumnItem wdg = null;

            switch (aArgs.State)
            {
            case PropertyDefinition.ReadOnly:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new MappedCellRendererText();
                    break;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new MappedCellRendererToggle();
//					(wdg as DataCheckButton).Editable = false;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new MappedCellRendererPixbuf();
                }
                else
                {
                    wdg = new MappedCellRendererText();
                }
                break;

            case PropertyDefinition.ReadWrite:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new MappedCellRendererText();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new MappedCellRendererToggle();
                }
                else if ((aArgs.PropertyInfo.PropertyType == typeof(int)) || (aArgs.PropertyInfo.PropertyType == typeof(float)) || (aArgs.PropertyInfo.PropertyType == typeof(double)))
                {
                    wdg = new MappedCellRendererSpin();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(DateTime))
                {
                    wdg = new MappedCellRendererText();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new MappedCellRendererPixbuf();
                }
                else
                {
                    wdg = new MappedCellRendererText();
                }
                break;
            }
            wdg.MappedTo = aArgs.PropertyName;

            return(wdg);
        }