예제 #1
0
        /// <summary>
        /// Construct a CellEditor for the specified type
        /// </summary>
        /// <param name="p_Type">Cell Type</param>
        /// <param name="p_DefaultValue">Default value of the editor</param>
        /// <param name="p_bAllowNull">Allow null</param>
        /// <param name="p_StandardValues">List of available values or null if there is no available values list</param>
        /// <param name="p_bStandardValueExclusive">Indicates if the p_StandardValue are the unique values supported</param>
        /// <param name="p_TypeConverter">Type converter used for conversion for the specified type</param>
        /// <param name="p_UITypeEditor">UITypeEditor if null must be populated the TypeConverter</param>
        /// <returns></returns>
        public static Cells.Editors.EditorBase Create(Type p_Type,
                                                      object p_DefaultValue,
                                                      bool p_bAllowNull,
                                                      System.Collections.ICollection p_StandardValues,
                                                      bool p_bStandardValueExclusive,
                                                      System.ComponentModel.TypeConverter p_TypeConverter,
                                                      System.Drawing.Design.UITypeEditor p_UITypeEditor)
        {
            Cells.Editors.EditorBase l_Editor;
            if (p_UITypeEditor == null)
            {
                if (p_StandardValues != null)
                {
                    Cells.Editors.ComboBox editCombo = new Cells.Editors.ComboBox(p_Type);
                    l_Editor = editCombo;
                }
                else if (p_TypeConverter != null && p_TypeConverter.CanConvertFrom(typeof(string)))//txtbox
                {
                    Cells.Editors.TextBox l_EditTextBox = new Cells.Editors.TextBox(p_Type);
                    l_Editor = l_EditTextBox;
                }
                else //if no editor no edit support
                {
                    l_Editor = null;
                }
            }
            else //UITypeEditor supported
            {
                Cells.Editors.TextBoxUITypeEditor txtBoxUITypeEditor = new Cells.Editors.TextBoxUITypeEditor(p_Type);

                //[email protected]: Check if Control exists
                if (txtBoxUITypeEditor.Control != null)
                {
                    txtBoxUITypeEditor.Control.UITypeEditor = p_UITypeEditor;
                }
                l_Editor = txtBoxUITypeEditor;
            }

            if (l_Editor != null)
            {
                l_Editor.DefaultValue = p_DefaultValue;
                l_Editor.AllowNull    = p_bAllowNull;
                //l_Editor.CellType = p_Type;
                l_Editor.StandardValues          = p_StandardValues;
                l_Editor.StandardValuesExclusive = p_bStandardValueExclusive;
                l_Editor.TypeConverter           = p_TypeConverter;
            }

            return(l_Editor);
        }
예제 #2
0
 /// <summary>
 /// This allows us to specify the editor that will be used for this
 /// property.  By default the editor from the Point type would be used,
 /// but we overrride this and specify our own, much cooler, editor.
 /// </summary>
 /// <param name="editorBaseType"></param>
 /// <returns></returns>
 public override object GetEditor(Type editorBaseType)
 {
     // make sure we're looking for a UITypeEditor.
     //
     if (editorBaseType == typeof(System.Drawing.Design.UITypeEditor))
     {
         // create and return one of our editors.
         //
         if (editor == null)
         {
             editor = new PointUIEditor(owner.target);
         }
         return(editor);
     }
     return(base.GetEditor(editorBaseType));
 }
예제 #3
0
        /// <summary>
        /// Creates the data model.
        /// Construct a CellEditor for the specified type
        /// </summary>
        /// <param name="p_Type">Cell Type</param>
        /// <param name="p_DefaultValue">Default value of the editor</param>
        /// <param name="p_bAllowNull">Allow null</param>
        /// <param name="p_StandardValues">List of available values or null if there is no available values list</param>
        /// <param name="p_bStandardValueExclusive">Indicates whether the p_StandardValue are the unique values supported</param>
        /// <param name="p_TypeConverter">Type converter used for conversion for the specified type</param>
        /// <param name="p_UITypeEditor">UITypeEditor if null must be populated the TypeConverter</param>
        /// <returns></returns>
        public static DataModels.IDataModel CreateDataModel(Type p_Type,
                                                            object p_DefaultValue,
                                                            bool p_bAllowNull,
                                                            System.Collections.ICollection p_StandardValues,
                                                            bool p_bStandardValueExclusive,
                                                            System.ComponentModel.TypeConverter p_TypeConverter,
                                                            System.Drawing.Design.UITypeEditor p_UITypeEditor)
        {
            DataModels.DataModelBase l_Editor;
            if (p_UITypeEditor == null)
            {
                if (p_StandardValues != null)
                {
                    DataModels.EditorComboBox l_EditCombo = new DataModels.EditorComboBox(p_Type);
                    l_Editor = l_EditCombo;
                }
                else if (p_TypeConverter != null && p_TypeConverter.CanConvertFrom(typeof(string)))//txtbox
                {
                    DataModels.EditorTextBox l_EditTextBox = new DataModels.EditorTextBox(p_Type);
                    l_Editor = l_EditTextBox;
                }
                else // if no editor no edit support
                {
                    l_Editor = null;
                }
            }
            else // UITypeEditor supported
            {
                DataModels.EditorUITypeEditor l_UITypeEditor = new DataModels.EditorUITypeEditor(p_Type, p_UITypeEditor);
                l_Editor = l_UITypeEditor;
            }

            if (l_Editor != null)
            {
                l_Editor.DefaultValue = p_DefaultValue;
                l_Editor.AllowNull    = p_bAllowNull;
                ////l_Editor.CellType = p_Type;
                l_Editor.StandardValues          = p_StandardValues;
                l_Editor.StandardValuesExclusive = p_bStandardValueExclusive;
                l_Editor.TypeConverter           = p_TypeConverter;
            }

            return(l_Editor);
        }
예제 #4
0
 public PropertyUITypeEditorFeel(System.Drawing.Design.UITypeEditor editor, PropertyGrid grid)
     : base(grid)
 {
     _editor = editor;
 }
 public PropertyUITypeEditorFeel(System.Drawing.Design.UITypeEditor editor, PropertyGrid grid)
     : base(grid)
 {
     _editor = editor;
 }