/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Replaces the currently selected Cells with the Cells located between the specified /// start and end row/column indicies /// </summary> /// <param name="startRow">The row index of the start Cell</param> /// <param name="startColumn">The column index of the start Cell</param> /// <param name="endRow">The row index of the end Cell</param> /// <param name="endColumn">The column index of the end Cell</param> public void SelectCells(int startRow, int startColumn, int endRow, int endColumn) { int[] oldSelectedIndicies = this.SelectedIndicies; this.InternalClear(); if (this.InternalAddCells(startRow, startColumn, endRow, endColumn)) { this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies)); } this.shiftSelectStart = new CellPos(startRow, startColumn); this.shiftSelectEnd = new CellPos(endRow, endColumn); }
/// <summary> /// Replaces the currently selected Cells with the Cell at the specified CellPos /// </summary> /// <param name="cellPos">A CellPos thst specifies the row and column indicies of /// the Cell to be selected</param> public void SelectCell(CellPos cellPos) { this.SelectCell(cellPos.Row, cellPos.Column); }
/// <summary> /// Removes the Cells located between the specified start and end CellPos from the /// current selection /// </summary> /// <param name="start">A CellPos that specifies the start Cell</param> /// <param name="end">A CellPos that specifies the end Cell</param> public void RemoveCells(CellPos start, CellPos end) { this.RemoveCells(start.Row, start.Column, end.Row, end.Column); }
/// <summary> /// Removes the Cells located between the specified start and end row/column indicies /// from the current selection /// </summary> /// <param name="startRow">The row index of the start Cell</param> /// <param name="startColumn">The column index of the start Cell</param> /// <param name="endRow">The row index of the end Cell</param> /// <param name="endColumn">The column index of the end Cell</param> public void RemoveCells(int startRow, int startColumn, int endRow, int endColumn) { if (this.rows.Count > 0) { int[] oldSelectedIndicies = this.SelectedIndicies; if (this.InternalRemoveCells(startRow, startColumn, endRow, endColumn)) { this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies)); } this.shiftSelectStart = new CellPos(startRow, startColumn); this.shiftSelectEnd = new CellPos(endRow, endColumn); } }
/// <summary> /// Removes the Cell at the specified row and column indicies from the current selection /// </summary> /// <param name="cellPos">A CellPos that specifies the Cell to remove from the selection</param> public void RemoveCell(CellPos cellPos) { this.RemoveCell(cellPos.Row, cellPos.Column); }
/// <summary> /// Returns whether the Cell at the specified CellPos is currently selected /// </summary> /// <param name="cellPos">A CellPos the represents the row and column indicies /// of the Cell to check</param> /// <returns>true if the Cell at the specified CellPos is currently selected, /// false otherwise</returns> public bool IsCellSelected(CellPos cellPos) { return this.IsCellSelected(cellPos.Row, cellPos.Column); }
/// <summary> /// Adds the Cells between the last selection start Cell and the Cell at the /// specified CellPas to the current selection. Any Cells that are /// between the last start and end Cells that are not in the new area are /// removed from the current selection /// </summary> /// <param name="cellPos">A CellPos that specifies the shift selected Cell</param> public void AddShiftSelectedCell(CellPos cellPos) { this.AddShiftSelectedCell(cellPos.Row, cellPos.Column); }
/// <summary> /// Adds the Cells located between the specified start and end CellPos to the /// current selection /// </summary> /// <param name="start">A CellPos that specifies the start Cell</param> /// <param name="end">A CellPos that specifies the end Cell</param> public void AddCells(CellPos start, CellPos end) { this.AddCells(start.Row, start.Column, end.Row, end.Column); }
/// <summary> /// Adds the Cells between the last selection start Cell and the Cell at the /// specified row/column indicies to the current selection. Any Cells that are /// between the last start and end Cells that are not in the new area are /// removed from the current selection /// </summary> /// <param name="row">The row index of the shift selected Cell</param> /// <param name="column">The column index of the shift selected Cell</param> public void AddShiftSelectedCell(int row, int column) { int[] oldSelectedIndicies = this.SelectedIndicies; if (this.shiftSelectStart == CellPos.Empty) { this.shiftSelectStart = new CellPos(0, 0); } bool changed = false; if (this.shiftSelectEnd != CellPos.Empty) { changed = this.InternalRemoveCells(this.shiftSelectStart, this.shiftSelectEnd); changed |= this.InternalAddCells(this.shiftSelectStart, new CellPos(row, column)); } else { changed = this.InternalAddCells(0, 0, row, column); } if (changed) { this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies)); } this.shiftSelectEnd = new CellPos(row, column); }
/// <summary> /// Adds the Cell at the specified row and column indicies to the current selection /// </summary> /// <param name="cellPos">A CellPos that specifies the Cell to add to the selection</param> public void AddCell(CellPos cellPos) { this.AddCell(cellPos.Row, cellPos.Column); }
/// <summary> /// Initializes a new instance of the TableModel.Selection class /// that belongs to the specified TableModel /// </summary> /// <param name="owner">A TableModel representing the tableModel that owns /// the Selection</param> public Selection(TableModel owner) { if (owner == null) { throw new ArgumentNullException("owner", "owner cannot be null"); } this.owner = owner; this.rows = new ArrayList(); this.shiftSelectStart = CellPos.Empty; this.shiftSelectEnd = CellPos.Empty; }
public Cell this[CellPos cellPos] { get { return this[cellPos.Row, cellPos.Column]; } }
/// <summary> /// Replaces the currently selected Cells with the Cells located between the specified /// start and end CellPos /// </summary> /// <param name="start">A CellPos that specifies the start Cell</param> /// <param name="end">A CellPos that specifies the end Cell</param> public void SelectCells(CellPos start, CellPos end) { this.SelectCells(start.Row, start.Column, end.Row, end.Column); }
/// <summary> /// Removes all selected Rows and Cells from the selection /// </summary> public void Clear() { if (this.rows.Count > 0) { int[] oldSelectedIndicies = this.SelectedIndicies; this.InternalClear(); this.shiftSelectStart = CellPos.Empty; this.shiftSelectEnd = CellPos.Empty; this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies)); } }
/// <summary> /// Adds the Cells located between the specified start and end CellPos to the /// current selection without raising an event /// </summary> /// <param name="start">A CellPos that specifies the start Cell</param> /// <param name="end">A CellPos that specifies the end Cell</param> /// <returns>true if any Cells were added, false otherwise</returns> private bool InternalAddCells(CellPos start, CellPos end) { return this.InternalAddCells(start.Row, start.Column, end.Row, end.Column); }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }