Version: 3.1.4
wxGridBlockCoords Class Reference

#include <wx/grid.h>

Detailed Description

Represents coordinates of a block of cells in the grid.

An object of this class contains coordinates of the left top and the bottom right corners of a block.

Since
3.1.4

Public Member Functions

 wxGridBlockCoords ()
 Default constructor initializes the object to invalid state. More...
 
 wxGridBlockCoords (int topRow, int leftCol, int bottomRow, int rightCol)
 Constructor taking a coordinates of the left top and the bottom right corners. More...
 
int GetTopRow () const
 Return the row of the left top corner. More...
 
void SetTopRow (int row)
 Set the row of the left top corner. More...
 
int GetLeftCol () const
 Return the column of the left top corner. More...
 
void SetLeftCol (int col)
 Set the column of the left top corner. More...
 
int GetBottomRow () const
 Return the row of the bottom right corner. More...
 
void SetBottomRow (int row)
 Set the row of the bottom right corner. More...
 
int GetRightCol () const
 Return the column of the bottom right corner. More...
 
void SetRightCol (int col)
 Set the column of the bottom right corner. More...
 
wxGridCellCoords GetTopLeft () const
 Return the coordinates of the top left corner. More...
 
wxGridCellCoords GetBottomRight () const
 Return the coordinates of the bottom right corner. More...
 
wxGridBlockCoords Canonicalize () const
 Return the canonicalized block where top left coordinates is less then bottom right coordinates. More...
 
bool Intersects (const wxGridBlockCoords &other) const
 Whether the blocks intersect. More...
 
bool Contains (const wxGridCellCoords &cell) const
 Check whether this block contains the given cell. More...
 
bool Contains (const wxGridBlockCoords &other) const
 Check whether this block contains another one. More...
 
wxGridBlockDiffResult Difference (const wxGridBlockCoords &other, int splitOrientation) const
 Calculates the result blocks by subtracting the other block from this block. More...
 
wxGridBlockDiffResult SymDifference (const wxGridBlockCoords &other) const
 Calculates the symmetric difference of the blocks. More...
 
bool operator== (const wxGridBlockCoords &other) const
 Equality operator. More...
 
bool operator!= (const wxGridBlockCoords &other) const
 Inequality operator. More...
 
bool operator! () const
 Checks whether the cells block is invalid. More...
 

Private Attributes

int m_topRow
 
int m_leftCol
 
int m_bottomRow
 
int m_rightCol
 

Constructor & Destructor Documentation

wxGridBlockCoords::wxGridBlockCoords ( )

Default constructor initializes the object to invalid state.

Initially the coordinates are invalid (-1) and so operator!() for an uninitialized wxGridBlockCoords returns true.

wxGridBlockCoords::wxGridBlockCoords ( int  topRow,
int  leftCol,
int  bottomRow,
int  rightCol 
)

Constructor taking a coordinates of the left top and the bottom right corners.

Member Function Documentation

wxGridBlockCoords wxGridBlockCoords::Canonicalize ( ) const

Return the canonicalized block where top left coordinates is less then bottom right coordinates.

bool wxGridBlockCoords::Contains ( const wxGridCellCoords cell) const

Check whether this block contains the given cell.

Returns
true, if the block contains the cell, false otherwise.
bool wxGridBlockCoords::Contains ( const wxGridBlockCoords other) const

Check whether this block contains another one.

Returns
true if other is entirely contained within this block.
wxGridBlockDiffResult wxGridBlockCoords::Difference ( const wxGridBlockCoords other,
int  splitOrientation 
) const

Calculates the result blocks by subtracting the other block from this block.

Parameters
otherThe block to subtract from this block.
splitOrientationThe block splitting orientation (either wxHORIZONTAL or wxVERTICAL).
Returns
Up to 4 blocks. If block doesn't exist in the result, it has value of wxGridNoBlockCoords.
wxGridCellCoords wxGridBlockCoords::GetBottomRight ( ) const
inline

Return the coordinates of the bottom right corner.

int wxGridBlockCoords::GetBottomRow ( ) const

Return the row of the bottom right corner.

int wxGridBlockCoords::GetLeftCol ( ) const

Return the column of the left top corner.

int wxGridBlockCoords::GetRightCol ( ) const

Return the column of the bottom right corner.

wxGridCellCoords wxGridBlockCoords::GetTopLeft ( ) const
inline

Return the coordinates of the top left corner.

int wxGridBlockCoords::GetTopRow ( ) const

Return the row of the left top corner.

bool wxGridBlockCoords::Intersects ( const wxGridBlockCoords other) const
inline

Whether the blocks intersect.

Returns
true, if the block intersects with the other, false, otherwise.
bool wxGridBlockCoords::operator! ( ) const

Checks whether the cells block is invalid.

Returns true only if all components are -1. Notice that if one of the components (but not all) is -1, this method returns false even if the object is invalid. This is done because objects in such state should actually never exist, i.e. either all components should be -1 or none of them should be -1.

bool wxGridBlockCoords::operator!= ( const wxGridBlockCoords other) const

Inequality operator.

bool wxGridBlockCoords::operator== ( const wxGridBlockCoords other) const

Equality operator.

void wxGridBlockCoords::SetBottomRow ( int  row)

Set the row of the bottom right corner.

void wxGridBlockCoords::SetLeftCol ( int  col)

Set the column of the left top corner.

void wxGridBlockCoords::SetRightCol ( int  col)

Set the column of the bottom right corner.

void wxGridBlockCoords::SetTopRow ( int  row)

Set the row of the left top corner.

wxGridBlockDiffResult wxGridBlockCoords::SymDifference ( const wxGridBlockCoords other) const

Calculates the symmetric difference of the blocks.

Parameters
otherThe block to subtract from this block.
Returns
Up to 4 blocks. If block doesn't exist in the result, it has value of wxGridNoBlockCoords.

Member Data Documentation

int wxGridBlockCoords::m_bottomRow
private
int wxGridBlockCoords::m_leftCol
private
int wxGridBlockCoords::m_rightCol
private
int wxGridBlockCoords::m_topRow
private