|
PegTable |
|
|
|
| ||||||||||||
|
|
See Also |
Styles |
The PegTable class supports
the following style flags:
FF_NONE | No frame. |
FF_THIN | Thin frame. |
FF_THICK | Thick 3D frame. |
FF_RAISED | Raised 3D frame. |
FF_RECESSED | Recessed 3D frame. |
TS_SOLID_FILL
| Fill the mReal rectangle of a PegTable
object with the color specified by the table's PCI_NORMAL
color index. |
TS_DRAW_HORZ_GRID |
Draw horizontal gridlines between the rows of a PegTable object. |
TS_DRAW_VERT_GRID |
Draw vertical gridlines between the columns of a PegTable object. |
TS_DRAW_GRID |
Draw horizontal and vertical
gridlines between the cells of a PegTable object.
This style flag is equivalent to
TS_DRAW_HORZ_GRID|TS_DRAW_VERT_GRID. |
The PegTable class also supports the following
styles to position cell clients (objects) within table cells.
These flags apply only when used with the
SetCellClient
function.
TCF_FORCEFIT
| Force the parent table to automatically adjust the row heights and column widths of the cell(s) occupied by the cell client to ensure that the unmodified object will fit within the region bounded by those cells. |
TCF_HCENTER |
Horizontally centers the cell object within the bounding cell. |
TCF_HLEFT |
Left justifies the cell object within the bounding cell. |
TCF_HRIGHT |
Right justifies the cell object within the bounding cell. |
TCF_VCENTER |
Vertically centers the cell object within the bounding cell. |
TCF_VTOP |
Top aligns the cell object within the bounding cell. |
TCF_VBOTTOM |
Bottom aligns the cell object within the bounding cell. |
|
| |
| Top of page |
Members |
Constructors:
|
| |
|
|
PegTable(SIGNED iLeft, SIGNED iTop,
|
SIGNED iRows, SIGNED iCols)
| |
This constructor creates a
PegTable object with its
top left corner located at (iLeft,iTop).
The table will have iRows rows and iCols columns.
Public Functions:
|
| |
|
|
virtual void Draw(void)
|
The PegTable class overrides
the Draw() function to draw the table in two stages.
First the table gridlines are drawn, if needed.
Then the table's mClip variable
is modified to identify a pseudo "client area" for the first table cell
and the cell client is drawn. The process is repeated until all
cell clients have been drawn in their respective cells.
|
| |
|
|
virtual void DrawChildren(void)
|
The PegTable class overrides
the DrawChildren() function to prevent child objects from
drawing outside the cell area allocated to each cell client.
|
| |
|
|
virtual void DrawGrid(void)
|
This function draws the table gridlines.
|
| |
|
|
PegThing *GetCellClient(
|
SIGNED iRow, SIGNED iCol)
| |
This function returns a pointer
to the cell client, a PegThing object, located at the
indicated cell position.
It returns NULL if no cell client is assigned to that cell.
|
| |
|
|
SIGNED GetCellPadding(void)
|
{return miCellPad;}
| |
This function returns the current cell padding width.
|
| |
|
|
SIGNED GetColumns(void)
|
{return miCols;}
| |
This inline function returns the number of columns in the table.
|
| |
|
|
SIGNED GetGridWidth(void)
|
{return miGridWidth;}
| |
This function returns the current width of a table gridline.
|
| |
|
|
BOOL GetRowCol(PegThing *pChild,
|
SIGNED *pRow, SIGNED *pCol)
| |
This function returns TRUE
if the PegThing object
referenced by pChild is a cell client, else FALSE.
If the PegThing object is a cell client, this function updates
*pRow and *pCol to
indicate the row and column position of the cell containing the object.
If the cell client spans multiple cells,
the upper left cell is used to identify the location of the cell client.
|
| |
|
|
SIGNED GetRows(void)
|
{return miRows;}
| |
This inline function returns the number of rows in the table.
|
| |
|
|
virtual void Layout(void)
|
This function computes the table's dimensions as described in the overview.
Call this function after the table's cell clients have been modified but before the table is drawn. Note that it is acceptable to modify cell clients after the table has been drawn, as long as this function is called after the modifications have been made.
Note that table row heights and column widths are never decreased. They may be increased if a new cell client which is added to the table is larger than the cell client(s) which it replaces.
|
| |
|
|
void Reconfigure(
|
SIGNED iRows, SIGNED iCols,
| |
SIGNED iGridWidth, SIGNED iCellPadding)
| |
This function recalculates row and column widths based on current entries. This function should be called after changing the cell clients.
|
| |
|
|
PegThing *RemoveCellClient(
|
SIGNED iRow, SIGNED iCol)
| |
This function removes the cell client from the indicated cell position.
The cell client, a PegThing object, is not deleted.
The table cell remains
in place but no longer has any content for display.
The function returns a pointer to the removed PegThing object.
The function returns NULL if the cell has no cell client
(never assigned or already removed) or if the cell coordinates are invalid.
You can use this function to remove one cell client before installing another, thereby dynamically switching cell content.
|
| |
|
|
virtual void SetCellClient(
|
SIGNED iRow, SIGNED iCol,
| |
PegThing *Child,
| |
SIGNED iRowSpan = 1,
| |
SIGNED iColSpan = 1,
| |
WORD wStyle = TCF_HCENTER | TCF_VCENTER)
| |
This function is
used to populate the cells of a table with cell clients.
The KwikPeg object referenced by Child can be any object derived from the
PegThing base class, including buttons, strings, prompts,
textboxes, bitmaps, groups or even other windows.
The cell client is assigned to the cell at row iRow,
column iCol. If the object spans multiple cells,
the upper left cell is used to identify the cell location.
The default value for the rowspan and columnspan of a cell client is 1.
Hence, unless otherwise specified, the cell client will occupy one table cell.
If the RowSpan (ColSpan) parameter is >1,
the cell client will span the number of rows (columns) specified by the parameter.
The wStyle parameter specifies the horizontal
and vertical alignment of the cell client within the bounding cell(s).
The default style centers the object vertically and horizontally
within the bounding cell.
If you specify the TCF_FORCEFIT style,
the table will automatically adjust the row heights and column widths
of the cell(s) occupied by the cell client to ensure that the
unmodified object will fit within the region bounded by those cells.
The cell alignment TCF_xxxxxx styles operate only
on the placement of the object within its bounding cell(s).
The cell style flags do not affect the object.
For example, a PegPrompt object has a series of styles
that allow for left, center and right justification of its text.
These text justification style flags are independent of the cell
style flags. For example, you can right justify the text within
the PegPrompt object while left justifying the object
within its cell.
|
| |
|
|
virtual void SetCellPadding(SIGNED iPad)
|
{miCellPad = iPad;}
| |
This function sets the cell padding width to iPad pixels.
The indicated cell padding will be added around each cell client in the table.
|
| |
|
|
virtual void SetColWidth(
|
SIGNED iCol, SIGNED iWidth,
| |
BOOL bForce = FALSE)
| |
This function sets the minimum width of column iCol
to iWidth pixels.
The initial width of all table columns is zero pixels.
By default, the column width cannot be decreased.
However, if the bForce
parameter is set to TRUE, the column width will
unconditionally be set to iWidth pixels.
|
| |
|
|
void SetGridWidth(SIGNED iWidth = PEG_FRAME_WIDTH)
|
This function sets the width of a table gridline to iWidth pixels.
If the gridline width is set to zero, the table will be drawn without gridlines.
By default, a table is drawn with gridlines of the width specified by
your KwikPeg configuration.
|
| |
|
|
virtual void SetRowHeight(
|
SIGNED iRow, SIGNED iHeight,
| |
BOOL bForce = FALSE)
| |
This function sets the minimum height of row iRow
to iHeight pixels.
The initial height of all table rows is zero pixels.
By default, the row height cannot be decreased.
However, if the bForce
parameter is set to TRUE, the row height will
unconditionally be set to iHeight pixels.
|
| |
| Top of page |
Examples |
The following example illustrates
a PegTable object whose cells are populated with different
types of cell clients.

|
Top of page |
|
|
|
|
| Copyright © 2000-2003 |