also, disable the call do BindColumns in
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGridViewTextBoxCell.cs
index 7394d7f18ee2aaceae81bea628f05caf88c6ce14..903fa54e95d5aaff206d6b753d2365613d2cd8e9 100644 (file)
@@ -27,6 +27,7 @@
 #if NET_2_0
 
 using System;
+using System.ComponentModel;
 using System.Drawing;
 
 namespace System.Windows.Forms {
@@ -36,19 +37,22 @@ namespace System.Windows.Forms {
                private int maxInputLength = 32767;
                private static DataGridViewTextBoxEditingControl editingControl;
 
-               static DataGridViewTextBoxCell () {
+               static DataGridViewTextBoxCell ()
+               {
                        editingControl = new DataGridViewTextBoxEditingControl();
                        editingControl.Multiline = false;
                        editingControl.BorderStyle = BorderStyle.None;
                }
 
-               public DataGridViewTextBoxCell () {
+               public DataGridViewTextBoxCell ()
+               {
                }
 
                public override Type FormattedValueType {
                        get { return typeof(string); }
                }
 
+               [DefaultValue (32767)]
                public virtual int MaxInputLength {
                        get { return maxInputLength; }
                        set {
@@ -63,13 +67,16 @@ namespace System.Windows.Forms {
                        get { return typeof(string); }
                }
 
-               public override object Clone () {
+               public override object Clone ()
+               {
                        DataGridViewTextBoxCell result = (DataGridViewTextBoxCell) base.Clone();
                        result.maxInputLength = maxInputLength;
                        return result;
                }
 
-               public override void DetachEditingControl () {
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               public override void DetachEditingControl ()
+               {
                        if (DataGridView == null) {
                                throw new InvalidOperationException("There is no associated DataGridView.");
                        }
@@ -79,7 +86,8 @@ namespace System.Windows.Forms {
                        Console.WriteLine("Detached: ({0}, {1});", RowIndex, ColumnIndex);
                }
 
-               public override void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {
+               public override void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
+               {
                        if (DataGridView == null) {
                                throw new InvalidOperationException("There is no associated DataGridView.");
                        }
@@ -98,11 +106,13 @@ namespace System.Windows.Forms {
                        editingControl.PrepareEditingControlForEdit(true);
                }
 
-               public override bool KeyEntersEditMode (KeyEventArgs e) {
+               public override bool KeyEntersEditMode (KeyEventArgs e)
+               {
                        throw new NotImplementedException();
                }
 
-               public override void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
+               public override void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)
+               {
                        if (setSize) {
                                editingControl.Size = new Size(cellBounds.Width, cellBounds.Height + 2);
                        }
@@ -112,38 +122,40 @@ namespace System.Windows.Forms {
                        editingControl.Invalidate();
                }
 
-               public override string ToString () {
+               public override string ToString ()
+               {
                        return this.GetType().Name;
                }
 
-               protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+               protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
+               {
                        throw new NotImplementedException();
                }
 
-               protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+               protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
+               {
                        throw new NotImplementedException();
                }
 
-               protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+               protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)
+               {
                        throw new NotImplementedException();
                }
 
-               protected override void OnEnter (int rowIndex, bool throughMouseClick) {
+               protected override void OnEnter (int rowIndex, bool throughMouseClick)
+               {
                }
 
-               protected override void OnLeave (int rowIndex, bool throughMouseClick) {
+               protected override void OnLeave (int rowIndex, bool throughMouseClick)
+               {
                }
 
-               protected override void OnMouseClick (DataGridViewCellMouseEventArgs e) {
+               protected override void OnMouseClick (DataGridViewCellMouseEventArgs e)
+               {
                }
 
-               protected override void OnMouseEnter (int rowIndex) {
-               }
-
-               protected override void OnMouseLeave (int rowIndex) {
-               }
-
-               protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+               protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
+               {
                        //////////////////
                        /*
                        Size size = DataGridViewCell.MeasureTextSize(graphics, (string) formattedValue, cellStyle.Font, TextFormatFlags.Default);
@@ -165,10 +177,6 @@ namespace System.Windows.Forms {
                        PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
                }
 
-               protected override void OnDataGridViewChanged () {
-                       editingControl.EditingControlDataGridView = DataGridView;
-               }
-
        }
 
 }