diff options
author | Jordi Mas i Hernandez <jordi@mono-cvs.ximian.com> | 2005-06-13 12:29:04 +0400 |
---|---|---|
committer | Jordi Mas i Hernandez <jordi@mono-cvs.ximian.com> | 2005-06-13 12:29:04 +0400 |
commit | 686d5ab039aaf9959ed11fca8256970cb07ccfb3 (patch) | |
tree | cfa940ca8d763eaffddf757078d9c5dcfd031f67 /mcs | |
parent | 5bae22829e8bfd7ba63143c08d21e1b97d0af16f (diff) |
2005-06-13 Jordi Mas i Hernandez <jordi@ximian.com>
* DataGrid.cs: implement missing methods, move KeyboardNavigation
* DataGridColumnStyle.cs: fixes signature
svn path=/trunk/mcs/; revision=45855
Diffstat (limited to 'mcs')
3 files changed, 123 insertions, 114 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 965430e1a18..8ba6a4e7d6a 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,8 @@ +2005-06-13 Jordi Mas i Hernandez <jordi@ximian.com> + + * DataGrid.cs: implement missing methods, move KeyboardNavigation + * DataGridColumnStyle.cs: fixes signature + 2005-06-12 Jackson Harper <jackson@ximian.com> * XplatUIX11.cs: Use sizing cursors similar to the ones on diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs index 5777c2289fa..6c994b9f42c 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs @@ -178,6 +178,7 @@ namespace System.Windows.Forms private Hashtable selected_rows; private bool ctrl_pressed; private bool shift_pressed; + private bool begininit; #endregion // Local Variables #region Public Constructors @@ -186,6 +187,7 @@ namespace System.Windows.Forms grid_drawing = new DataGridDrawing (this); allow_navigation = true; allow_sorting = true; + begininit = false; alternating_backcolor = def_alternating_backcolor; background_color = def_background_color; border_style = BorderStyle.Fixed3D; @@ -640,21 +642,23 @@ namespace System.Windows.Forms public object this [DataGridCell cell] { get { - throw new NotImplementedException (); + return this [cell.RowNumber, cell.ColumnNumber]; } set { - throw new NotImplementedException (); + this [cell.RowNumber, cell.ColumnNumber] = value; } } public object this [int rowIndex, int columnIndex] { get { - throw new NotImplementedException (); + return CurrentTableStyle.GridColumnStyles[columnIndex].GetColumnValueAtRow (ListManager, + rowIndex); } set { - throw new NotImplementedException (); + CurrentTableStyle.GridColumnStyles[columnIndex].SetColumnValueAtRow (ListManager, + rowIndex, value); } } @@ -967,17 +971,17 @@ namespace System.Windows.Forms #region Public Instance Methods + [MonoTODO] public virtual bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber) { - throw new NotImplementedException (); + return false; } public virtual void BeginInit () { - + begininit = true; } - protected virtual void CancelEditing () { CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber].Abort (current_cell.RowNumber); @@ -986,6 +990,7 @@ namespace System.Windows.Forms InvalidateCurrentRowHeader (); } + [MonoTODO] public void Collapse (int row) { @@ -1013,7 +1018,7 @@ namespace System.Windows.Forms protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault) { - throw new NotImplementedException (); + return CreateGridColumn (prop, isDefault); } protected override void Dispose (bool disposing) @@ -1041,7 +1046,7 @@ namespace System.Windows.Forms public virtual void EndInit () { - + begininit = false; } public void Expand (int row) @@ -1066,7 +1071,7 @@ namespace System.Windows.Forms protected virtual string GetOutputTextDelimiter () { - throw new NotImplementedException (); + return string.Empty; } protected virtual void GridHScrolled (object sender, ScrollEventArgs se) @@ -1113,11 +1118,13 @@ namespace System.Windows.Forms return selected_rows[row] != null; } + [MonoTODO] public void NavigateBack () { } + [MonoTODO] public void NavigateTo (int rowNumber, string relationName) { @@ -1219,8 +1226,8 @@ namespace System.Windows.Forms protected override void OnKeyDown (KeyEventArgs ke) { base.OnKeyDown (ke); - - if (KeyboardNavigation (ke.KeyCode) == true) { + + if (ProcessGridKey (ke) == true) { ke.Handled = true; } @@ -1390,23 +1397,116 @@ namespace System.Windows.Forms protected bool ProcessGridKey (KeyEventArgs ke) { - throw new NotImplementedException (); + if (RowsCount == 0) { + return false; + } + + switch (ke.KeyCode) { + case Keys.ControlKey: + ctrl_pressed = true; + break; + case Keys.ShiftKey: + shift_pressed = true; + break; + case Keys.Up: + { + if (current_cell.RowNumber > 0) { + CurrentCell = new DataGridCell (current_cell.RowNumber - 1, current_cell.ColumnNumber); + EditCell (current_cell); + } + break; + } + case Keys.Down: + { + if (current_cell.RowNumber < RowsCount - 1) { + CurrentCell = new DataGridCell (current_cell.RowNumber + 1, current_cell.ColumnNumber); + EditCell (current_cell); + } + break; + } + case Keys.Right: + { + if (current_cell.ColumnNumber + 1 < CurrentTableStyle.GridColumnStyles.Count) { + CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber + 1); + EditCell (current_cell); + } + break; + } + case Keys.Left: + { + if (current_cell.ColumnNumber > 0) { + CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber - 1); + EditCell (current_cell); + } + break; + } + case Keys.PageUp: + { + if (current_cell.RowNumber > grid_drawing.VLargeChange) { + CurrentCell = new DataGridCell (current_cell.RowNumber - grid_drawing.VLargeChange, current_cell.ColumnNumber); + } else { + CurrentCell = new DataGridCell (0, current_cell.ColumnNumber); + } + + EditCell (current_cell); + break; + } + case Keys.PageDown: + { + if (current_cell.RowNumber + grid_drawing.VLargeChange < RowsCount) { + CurrentCell = new DataGridCell (current_cell.RowNumber + grid_drawing.VLargeChange, current_cell.ColumnNumber); + } else { + CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber); + } + + EditCell (current_cell); + break; + } + case Keys.Home: + { + CurrentCell = new DataGridCell (0, current_cell.ColumnNumber); + EditCell (current_cell); + break; + } + case Keys.End: + { + CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber); + EditCell (current_cell); + break; + } + case Keys.Delete: + { + ICollection keys = selected_rows.Keys; + foreach (int row in selected_rows.Keys) { + ListManager.RemoveAt (row); + } + selected_rows.Clear (); + CalcAreasAndInvalidate (); + break; + } + default: + return false; // message not processed + } + + return true; // message processed } // Called from DataGridTextBox protected override bool ProcessKeyPreview (ref Message m) { Keys key = (Keys) m.WParam.ToInt32 (); - if (KeyboardNavigation (key) == true) { + KeyEventArgs ke = new KeyEventArgs (key); + if (ProcessGridKey (ke) == true) { return true; } return base.ProcessKeyPreview (ref m); } + [MonoTODO] protected bool ProcessTabKey (Keys keyData) { - throw new NotImplementedException (); + return false; } public void ResetAlternatingBackColor () @@ -1586,102 +1686,6 @@ namespace System.Windows.Forms Invalidate (); } - internal bool KeyboardNavigation (Keys key) - { - if (RowsCount == 0) { - return false; - } - - switch (key) { - case Keys.ControlKey: - ctrl_pressed = true; - break; - case Keys.ShiftKey: - shift_pressed = true; - break; - case Keys.Up: - { - if (current_cell.RowNumber > 0) { - CurrentCell = new DataGridCell (current_cell.RowNumber - 1, current_cell.ColumnNumber); - EditCell (current_cell); - } - break; - } - case Keys.Down: - { - if (current_cell.RowNumber < RowsCount - 1) { - CurrentCell = new DataGridCell (current_cell.RowNumber + 1, current_cell.ColumnNumber); - EditCell (current_cell); - } - break; - } - case Keys.Right: - { - if (current_cell.ColumnNumber + 1 < CurrentTableStyle.GridColumnStyles.Count) { - CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber + 1); - EditCell (current_cell); - } - break; - } - case Keys.Left: - { - if (current_cell.ColumnNumber > 0) { - CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber - 1); - EditCell (current_cell); - } - break; - } - case Keys.PageUp: - { - if (current_cell.RowNumber > grid_drawing.VLargeChange) { - CurrentCell = new DataGridCell (current_cell.RowNumber - grid_drawing.VLargeChange, current_cell.ColumnNumber); - } else { - CurrentCell = new DataGridCell (0, current_cell.ColumnNumber); - } - - EditCell (current_cell); - break; - } - case Keys.PageDown: - { - if (current_cell.RowNumber + grid_drawing.VLargeChange < RowsCount) { - CurrentCell = new DataGridCell (current_cell.RowNumber + grid_drawing.VLargeChange, current_cell.ColumnNumber); - } else { - CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber); - } - - EditCell (current_cell); - break; - } - case Keys.Home: - { - CurrentCell = new DataGridCell (0, current_cell.ColumnNumber); - EditCell (current_cell); - break; - } - case Keys.End: - { - CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber); - EditCell (current_cell); - break; - } - case Keys.Delete: - { - ICollection keys = selected_rows.Keys; - foreach (int row in selected_rows.Keys) { - ListManager.RemoveAt (row); - } - selected_rows.Clear (); - CalcAreasAndInvalidate (); - break; - } - default: - return false; // message not processed - } - - return true; // message processed - } - // EndEdit current editing operation public virtual bool EndEdit (bool shouldAbort) { diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs index 0e82253d015..498de6612fe 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs @@ -118,8 +118,8 @@ namespace System.Windows.Forms private PropertyDescriptor property_descriptor; private bool read_only; private int width; - protected bool is_default; - internal protected DataGrid grid; + internal bool is_default; + internal DataGrid grid; private DataGridColumnHeaderAccessibleObject accesible_object; private StringFormat string_format_hdr; #endregion // Local Variables @@ -475,7 +475,7 @@ namespace System.Windows.Forms virtual internal void OnMouseDown (MouseEventArgs e, int row, int column) {} virtual internal void OnKeyDown (KeyEventArgs ke, int row, int column) {} - protected internal void PaintHeader (Graphics g, Rectangle bounds, int colNum) + internal void PaintHeader (Graphics g, Rectangle bounds, int colNum) { // Background g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.DataGrid.ParentRowsBackColor), |