2009-01-09 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Fri, 9 Jan 2009 19:46:31 +0000 (19:46 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Fri, 9 Jan 2009 19:46:31 +0000 (19:46 -0000)
* DataGridViewCheckBoxCell.cs: Respect the ReadOnly state of the Cell.

svn path=/trunk/mcs/; revision=122933

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs

index 0d3f525648faa211cb826e2d791ad3d10a1e062a..2e09c2583f1d45cd7d554712db45cecb0a2732cb 100644 (file)
@@ -1,3 +1,7 @@
+2009-01-09  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridViewCheckBoxCell.cs: Respect the ReadOnly state of the Cell.
+
 2009-01-09  Ivan N. Zlatev  <contact@i-nz.net>
 
        * DataGridView.cs: Track the Position in the CurrencyManager.
index 81a5d2084cf2c624bbaae2c003159e7747cb632e..ee888915b02ba9bdfef47c457b4a7c03555a75e9 100644 (file)
@@ -287,6 +287,9 @@ namespace System.Windows.Forms {
 
                protected override void OnContentClick (DataGridViewCellEventArgs e)
                {
+                       if (ReadOnly)
+                               return;
+
                        if (!IsInEditMode)
                                DataGridView.BeginEdit (false);
                                
@@ -316,7 +319,7 @@ namespace System.Windows.Forms {
                protected override void OnKeyDown (KeyEventArgs e, int rowIndex)
                {
                        // when activated by the SPACE key, this method updates the cell's user interface
-                       if ((e.KeyData & Keys.Space) == Keys.Space) {
+                       if (!ReadOnly && (e.KeyData & Keys.Space) == Keys.Space) {
                                check_state = PushButtonState.Pressed;
                                DataGridView.InvalidateCell (this);
                        }
@@ -325,7 +328,7 @@ namespace System.Windows.Forms {
                protected override void OnKeyUp (KeyEventArgs e, int rowIndex)
                {
                        // when activated by the SPACE key, this method updates the cell's user interface
-                       if ((e.KeyData & Keys.Space) == Keys.Space) {
+                       if (!ReadOnly && (e.KeyData & Keys.Space) == Keys.Space) {
                                check_state = PushButtonState.Normal;
                                DataGridView.InvalidateCell (this);
                        }
@@ -333,7 +336,7 @@ namespace System.Windows.Forms {
 
                protected override void OnLeave (int rowIndex, bool throughMouseClick)
                {
-                       if (check_state != PushButtonState.Normal) {
+                       if (!ReadOnly && check_state != PushButtonState.Normal) {
                                check_state = PushButtonState.Normal;
                                DataGridView.InvalidateCell (this);
                        }
@@ -342,7 +345,7 @@ namespace System.Windows.Forms {
                protected override void OnMouseDown (DataGridViewCellMouseEventArgs e)
                {
                        // if activated by depresing the left mouse button, this method updates the cell's user interface
-                       if ((e.Button & MouseButtons.Left) == MouseButtons.Left) {
+                       if (!ReadOnly && (e.Button & MouseButtons.Left) == MouseButtons.Left) {
                                check_state = PushButtonState.Pressed;
                                DataGridView.InvalidateCell (this);
                        }
@@ -351,7 +354,7 @@ namespace System.Windows.Forms {
                protected override void OnMouseLeave (int rowIndex)
                {
                        // if the cell's button is not in its normal state, this method causes the cell's user interface to be updated.
-                       if (check_state != PushButtonState.Normal) {
+                       if (!ReadOnly && check_state != PushButtonState.Normal) {
                                check_state = PushButtonState.Normal;
                                DataGridView.InvalidateCell (this);
                        }
@@ -359,7 +362,7 @@ namespace System.Windows.Forms {
 
                protected override void OnMouseMove (DataGridViewCellMouseEventArgs e)
                {
-                       if (check_state != PushButtonState.Normal && check_state != PushButtonState.Hot) {
+                       if (!ReadOnly && check_state != PushButtonState.Normal && check_state != PushButtonState.Hot) {
                                check_state = PushButtonState.Hot;
                                DataGridView.InvalidateCell (this);
                        }
@@ -368,7 +371,7 @@ namespace System.Windows.Forms {
                protected override void OnMouseUp (DataGridViewCellMouseEventArgs e)
                {
                        // if activated by the left mouse button, this method updates the cell's user interface
-                       if ((e.Button & MouseButtons.Left) == MouseButtons.Left) {
+                       if (!ReadOnly && (e.Button & MouseButtons.Left) == MouseButtons.Left) {
                                check_state = PushButtonState.Normal;
                                DataGridView.InvalidateCell (this);
                        }