//#########################################################################################
//★★★★★★★ http://www.cnpopsoft.com [华普软件] ★★★★★★★
//★★★★★★★ 华普软件 - VB & C#.NET 专业论文与源码荟萃! ★★★★★★★
//#########################################################################################
/*
* Copyright ?2005, Mathew Hall
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
using System;
using XPTable.Models;
namespace XPTable.Events
{
#region Delegates
///
/// Represents the methods that will handle the PropertyChanged, CellAdded and
/// CellRemoved events of a Row
///
public delegate void RowEventHandler(object sender, RowEventArgs e);
#endregion
#region RowEventArgs
///
/// Provides data for a Row's PropertyChanged, CellAdded
/// and CellRemoved events
///
public class RowEventArgs : EventArgs
{
#region Class Data
///
/// The Row that Raised the event
///
private Row source;
///
/// The index of the Row
///
private int rowIndex;
///
/// The affected Cell
///
private Cell cell;
///
/// The start index of the affected Cell(s)
///
private int cellToIndex;
///
/// The end index of the affected Cell(s)
///
private int cellFromIndex;
///
/// The type of event
///
private RowEventType eventType;
#endregion
#region Constructor
///
/// Initializes a new instance of the RowEventArgs class with
/// the specified Row source, row index, start index, end index
/// and affected Cell
///
/// The Row that originated the event
/// The type of event
public RowEventArgs(Row source, RowEventType eventType) : this(source, -1, null, -1, -1, eventType)
{
}
///
/// Initializes a new instance of the RowEventArgs class with
/// the specified Row source, row index, start index, end index
/// and affected Cell
///
/// The Row that originated the event
/// The affected Cell
/// The start index of the affected Cell(s)
/// The end index of the affected Cell(s)
public RowEventArgs(Row source, Cell cell, int cellFromIndex, int cellToIndex) : this(source, -1, cell, cellFromIndex, cellToIndex, RowEventType.Unknown)
{
}
///
/// Initializes a new instance of the RowEventArgs class with
/// the specified Row source, row index, start index, end index
/// and affected Cell
///
/// The Row that originated the event
/// The index of the Row
/// The affected Cell
/// The start index of the affected Cell(s)
/// The end index of the affected Cell(s)
/// The type of event
public RowEventArgs(Row source, int rowIndex, Cell cell, int cellFromIndex, int cellToIndex, RowEventType eventType) : base()
{
this.source = source;
this.rowIndex = rowIndex;
this.cell = cell;
this.cellFromIndex = cellFromIndex;
this.cellToIndex = cellToIndex;
this.eventType = eventType;
}
#endregion
#region Properties
///
/// Gets the Row that Raised the event
///
public Row Row
{
get
{
return this.source;
}
}
///
/// Gets the index of the Row
///
public int Index
{
get
{
return this.rowIndex;
}
}
///
///
///
///
internal void SetRowIndex(int rowIndex)
{
this.rowIndex = rowIndex;
}
///
/// Gets the affected Cell
///
public Cell Cell
{
get
{
return this.cell;
}
}
///
/// Gets the start index of the affected Cell(s)
///
public int CellFromIndex
{
get
{
return this.cellFromIndex;
}
}
///
/// Gets the end index of the affected Cell(s)
///
public int CellToIndex
{
get
{
return this.cellToIndex;
}
}
///
/// Gets the type of event
///
public RowEventType EventType
{
get
{
return this.eventType;
}
}
#endregion
}
#endregion
}