C# Class SourceGrid.Selection.SelectionBase

Base selection class
Datei anzeigen Open project: zhuangyy/Motion Class Usage Examples

Public Methods

Method Description
BindToGrid ( GridVirtual p_grid ) : void

Link the cell at the specified grid. For internal use only.

CanReceiveFocus ( Position position ) : bool

Returns true if the specified position can receive the focus.

Focus ( Position pCellToActivate, bool pResetSelection ) : bool

Change the ActivePosition (focus) of the grid.

FocusColumn ( int column ) : bool

Move the Focus to the first cell that can receive the focus of the current column otherwise put the focus to null.

FocusFirstCell ( bool pResetSelection ) : bool

Set the focus on the first available cells starting from the not fixed cells. If there is an active selection set the focus on the first selected cells.

FocusRow ( int row ) : bool

Move the Focus to the first cell that can receive the focus of the current row otherwise put the focus to null.

GetSelectionRegion ( ) : RangeRegion

Returns the selected region.

IntersectsWith ( Range rng ) : bool

Returns true if the specified selection intersect with the range

Invalidate ( ) : void

Invalidate all the selected cells

IsEmpty ( ) : bool

Returns true if the selection is empty

IsSelectedCell ( Position position ) : bool

Check if the cell is selected.

IsSelectedColumn ( int column ) : bool

Check if the column is selected. Returns true if one or more row of the column is selected.

IsSelectedRange ( Range range ) : bool

Check if the range is selected.

IsSelectedRow ( int row ) : bool

Check if the row is selected. Returns true if one or more column of the row is selected.

MoveActiveCell ( Position start, int rowShift, int colShift ) : bool

Move the active cell (focus), moving the row and column as specified. Returns true if the focus can be moved. Returns false if there aren't any cell to move.

MoveActiveCell ( Position start, int rowShift1, int colShift1, int rowShift2, int colShift2 ) : bool

Move the active cell (focus), moving the row and column as specified. Try to set the focus using the first shift, if failed try to use the second shift (rowShift2, colShift2). If rowShift2 or colShift2 is int.MaxValue the next start position is the maximum row or column, if is int.MinValue 0 is used, otherwise the current position is shifted using the specified value. This method is usually used for the Tab navigation using this code : MoveActiveCell(0,1,1,0); Returns true if the focus can be moved. Returns false if there aren't any cell to move.

MoveActiveCell ( int rowShift, int colShift ) : bool

Move the active cell (focus), moving the row and column as specified. Returns true if the focus can be moved. Returns false if there aren't any cell to move.

MoveActiveCell ( int rowShift1, int colShift1, int rowShift2, int colShift2 ) : bool

Move the active cell (focus), moving the row and column as specified. Try to set the focus using the first shift, if failed try to use the second shift (rowShift2, colShift2). If rowShift2 or colShift2 is int.MaxValue the next start position is the maximum row or column, if is int.MinValue 0 is used, otherwise the current position is shifted using the specified value. This method is usually used for the Tab navigation using this code : MoveActiveCell(0,1,1,0); Returns true if the focus can be moved. Returns false if there aren't any cell to move.

ResetSelection ( bool mantainFocus ) : void

Reset the selection

SelectCell ( Position position, bool select ) : void

Select or unselect the specified cell

SelectColumn ( int column, bool select ) : void

Select or unselect the specified column

SelectRange ( Range range, bool select ) : void

Select or unselect the specified range

SelectRow ( int row, bool select ) : void

Select or unselect the specified row

SelectionBase ( ) : System

Constructor

UnBindToGrid ( ) : void

Remove the link of the cell from the grid. For internal use only.

Protected Methods

Method Description
OnCellGotFocus ( ChangeActivePositionEventArgs e ) : void

Fired when a cell receive the focus

OnCellLostFocus ( ChangeActivePositionEventArgs e ) : void

Fired when a cell lost the focus

OnFocusColumnEntered ( ColumnEventArgs e ) : void

Fired after a column receive the focus

OnFocusColumnLeaving ( ColumnCancelEventArgs e ) : void

Fired before a column lost the focus

OnFocusRowEntered ( RowEventArgs e ) : void

Fired after a row receive the focus

OnFocusRowLeaving ( RowCancelEventArgs e ) : void

Fired before a row lost the focus

OnResetSelection ( ) : void

Reset the selection

OnSelectionChanged ( EventArgs e ) : void
ValidateRange ( Range rng ) : Range

Check if the range can be selected

Private Methods

Method Description
IsActivePositionValid ( ) : bool
SearchForValidFocusPosition ( ) : Position
SearchForValidFocusPosition ( PositionCollection positions ) : Position

Method Details

BindToGrid() public method

Link the cell at the specified grid. For internal use only.
public BindToGrid ( GridVirtual p_grid ) : void
p_grid GridVirtual
return void

CanReceiveFocus() public method

Returns true if the specified position can receive the focus.
public CanReceiveFocus ( Position position ) : bool
position Position
return bool

Focus() public method

Change the ActivePosition (focus) of the grid.
public Focus ( Position pCellToActivate, bool pResetSelection ) : bool
pCellToActivate Position
pResetSelection bool True to deselect the previous selected cells
return bool

FocusColumn() public method

Move the Focus to the first cell that can receive the focus of the current column otherwise put the focus to null.
public FocusColumn ( int column ) : bool
column int
return bool

FocusFirstCell() public method

Set the focus on the first available cells starting from the not fixed cells. If there is an active selection set the focus on the first selected cells.
public FocusFirstCell ( bool pResetSelection ) : bool
pResetSelection bool
return bool

FocusRow() public method

Move the Focus to the first cell that can receive the focus of the current row otherwise put the focus to null.
public FocusRow ( int row ) : bool
row int
return bool

GetSelectionRegion() public abstract method

Returns the selected region.
public abstract GetSelectionRegion ( ) : RangeRegion
return RangeRegion

IntersectsWith() public abstract method

Returns true if the specified selection intersect with the range
public abstract IntersectsWith ( Range rng ) : bool
rng Range
return bool

Invalidate() public method

Invalidate all the selected cells
public Invalidate ( ) : void
return void

IsEmpty() public abstract method

Returns true if the selection is empty
public abstract IsEmpty ( ) : bool
return bool

IsSelectedCell() public abstract method

Check if the cell is selected.
public abstract IsSelectedCell ( Position position ) : bool
position Position
return bool

IsSelectedColumn() public abstract method

Check if the column is selected. Returns true if one or more row of the column is selected.
public abstract IsSelectedColumn ( int column ) : bool
column int
return bool

IsSelectedRange() public abstract method

Check if the range is selected.
public abstract IsSelectedRange ( Range range ) : bool
range Range
return bool

IsSelectedRow() public abstract method

Check if the row is selected. Returns true if one or more column of the row is selected.
public abstract IsSelectedRow ( int row ) : bool
row int
return bool

MoveActiveCell() public method

Move the active cell (focus), moving the row and column as specified. Returns true if the focus can be moved. Returns false if there aren't any cell to move.
public MoveActiveCell ( Position start, int rowShift, int colShift ) : bool
start Position
rowShift int
colShift int
return bool

MoveActiveCell() public method

Move the active cell (focus), moving the row and column as specified. Try to set the focus using the first shift, if failed try to use the second shift (rowShift2, colShift2). If rowShift2 or colShift2 is int.MaxValue the next start position is the maximum row or column, if is int.MinValue 0 is used, otherwise the current position is shifted using the specified value. This method is usually used for the Tab navigation using this code : MoveActiveCell(0,1,1,0); Returns true if the focus can be moved. Returns false if there aren't any cell to move.
public MoveActiveCell ( Position start, int rowShift1, int colShift1, int rowShift2, int colShift2 ) : bool
start Position
rowShift1 int
colShift1 int
rowShift2 int
colShift2 int
return bool

MoveActiveCell() public method

Move the active cell (focus), moving the row and column as specified. Returns true if the focus can be moved. Returns false if there aren't any cell to move.
public MoveActiveCell ( int rowShift, int colShift ) : bool
rowShift int
colShift int
return bool

MoveActiveCell() public method

Move the active cell (focus), moving the row and column as specified. Try to set the focus using the first shift, if failed try to use the second shift (rowShift2, colShift2). If rowShift2 or colShift2 is int.MaxValue the next start position is the maximum row or column, if is int.MinValue 0 is used, otherwise the current position is shifted using the specified value. This method is usually used for the Tab navigation using this code : MoveActiveCell(0,1,1,0); Returns true if the focus can be moved. Returns false if there aren't any cell to move.
public MoveActiveCell ( int rowShift1, int colShift1, int rowShift2, int colShift2 ) : bool
rowShift1 int
colShift1 int
rowShift2 int
colShift2 int
return bool

OnCellGotFocus() protected method

Fired when a cell receive the focus
protected OnCellGotFocus ( ChangeActivePositionEventArgs e ) : void
e ChangeActivePositionEventArgs
return void

OnCellLostFocus() protected method

Fired when a cell lost the focus
protected OnCellLostFocus ( ChangeActivePositionEventArgs e ) : void
e ChangeActivePositionEventArgs
return void

OnFocusColumnEntered() protected method

Fired after a column receive the focus
protected OnFocusColumnEntered ( ColumnEventArgs e ) : void
e ColumnEventArgs
return void

OnFocusColumnLeaving() protected method

Fired before a column lost the focus
protected OnFocusColumnLeaving ( ColumnCancelEventArgs e ) : void
e ColumnCancelEventArgs
return void

OnFocusRowEntered() protected method

Fired after a row receive the focus
protected OnFocusRowEntered ( RowEventArgs e ) : void
e RowEventArgs
return void

OnFocusRowLeaving() protected method

Fired before a row lost the focus
protected OnFocusRowLeaving ( RowCancelEventArgs e ) : void
e RowCancelEventArgs
return void

OnResetSelection() protected abstract method

Reset the selection
protected abstract OnResetSelection ( ) : void
return void

OnSelectionChanged() protected method

protected OnSelectionChanged ( EventArgs e ) : void
e System.EventArgs
return void

ResetSelection() public method

Reset the selection
public ResetSelection ( bool mantainFocus ) : void
mantainFocus bool
return void

SelectCell() public abstract method

Select or unselect the specified cell
public abstract SelectCell ( Position position, bool select ) : void
position Position
select bool
return void

SelectColumn() public abstract method

Select or unselect the specified column
public abstract SelectColumn ( int column, bool select ) : void
column int
select bool
return void

SelectRange() public abstract method

Select or unselect the specified range
public abstract SelectRange ( Range range, bool select ) : void
range Range
select bool
return void

SelectRow() public abstract method

Select or unselect the specified row
public abstract SelectRow ( int row, bool select ) : void
row int
select bool
return void

SelectionBase() public method

Constructor
public SelectionBase ( ) : System
return System

UnBindToGrid() public method

Remove the link of the cell from the grid. For internal use only.
public UnBindToGrid ( ) : void
return void

ValidateRange() protected method

Check if the range can be selected
protected ValidateRange ( Range rng ) : Range
rng Range
return Range