Methods Index 
Helper Classes: CRegionCellIterator
, CRegionColumnIterator
, CRegionIterator
, CRegionRowIterator
CRegion
is a collection of nonoverlapping rectangles (
CBounds
). This implementation does not combine rectangles, which is the optimal behavior for the CTable
object, nor does it maintain any sorted order of rectangles. Subclasses might implement combining, sorting, or other optimizations depending on the class usage.
CTable
uses CRegion
to maintain the region of selected cells, rows, and columns. Other uses include updating or drawing regions and selecting regions on an image, for example. CRegion
methods fall under a few simple headings: Add/Remove Methods, Resizing Methods, Test Methods, and Boolean Operations.
Add
/Remove
methods add and remove rectangles, rows, columns, or cells from the region. Resizing includes Insert
and Delete
methods to change the size of a region. CRegion
adjusts the internal rectangles as required to accommodate the change. For example, if you call myRegion
.InsertRow
(4, 1), CRegion
will move rectangles below row 4 down one row (top += 1, and bottom += 1). CRegion
will also increase the height (bottom += 1) of any rectangles that include row 4. Test methods allow you to check whether a region contains any given cell, row, or column. The last group, boolean operations, provides ways to combine regions (in place) using the methods Union()
, Subtract()
, and Xor()
. CTable
's mouse handler uses these methods extensively to compute the update region when it has changed the table's selection region.
#include CRegion_i
CRegion myRegion;
myRegion.AddRow(13);
myRegion.AddCell(CCell(5, 4));
// Iterators
// Region
CRegionIterator anIterator(myRegion);
CBounds aBounds;
while(anIterator.Next(&theBounds)) { ... }
// Cell
CRegionCellIterator anIterator(myRegion);
CCell aCell;
while(anIterator.Next(&aCell)) { ... }
// Row
CRegionRowIterator anIterator(myRegion);
long aRow;
while(anIterator.Next(&aRow)) { ... }
// Column
CRegionColumnIterator anIterator(myRegion);
long aColumn;
while(anIterator.Next(&aColumn)) { ... }
CBounds

itsBounds;
 Rectangular union of all rectangles in region. 
RWGOrderedVector(CBounds)

itsList;
 Internal list of rectangles. 
CRegion();
CRegion(const CRegion& theRegion);
CRegion(const CBounds& theBounds);
const CRegion& operator=(const CRegion& theRegion);
virtual ~CRegion();
virtual void Add(const CBounds& theBounds);
virtual void Add(const CCell& theCell);
virtual void AddRow(long theRow);
virtual void AddColumn(long theColumn);
virtual void Clear();
virtual void Remove(const CBounds& theBounds);
virtual void Remove(const CCell& theCell);
virtual void RemoveRow(long theRow);
virtual void RemoveColumn(long theColumn);
virtual void InsertColumns(long theColumn,
long theCount = 1);
virtual void InsertRows(long theRow,
long theCount = 1);
virtual void DeleteColumns(long theColumn,
long theCount = 1);
virtual void DeleteRows(long theRow,
long theCount = 1);
virtual BOOLEAN Contains(const CCell& theCell) const;
virtual BOOLEAN ContainsRow(long theRow) const;
virtual BOOLEAN ContainsColumn(long theColumn) const;
virtual void Union(const CRegion& theRegion);
virtual void Subtract(const CRegion& theRegion);
theRegion
. May split and otherwise modify rectangles. Operates in place.virtual void Xor(const CRegion& theRegion);
theRegion
minus the intersection with theRegion
. A xor B
is also equal to (A  B
) union (B  A
). Operates in place.virtual const CBounds& Bounds() const;
void SetBounds();
CBounds
) in the region. Includes rows and columns.
const CRegion&

itsRegion;

unsigned

itsIterator;

CRegionIterator(const CRegion& theRegion);
BOOLEAN Next(CBounds* theBounds);
TRUE
and sets theBounds
equal to the next rectangle in the region. If no more rectangles exist, Next()
returns FALSE
.
CCell
) in the region. Excludes rows and columns.
const CRegion&

itsRegion;

unsigned

itsIterator;

CCell

itsLastCell;

CRegionCellIterator(const CRegion& theRegion);
BOOLEAN Next(CCell* theCell);
TRUE
and sets theCell
equal to the next cell in the region. If no more cells exist, Next()
returns FALSE
.
const CRegion&

itsRegion;

unsigned

itsIterator;

long

itsLastRow;

CRegionRowIterator(const CRegion& theRegion);
BOOLEAN Next(long* theRow);
TRUE
and sets theRow
equal to the next row in the region. If no more rows exist, Next()
returns FALSE
.
const CRegion&

itsRegion;

unsigned

itsIterator;

long

itsLastColumn;

CRegionColumnIterator(const CRegion& theRegion);
BOOLEAN Next(long* theColumn);
TRUE
and sets theColumn
equal to the next column in the region. If no more columns exist, Next()
returns FALSE
.