[Classes] [Prev] [Next] [Methods]


Methods Index

Protected Data Members
Public Methods
Constructor and Destructor and Operator Methods.
Set Methods
Unsetting Methods.
Retrieval Methods



Superclass: None

Subclasses: None


CTableAttributes provides the mechanisms to change attributes, such as font and color, associated with rows, columns, and cells within a table. In general, to change attributes within a table you should create a CTableAttributes object, set the attributes you wish to modify, and apply the attributes using CTable methods such as SetCell(), SetRow(), SetColumn(), and SetTable().

CTableAttributes contains the standard set of cell attributes. The table stores attributes in an array for individual cells, rows, columns and the table. Attributes not set on a cell are taken from the column, then the row, and finally the table. The table contains a complete set of attributes which ensures a complete set for drawing.


Replacing the default text interpreter with a custom version:

CTableAttributes anAttributesSet;

new CTableTextInterpreter(
myTable->GetTableView(), // Internal table view
TX_BORDER, // Flags to pass to CNativeTextEdit
32, // Right margin
32, // Character limit
NULLcmd, // Enter command
TRUE, // Single line
TRUE // notify of all changes
Setting attributes on a diagonal line of cells:

for (int i = 0; i < 100; i += 1)
CTableAttributes anAttribute;
anAttribute.Foreground( COLOR_GREEN );
anAttribute.Background( COLOR_RED );
anAttribute.ReadOnly( TRUE );
myTable->SetCell( CCell(i, i), anAttribute );



BorderTop 0x01
BorderLeft 0x02
BorderBottom 0x04
BorderRight 0x08
BorderTopLeft 0x03
BorderBottomRight 0x0c
BorderAll 0x0f


MaskFont 0x0001
MaskForeground 0x0002
MaskBackground 0x0004
MaskJustification 0x0008
MaskTopBorder 0x0010
MaskLeftBorder 0x0020
MaskBottomBorder 0x0040
MaskRightBorder 0x0080
MaskInterpreter 0x0100
MaskReadOnly 0x0200
MaskValidator 0x0400

Masks to determine which attributes have been set.



Compass style text justification.


BorderNone= 0
BorderSunken Setting this on any border causes all to be sunken
BorderRaised Setting this on any border causes all to be raised

Cell border styles.

Protected Data Members

const CFont* itsFont; The font, if set.
COLOR itsForeground; The foreground color, if set.
COLOR itsBackground; The background color, if set.
TextJustification itsJustification; The text justification, if set.
Border itsTopBorder; The top border, if set.
Border itsLeftBorder; The left border, if set.
Border itsBottomBorder; The bottom border, if set.
Border itsRightBorder; The right border, if set.
unsigned int itsMask; The mask of set attributes.
CTableInterpreter* itsInterpreter; The interpreter, if set.
CValidator itsValidator; The validator, if set.
BOOLEAN itsReadOnly; The read-only flag, if set.
unsigned char itsIndex; The index used to access this attribute set in the attribute pool.

Public Methods

Constructor and Destructor and Operator Methods.

CTableAttributes(const CTableAttributes& theAttributes);
CTableAttributes& operator=(const CTableAttributes& theAttributes);
int operator==(const CTableAttributes& theAttributes) const;

Set Methods

void Combine(const CTableAttributes& theAttributes);
void Font(const CFont& theFont);
void Foreground(COLOR theColor);
void Background(COLOR theColor);
void Justification(TextJustification theJustification);
void TopBorder(Border theBorder);
void LeftBorder(Border theBorder);
void BottomBorder(Border theBorder);
void RightBorder(Border theBorder);
void Interpreter(CTableInterpreter* theInterpreter);
void ReadOnly(BOOLEAN isReadOnly);
void Validator(CValidator theValidator);
void Mask(unsigned int theMask);
The following methods represent an alternative border settting interface to set color and border styles on multiple borders at once.

Applicable borders and common combinations of borders.

	BorderTop = 0x01,
BorderLeft = 0x02,
BorderBottom = 0x04,
BorderRight = 0x08,
BorderTopLeft = 0x03,
BorderBottomRight = 0x0c,
BorderAll = 0x0f
void SetBorderColor(COLOR theColor,
BorderLocation theLocation = BorderAll);
void SetBorderStyle(BorderStyle theStyle,
BorderLocation theLocation = BorderAll);

Unsetting Methods.

Unsetting an attribute removes it from the attribute sets.

void UnFont();
void UnForeground();
void UnBackground();
void UnJustification();
void UnTopBorder();
void UnLeftBorder();
void UnBottomBorder();
void UnRightBorder();
void UnInterpreter();
void UnReadOnly();
void UnValidator();

Retrieval Methods

const CFont& Font() const;
COLOR Foreground() const;
COLOR Background() const;
TextJustification Justification() const;
Border TopBorder() const;
Border LeftBorder() const;
Border BottomBorder() const;
Border RightBorder() const;
CTableInterpreter* Interpreter() const;
BOOLEAN ReadOnly() const;
CValidator Validator() const;
unsigned int Mask() const;

[Classes] [Prev] [Next] [Methods]


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.