public DataGridRowAccessibleObject(DataGridRow owner)
 {
     this.owner = owner;
     System.Windows.Forms.DataGrid dataGrid = this.DataGrid;
     this.EnsureChildren();
 }
Example #2
0
 public DataGridRowAccessibleObject(DataGridRow owner)
 {
     this.owner = owner;
     System.Windows.Forms.DataGrid dataGrid = this.DataGrid;
     this.EnsureChildren();
 }
 public DataGridCellAccessibleObject(DataGridRow owner, int column)
 {
     this.owner = owner;
     this.column = column;
 }
 protected internal virtual void ColumnStartedEditing(Rectangle bounds)
 {
     DataGridRow[] dataGridRows = this.DataGridRows;
     if ((bounds.IsEmpty && (this.editColumn is DataGridTextBoxColumn)) && ((this.currentRow != -1) && (this.currentCol != -1)))
     {
         DataGridTextBoxColumn editColumn = this.editColumn as DataGridTextBoxColumn;
         Rectangle cellBounds = this.GetCellBounds(this.currentRow, this.currentCol);
         this.gridState[0x10000] = true;
         try
         {
             editColumn.TextBox.Bounds = cellBounds;
         }
         finally
         {
             this.gridState[0x10000] = false;
         }
     }
     if (this.gridState[0x100000])
     {
         int dataGridRowsLength = this.DataGridRowsLength;
         DataGridRow[] newRows = new DataGridRow[dataGridRowsLength + 1];
         for (int i = 0; i < dataGridRowsLength; i++)
         {
             newRows[i] = dataGridRows[i];
         }
         newRows[dataGridRowsLength] = new DataGridAddNewRow(this, this.myGridTable, dataGridRowsLength);
         this.SetDataGridRows(newRows, dataGridRowsLength + 1);
         this.Edit();
         this.gridState[0x100000] = false;
         this.gridState[0x8000] = true;
         this.gridState[0x4000] = false;
     }
     else
     {
         this.gridState[0x8000] = true;
         this.gridState[0x4000] = false;
         this.InvalidateRowHeader(this.currentRow);
         dataGridRows[this.currentRow].LoseChildFocus(this.layout.RowHeaders, this.isRightToLeft());
     }
 }
Example #5
0
 public DataGridCellAccessibleObject(DataGridRow owner, int column)
 {
     this.owner  = owner;
     this.column = column;
 }
 public DataGridRelationshipRowAccessibleObject(DataGridRow owner) : base(owner)
 {
 }
 private void CreateDataGridRows()
 {
     CurrencyManager listManager = this.ListManager;
     DataGridTableStyle myGridTable = this.myGridTable;
     this.InitializeColumnWidths();
     if (listManager == null)
     {
         this.SetDataGridRows(new DataGridRow[0], 0);
     }
     else
     {
         int count = listManager.Count;
         if (this.policy.AllowAdd)
         {
             count++;
         }
         DataGridRow[] newRows = new DataGridRow[count];
         for (int i = 0; i < listManager.Count; i++)
         {
             newRows[i] = new DataGridRelationshipRow(this, myGridTable, i);
         }
         if (this.policy.AllowAdd)
         {
             this.addNewRow = new DataGridAddNewRow(this, myGridTable, count - 1);
             newRows[count - 1] = this.addNewRow;
         }
         else
         {
             this.addNewRow = null;
         }
         this.SetDataGridRows(newRows, count);
     }
 }
 internal void NavigateTo(string relationName, DataGridRow source, bool fromRow)
 {
     if (this.AllowNavigation && this.CommitEdit())
     {
         DataGridState state;
         try
         {
             state = this.CreateChildState(relationName, source);
         }
         catch
         {
             this.NavigateBack();
             return;
         }
         try
         {
             this.listManager.EndCurrentEdit();
         }
         catch
         {
             return;
         }
         DataGridState dgs = new DataGridState(this) {
             LinkingRow = source
         };
         if (source.RowNumber != this.CurrentRow)
         {
             this.listManager.Position = source.RowNumber;
         }
         if (this.parentRows.GetTopParent() == null)
         {
             this.originalState = dgs;
         }
         this.parentRows.AddParent(dgs);
         this.NavigateTo(state);
         this.OnNavigate(new NavigateEventArgs(true));
     }
 }
 internal void OnRowHeightChanged(DataGridRow row)
 {
     this.ClearRegionCache();
     int rowTop = this.GetRowTop(row.RowNumber);
     if (rowTop > 0)
     {
         Rectangle rc = new Rectangle {
             Y = rowTop,
             X = this.layout.Inside.X,
             Width = this.layout.Inside.Width,
             Height = this.layout.Inside.Bottom - rowTop
         };
         base.Invalidate(rc);
     }
 }
 internal Rectangle GetRowBounds(DataGridRow row)
 {
     return new Rectangle { Y = this.GetRowTop(row.RowNumber), X = this.layout.Data.X, Height = row.Height, Width = this.layout.Data.Width };
 }
 public void NavigateBack()
 {
     if (this.CommitEdit() && !this.parentRows.IsEmpty())
     {
         if (this.gridState[0x100000])
         {
             this.gridState[0x100000] = false;
             try
             {
                 this.listManager.CancelCurrentEdit();
             }
             catch
             {
             }
         }
         else
         {
             this.UpdateListManager();
         }
         DataGridState state = this.parentRows.PopTop();
         this.ResetMouseState();
         state.PullState(this, false);
         if (this.parentRows.GetTopParent() == null)
         {
             this.originalState = null;
         }
         DataGridRow[] dataGridRows = this.DataGridRows;
         if ((this.ReadOnly || !this.policy.AllowAdd) == (dataGridRows[this.DataGridRowsLength - 1] is DataGridAddNewRow))
         {
             int num = (this.ReadOnly || !this.policy.AllowAdd) ? (this.DataGridRowsLength - 1) : (this.DataGridRowsLength + 1);
             DataGridRow[] newRows = new DataGridRow[num];
             for (int i = 0; i < Math.Min(num, this.DataGridRowsLength); i++)
             {
                 newRows[i] = this.DataGridRows[i];
             }
             if (!this.ReadOnly && this.policy.AllowAdd)
             {
                 newRows[num - 1] = new DataGridAddNewRow(this, this.myGridTable, num - 1);
             }
             this.SetDataGridRows(newRows, num);
         }
         dataGridRows = this.DataGridRows;
         if (((dataGridRows != null) && (dataGridRows.Length != 0)) && (dataGridRows[0].DataGridTableStyle != this.myGridTable))
         {
             for (int j = 0; j < dataGridRows.Length; j++)
             {
                 dataGridRows[j].DataGridTableStyle = this.myGridTable;
             }
         }
         if ((this.myGridTable.GridColumnStyles.Count > 0) && (this.myGridTable.GridColumnStyles[0].Width == -1))
         {
             this.InitializeColumnWidths();
         }
         this.currentRow = (this.ListManager.Position == -1) ? 0 : this.ListManager.Position;
         if (!this.AllowNavigation)
         {
             this.RecreateDataGridRows();
         }
         this.caption.BackButtonActive = (this.parentRows.GetTopParent() != null) && this.AllowNavigation;
         this.caption.BackButtonVisible = this.caption.BackButtonActive;
         this.caption.DownButtonActive = this.parentRows.GetTopParent() != null;
         base.PerformLayout();
         base.Invalidate();
         if (this.vertScrollBar.Visible)
         {
             this.vertScrollBar.Value = this.firstVisibleRow;
         }
         if (this.horizScrollBar.Visible)
         {
             this.horizScrollBar.Value = this.HorizontalOffset + this.negOffset;
         }
         this.Edit();
         this.OnNavigate(new NavigateEventArgs(false));
     }
 }
 private void Edit(string displayText)
 {
     this.EnsureBound();
     bool cellIsVisible = true;
     this.EndEdit();
     DataGridRow[] dataGridRows = this.DataGridRows;
     if (this.DataGridRowsLength != 0)
     {
         dataGridRows[this.currentRow].OnEdit();
         this.editRow = dataGridRows[this.currentRow];
         if (this.myGridTable.GridColumnStyles.Count != 0)
         {
             this.editColumn = this.myGridTable.GridColumnStyles[this.currentCol];
             if (this.editColumn.PropertyDescriptor != null)
             {
                 Rectangle empty = Rectangle.Empty;
                 if (((this.currentRow < this.firstVisibleRow) || (this.currentRow > (this.firstVisibleRow + this.numVisibleRows))) || (((this.currentCol < this.firstVisibleCol) || (this.currentCol > ((this.firstVisibleCol + this.numVisibleCols) - 1))) || ((this.currentCol == this.firstVisibleCol) && (this.negOffset != 0))))
                 {
                     cellIsVisible = false;
                 }
                 else
                 {
                     empty = this.GetCellBounds(this.currentRow, this.currentCol);
                 }
                 this.gridState[0x4000] = true;
                 this.gridState[0x8000] = false;
                 this.gridState[0x10000] = true;
                 this.editColumn.Edit(this.ListManager, this.currentRow, empty, (this.myGridTable.ReadOnly || this.ReadOnly) || !this.policy.AllowEdit, displayText, cellIsVisible);
                 this.gridState[0x10000] = false;
             }
         }
     }
 }
 private void DeleteRows(DataGridRow[] localGridRows)
 {
     int deletedRows = 0;
     int num2 = (this.listManager == null) ? 0 : this.listManager.Count;
     if (base.Visible)
     {
         base.BeginUpdateInternal();
     }
     try
     {
         if (this.ListManager != null)
         {
             for (int i = 0; i < this.DataGridRowsLength; i++)
             {
                 if (localGridRows[i].Selected)
                 {
                     if (localGridRows[i] is DataGridAddNewRow)
                     {
                         localGridRows[i].Selected = false;
                     }
                     else
                     {
                         this.ListManager.RemoveAt(i - deletedRows);
                         deletedRows++;
                     }
                 }
             }
         }
     }
     catch
     {
         this.RecreateDataGridRows();
         this.gridState[0x400] = false;
         if (base.Visible)
         {
             base.EndUpdateInternal();
         }
         throw;
     }
     if ((this.listManager != null) && (num2 == (this.listManager.Count + deletedRows)))
     {
         this.DeleteDataGridRows(deletedRows);
     }
     else
     {
         this.RecreateDataGridRows();
     }
     this.gridState[0x400] = false;
     if (base.Visible)
     {
         base.EndUpdateInternal();
     }
     if ((this.listManager != null) && (num2 != (this.listManager.Count + deletedRows)))
     {
         base.Invalidate();
     }
 }
 private void DeleteDataGridRows(int deletedRows)
 {
     if (deletedRows != 0)
     {
         int dataGridRowsLength = this.DataGridRowsLength;
         int newRowsLength = (dataGridRowsLength - deletedRows) + (this.gridState[0x100000] ? 1 : 0);
         DataGridRow[] newRows = new DataGridRow[newRowsLength];
         DataGridRow[] dataGridRows = this.DataGridRows;
         int num3 = 0;
         for (int i = 0; i < dataGridRowsLength; i++)
         {
             if (dataGridRows[i].Selected)
             {
                 num3++;
             }
             else
             {
                 newRows[i - num3] = dataGridRows[i];
                 newRows[i - num3].number = i - num3;
             }
         }
         if (this.gridState[0x100000])
         {
             newRows[dataGridRowsLength - num3] = new DataGridAddNewRow(this, this.myGridTable, dataGridRowsLength - num3);
             this.gridState[0x100000] = false;
         }
         this.SetDataGridRows(newRows, newRowsLength);
     }
 }
Example #15
0
            public DataGridRowAccessibleObject(DataGridRow owner) : base() {
                Debug.Assert(owner != null, "DataGridRowAccessibleObject must have a valid owner DataGridRow");
                this.owner = owner;
                DataGrid grid = DataGrid;
                Debug.WriteLineIf(DataGrid.DataGridAcc.TraceVerbose, "Create row accessible object");

                EnsureChildren();
            }
 private void AbortEdit()
 {
     this.gridState[0x10000] = true;
     this.editColumn.Abort(this.editRow.RowNumber);
     this.gridState[0x10000] = false;
     this.gridState[0x8000] = false;
     this.editRow = null;
     this.editColumn = null;
 }
Example #17
0
 public DataGridCellAccessibleObject(DataGridRow owner, int column) : base() {
     Debug.Assert(owner != null, "DataGridColumnAccessibleObject must have a valid owner DataGridRow");
     this.owner = owner;
     this.column = column;
     Debug.WriteLineIf(DataGrid.DataGridAcc.TraceVerbose, "Create cell accessible object");
 }
 internal void SetDataGridRows(DataGridRow[] newRows, int newRowsLength)
 {
     this.dataGridRows = newRows;
     this.dataGridRowsLength = newRowsLength;
     this.vertScrollBar.Maximum = Math.Max(0, this.DataGridRowsLength - 1);
     if (this.firstVisibleRow > newRowsLength)
     {
         this.vertScrollBar.Value = 0;
         this.firstVisibleRow = 0;
     }
     this.ResetUIState();
 }
Example #19
0
 public DataGridRelationshipRowAccessibleObject(DataGridRow owner) : base(owner)
 {
 }
 private DataGridState CreateChildState(string relationName, DataGridRow source)
 {
     string str;
     DataGridState state = new DataGridState();
     if (string.IsNullOrEmpty(this.DataMember))
     {
         str = relationName;
     }
     else
     {
         str = this.DataMember + "." + relationName;
     }
     CurrencyManager manager = (CurrencyManager) this.BindingContext[this.DataSource, str];
     state.DataSource = this.DataSource;
     state.DataMember = str;
     state.ListManager = manager;
     state.DataGridRows = null;
     state.DataGridRowsLength = manager.Count + (this.policy.AllowAdd ? 1 : 0);
     return state;
 }