Exemplo n.º 1
0
 /// <summary>
 /// Raises the RowPropertyChanged event
 /// </summary>
 /// <param name="e">A RowEventArgs that contains the event data</param>
 internal void OnRowPropertyChanged(RowEventArgs e)
 {
     if (this.Table != null)
     {
         this.Table.OnRowPropertyChanged(e);
     }
 }
		/// <summary>
		/// Raises the CellRemoved event
		/// </summary>
		/// <param name="e">A RowEventArgs that contains the event data</param>
		protected virtual void OnCellRemoved(RowEventArgs e)
		{
			this.owner.OnCellRemoved(e);
		}
Exemplo n.º 3
0
 /// <summary>
 /// Raises the CellRemoved event
 /// </summary>
 /// <param name="e">A RowEventArgs that contains the event data</param>
 internal void OnCellRemoved(RowEventArgs e)
 {
     if (this.Table != null)
     {
         this.Table.OnCellRemoved(e);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Raises the CellAdded event
        /// </summary>
        /// <param name="e">A RowEventArgs that contains the event data</param>
        protected internal virtual void OnCellAdded(RowEventArgs e)
        {
            e.SetRowIndex(this.Index);

            e.Cell.InternalRow = this;
            e.Cell.InternalIndex = e.CellFromIndex;
            e.Cell.SetSelected(false);

            this.UpdateCellIndicies(e.CellFromIndex);

            if (e.Cell.WordWrap)
                UpdateWordWrapProperties(e.Cell);

            if (this.CanRaiseEvents)
            {
                if (this.TableModel != null)
                {
                    this.TableModel.OnCellAdded(e);
                }

                if (CellAdded != null)
                {
                    CellAdded(this, e);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Raises the CellRemoved event
        /// </summary>
        /// <param name="e">A RowEventArgs that contains the event data</param>
        protected internal virtual void OnCellRemoved(RowEventArgs e)
        {
            e.SetRowIndex(this.Index);

            if (e.Cell != null)
            {
                if (e.Cell.Row == this)
                {
                    e.Cell.InternalRow = null;
                    e.Cell.InternalIndex = -1;

                    if (e.Cell.Selected)
                    {
                        e.Cell.SetSelected(false);

                        this.InternalSelectedCellCount--;

                        if (this.SelectedCellCount == 0 && this.TableModel != null)
                        {
                            this.TableModel.Selections.RemoveRow(this);
                        }
                    }
                }
            }
            else
            {
                if (e.CellFromIndex == -1 && e.CellToIndex == -1)
                {
                    if (this.SelectedCellCount != 0 && this.TableModel != null)
                    {
                        this.InternalSelectedCellCount = 0;

                        this.TableModel.Selections.RemoveRow(this);
                    }
                }
            }

            this.UpdateCellIndicies(e.CellFromIndex);

            if (this.CanRaiseEvents)
            {
                if (this.TableModel != null)
                {
                    this.TableModel.OnCellRemoved(e);
                }

                if (CellRemoved != null)
                {
                    CellRemoved(this, e);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Raises the SubRowRemoved event
        /// </summary>
        /// <param name="e"></param>
        protected internal virtual void OnSubRowRemoved(RowEventArgs e)
        {
            this.TableModel.Rows.Remove(e.Row);

            if (SubRowRemoved != null)
            {
                SubRowRemoved(this, e);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Raises the PropertyChanged event
        /// </summary>
        /// <param name="e">A RowEventArgs that contains the event data</param>
        protected virtual void OnPropertyChanged(RowEventArgs e)
        {
            e.SetRowIndex(this.Index);

            if (this.CanRaiseEvents)
            {
                if (PropertyChanged != null)
                    PropertyChanged(this, e);

                if (this.TableModel != null)
                    this.TableModel.OnRowPropertyChanged(e);
            }
        }
Exemplo n.º 8
0
        private void row_PropertyChanged(object sender, RowEventArgs e)
        {
            if (e.EventType == RowEventType.ExpandSubRowsChanged)
            {
                if (!e.Row.ExpandSubRows)
                    _totalHiddenSubRows += e.Row.SubRows.Count;
                else
                    _totalHiddenSubRows -= e.Row.SubRows.Count;

            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Raises the SubRowAdded event
        /// </summary>
        /// <param name="e"></param>
        protected internal virtual void OnSubRowAdded(RowEventArgs e)
        {
            // Add doesn specify the index, Insert does
            int childIndex = e.Index > -1 ? e.Index + 1 : e.ParentRow.SubRows.Count;

            this.TableModel.Rows.Insert(e.ParentRow.Index + childIndex, e.Row);

            if (SubRowAdded != null)
            {
                SubRowAdded(this, e);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Inserts a Row into the collection at the specified index
        /// </summary>
        /// <param name="index">The zero-based index at which the Row 
        /// should be inserted</param>
        /// <param name="row">The Row to insert</param>
        public void Insert(int index, Row row)
        {
            if (row == null)
            {
                return;
            }

            if (index < 0)
            {
                throw new IndexOutOfRangeException();
            }

            if (index >= this.Count)
            {
                this.Add(row);
            }
            else
            {
                base.List.Insert(index, row);

                if (owner != null)
                    this.owner.OnRowAdded(new TableModelEventArgs(this.owner, row, index, index));

                else if (rowowner != null)
                {
                    RowEventArgs args = new RowEventArgs(row, RowEventType.SubRowAdded, rowowner);
                    args.SetRowIndex(index);
                    this.OnRowAdded(args);
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Raises the RowRemoved event
 /// </summary>
 /// <param name="e">A TableModelEventArgs that contains the event data</param>
 protected virtual void OnRowRemoved(RowEventArgs e)
 {
     this.rowowner.OnSubRowRemoved(e);
 }
Exemplo n.º 12
0
		/// <summary>
		/// Raises the CellRemoved event
		/// </summary>
		/// <param name="e">A RowEventArgs that contains the event data</param>
		protected internal virtual void OnCellRemoved(RowEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				this.InvalidateRow(e.Index);

				if (CellRemoved != null)
				{
					CellRemoved(this, e);
				}

				if (e.CellFromIndex == -1 && e.CellToIndex == -1)
				{
					if (this.FocusedCell.Row == e.Index)
					{
						this.focusedCell = CellPos.Empty;
					}
				}
				else
				{
					for (int i=e.CellFromIndex; i<=e.CellToIndex; i++)
					{
						if (this.FocusedCell.Row == e.Index && this.FocusedCell.Column == i)
						{
							this.focusedCell = CellPos.Empty;

							break;
						}
					}
				}
			}
		}
Exemplo n.º 13
0
		/// <summary>
		/// Raises the CellAdded event
		/// </summary>
		/// <param name="e">A RowEventArgs that contains the event data</param>
		protected internal virtual void OnCellAdded(RowEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				this.InvalidateRow(e.Index);

				if (CellAdded != null)
				{
					CellAdded(e.Row, e);
				}
			}
		}
Exemplo n.º 14
0
		/// <summary>
		/// Raises the RowPropertyChanged event
		/// </summary>
		/// <param name="e">A RowEventArgs that contains the event data</param>
		protected internal virtual void OnRowPropertyChanged(RowEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				this.InvalidateRow(e.Index);
				
				if (RowPropertyChanged != null)
				{
					RowPropertyChanged(e.Row, e);
				}
			}
		}
Exemplo n.º 15
0
        /// <summary>
        /// Raises the RowPropertyChanged event
        /// </summary>
        /// <param name="e">A RowEventArgs that contains the event data</param>
        protected internal virtual void OnRowPropertyChanged(RowEventArgs e)
        {
            if (this.CanRaiseEvents)
            {
                if (e.EventType == RowEventType.ExpandSubRowsChanged)
                {
                    // This changes the whole table
                    this.Invalidate();

                    UpdateScrollBars();
                }
                else
                {
                    // These events just change the row itself
                    this.InvalidateRow(e.Index);

                    if (RowPropertyChanged != null)
                    {
                        RowPropertyChanged(e.Row, e);
                    }
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Raises the SubRowAdded event
        /// </summary>
        /// <param name="e"></param>
        protected internal virtual void OnSubRowAdded(RowEventArgs e)
        {
            this.TableModel.Rows.Insert(e.Row.Parent.Index+1, e.Row);
            //this.TableModel.Rows.Add(e.Row);

            if (SubRowAdded != null)
            {
                SubRowAdded(this, e);
            }
        }