mCtrl
0.10.0
|
Go to the source code of this file.
Table (data model for grid control)
The table is actually a container which manages set of values arranged in a two-dimensional matrix of cells. It serves as a back-end for the grid control (MC_WC_GRID).
To set or get an information about a cell, application uses the structure MC_TABLECELL.
The table also manages a cell for each column and row. The grid uses data of these cells as headers for columns and rows (with its default styles; the control provides some styles changing this behavior).
The cells are manipulated the same way as ordinary cells, but special value MC_TABLE_HEADER has to be used as a column index or row index. I.e. to address cell for 2nd column, use column index 1 (because indexes are zero-based), and row index MC_TABLE_HEADER.
Data Structures | |
struct | MC_TABLECELLW |
Structure describing a table cell (Unicode variant). More... | |
struct | MC_TABLECELLA |
Structure describing a table cell (ANSI variant). More... | |
Macros | |
#define | MC_TABLE_HEADER 0xffff |
ID of column/row headers. More... | |
Typedefs | |
typedef void * | MC_HTABLE |
Opaque table handle. More... | |
MC_TABLECELL::fMask Bits | |
#define | MC_TCMF_TEXT 0x00000001 |
Set if MC_TABLECELLW::pszText or MC_TABLECELLA::pszText is valid. More... | |
#define | MC_TCMF_PARAM 0x00000004 |
Set if MC_TABLECELLW::lParam or MC_TABLECELLA::lParam is valid. More... | |
#define | MC_TCMF_FLAGS 0x00000008 |
Set if MC_TABLECELLW::dwFlags or MC_TABLECELLA::dwFlags is valid. More... | |
MC_TABLECELL::dwFlags Bits | |
#define | MC_TCF_ALIGNDEFAULT 0x00000000 |
Paint the cell value aligned horizontally as default for the value type. More... | |
#define | MC_TCF_ALIGNLEFT 0x00000001 |
Paint the cell value aligned horizontally to left. More... | |
#define | MC_TCF_ALIGNCENTER 0x00000003 |
Paint the cell value aligned horizontally to center. More... | |
#define | MC_TCF_ALIGNRIGHT 0x00000002 |
Paint the cell value aligned horizontally to right. More... | |
#define | MC_TCF_ALIGNVDEFAULT 0x00000000 |
Paint the cell value aligned vertically as normal for the value type. More... | |
#define | MC_TCF_ALIGNTOP 0x00000004 |
Paint the cell value aligned vertically to top. More... | |
#define | MC_TCF_ALIGNVCENTER 0x0000000C |
Paint the cell value aligned vertically to center. More... | |
#define | MC_TCF_ALIGNBOTTOM 0x00000008 |
Paint the cell value aligned vertically to bottom. More... | |
#define | MC_TCF_ALIGNMASKHORZ |
Bitmask for all cell flags specifying horizontal alignment. More... | |
#define | MC_TCF_ALIGNMASKVERT |
Bitmask for all cell flags specifying vertical alignment. More... | |
Functions | |
MC_HTABLE | mcTable_Create (WORD wColumnCount, WORD wRowCount, DWORD dwReserved) |
Create new table. More... | |
void | mcTable_AddRef (MC_HTABLE hTable) |
Increment reference counter of the table. More... | |
void | mcTable_Release (MC_HTABLE hTable) |
Decrement reference counter of the table. More... | |
WORD | mcTable_ColumnCount (MC_HTABLE hTable) |
Retrieve count of table columns. More... | |
WORD | mcTable_RowCount (MC_HTABLE hTable) |
Retrieve count of table rows. More... | |
BOOL | mcTable_Resize (MC_HTABLE hTable, WORD wColumnCount, WORD wRowCount) |
Resize the table. More... | |
void | mcTable_Clear (MC_HTABLE hTable, DWORD dwWhat) |
Clear the table. More... | |
BOOL | mcTable_SetCellW (MC_HTABLE hTable, WORD wCol, WORD wRow, MC_TABLECELLW *pCell) |
Set contents of a cell (Unicode variant). More... | |
BOOL | mcTable_SetCellA (MC_HTABLE hTable, WORD wCol, WORD wRow, MC_TABLECELLA *pCell) |
Set contents of a cell (ANSI variant). More... | |
BOOL | mcTable_GetCellW (MC_HTABLE hTable, WORD wCol, WORD wRow, MC_TABLECELLW *pCell) |
Get contents of a cell (Unicode variant). More... | |
BOOL | mcTable_GetCellA (MC_HTABLE hTable, WORD wCol, WORD wRow, MC_TABLECELLA *pCell) |
Get contents of a cell (ANSI variant). More... | |
Unicode Resolution | |
#define | MC_TABLECELL MCTRL_NAME_AW(MC_TABLECELL) |
#define | mcTable_SetCell MCTRL_NAME_AW(mcTable_SetCell) |
#define | mcTable_GetCell MCTRL_NAME_AW(mcTable_GetCell) |
struct MC_TABLECELLW |
Structure describing a table cell (Unicode variant).
Note that only members corresponding to the set bits of the fMask
are considered valid. (fMask
itself is always valid of course.)
Data Fields | ||
---|---|---|
DWORD | fMask |
Bitmask specifying what other members are valid. See MC_TCMF_xxxx. |
WCHAR * | pszText |
Cell text. |
int | cchTextMax |
Number of characters in |
LPARAM | lParam |
User data. |
DWORD | dwFlags |
Cell flags. See MC_TCF_xxxx. |
struct MC_TABLECELLA |
Structure describing a table cell (ANSI variant).
Note that only members corresponding to the set bits of the fMask
are considered valid. (fMask
itself is always valid of course.)
Data Fields | ||
---|---|---|
DWORD | fMask |
Bitmask specifying what other members are valid. See MC_TCMF_xxxx. |
char * | pszText |
Cell text. |
int | cchTextMax |
Number of characters in |
LPARAM | lParam |
User data. |
DWORD | dwFlags |
Cell flags. See MC_TCF_xxxx. |
#define MC_TABLE_HEADER 0xffff |
#define MC_TCMF_TEXT 0x00000001 |
Set if MC_TABLECELLW::pszText or MC_TABLECELLA::pszText is valid.
#define MC_TCMF_PARAM 0x00000004 |
Set if MC_TABLECELLW::lParam or MC_TABLECELLA::lParam is valid.
#define MC_TCMF_FLAGS 0x00000008 |
Set if MC_TABLECELLW::dwFlags or MC_TABLECELLA::dwFlags is valid.
#define MC_TCF_ALIGNDEFAULT 0x00000000 |
Paint the cell value aligned horizontally as default for the value type.
#define MC_TCF_ALIGNLEFT 0x00000001 |
Paint the cell value aligned horizontally to left.
#define MC_TCF_ALIGNCENTER 0x00000003 |
Paint the cell value aligned horizontally to center.
#define MC_TCF_ALIGNRIGHT 0x00000002 |
Paint the cell value aligned horizontally to right.
#define MC_TCF_ALIGNVDEFAULT 0x00000000 |
Paint the cell value aligned vertically as normal for the value type.
#define MC_TCF_ALIGNTOP 0x00000004 |
Paint the cell value aligned vertically to top.
#define MC_TCF_ALIGNVCENTER 0x0000000C |
Paint the cell value aligned vertically to center.
#define MC_TCF_ALIGNBOTTOM 0x00000008 |
Paint the cell value aligned vertically to bottom.
#define MC_TCF_ALIGNMASKHORZ |
Bitmask for all cell flags specifying horizontal alignment.
#define MC_TCF_ALIGNMASKVERT |
Bitmask for all cell flags specifying vertical alignment.
#define MC_TABLECELL MCTRL_NAME_AW(MC_TABLECELL) |
Unicode-resolution alias.
#define mcTable_SetCell MCTRL_NAME_AW(mcTable_SetCell) |
Unicode-resolution alias.
#define mcTable_GetCell MCTRL_NAME_AW(mcTable_GetCell) |
Unicode-resolution alias.
typedef void* MC_HTABLE |
Opaque table handle.
MC_HTABLE mcTable_Create | ( | WORD | wColumnCount, |
WORD | wRowCount, | ||
DWORD | dwReserved | ||
) |
Create new table.
The table is initially empty and has its reference counter set to 1.
[in] | wColumnCount | Column count. |
[in] | wRowCount | Row count. |
dwReserved | Reserved. Set to zero. |
NULL
on failure. void mcTable_AddRef | ( | MC_HTABLE | hTable | ) |
Increment reference counter of the table.
[in] | hTable | The table. |
void mcTable_Release | ( | MC_HTABLE | hTable | ) |
Decrement reference counter of the table.
If the reference counter drops to zero, all resources allocated for the table are released.
[in] | hTable | The table. |
WORD mcTable_ColumnCount | ( | MC_HTABLE | hTable | ) |
Retrieve count of table columns.
[in] | hTable | The table. |
WORD mcTable_RowCount | ( | MC_HTABLE | hTable | ) |
Retrieve count of table rows.
[in] | hTable | The table. |
BOOL mcTable_Resize | ( | MC_HTABLE | hTable, |
WORD | wColumnCount, | ||
WORD | wRowCount | ||
) |
Resize the table.
If a table dimension decreases, the values from excessive cells are destroyed. If a table dimension increases, the new cells are initialized to empty values (in case of heterogeneous table) or to NULL
values (for homogeneous table).
[in] | hTable | The table. |
[in] | wColumnCount | Column count. |
[in] | wRowCount | Row count. |
TRUE
on success, FALSE
otherwise. void mcTable_Clear | ( | MC_HTABLE | hTable, |
DWORD | dwWhat | ||
) |
Clear the table.
Clears all cells of the table satisfying the condition as specified by dwWhat
.
[in] | hTable | The table. |
[in] | dwWhat | Specification of the cells to be cleared. When set to zero, all table contents (including header cells) is cleared. When non-zero, the value is interpreted as a bit-mask of cells to clear: Set bit 0x1 to clear all ordinary cells, 0x2 to clear column headers and bit 0x4 to clear row cells. |
BOOL mcTable_SetCellW | ( | MC_HTABLE | hTable, |
WORD | wCol, | ||
WORD | wRow, | ||
MC_TABLECELLW * | pCell | ||
) |
Set contents of a cell (Unicode variant).
[in] | hTable | The table. |
[in] | wCol | Column index. |
[in] | wRow | Row index. |
[in] | pCell | Specifies attributes of the cell to set. |
TRUE
on success, FALSE
otherwise. BOOL mcTable_SetCellA | ( | MC_HTABLE | hTable, |
WORD | wCol, | ||
WORD | wRow, | ||
MC_TABLECELLA * | pCell | ||
) |
Set contents of a cell (ANSI variant).
[in] | hTable | The table. |
[in] | wCol | Column index. |
[in] | wRow | Row index. |
[in] | pCell | Specifies attributes of the cell to set. |
TRUE
on success, FALSE
otherwise. BOOL mcTable_GetCellW | ( | MC_HTABLE | hTable, |
WORD | wCol, | ||
WORD | wRow, | ||
MC_TABLECELLW * | pCell | ||
) |
Get contents of a cell (Unicode variant).
Before calling this function, the member pCell->fMask
must specify what attributes of the cell to retrieve.
[in] | hTable | The table. |
[in] | wCol | Column index. |
[in] | wRow | Row index. |
[out] | pCell | Specifies retrieved attributes of the cell. |
TRUE
on success, FALSE
otherwise. BOOL mcTable_GetCellA | ( | MC_HTABLE | hTable, |
WORD | wCol, | ||
WORD | wRow, | ||
MC_TABLECELLA * | pCell | ||
) |
Get contents of a cell (ANSI variant).
Before calling this function, the member pCell->fMask
must specify what attributes of the cell to retrieve.
[in] | hTable | The table. |
[in] | wCol | Column index. |
[in] | wRow | Row index. |
[out] | pCell | Specifies retrieved attributes of the cell. |
TRUE
on success, FALSE
otherwise.