mCtrl 0.8.2
Data Structures | Functions

mCtrl/grid.h File Reference

Grid control (MC_WC_GRID). More...

Go to the source code of this file.

Data Structures

struct  MC_GCELL
 Structure for setting and getting cell of the table. More...
struct  MC_GGEOMETRY
 Structure describing inner geometry of the grid. More...

Defines

Window Class
#define MC_WC_GRIDW   L"mCtrl.grid"
 Window class name (unicode variant).
#define MC_WC_GRIDA   "mCtrl.grid"
 Window class name (ANSI variant).
Control Styles
#define MC_GS_NOTABLECREATE   (0x00000001L)
 Do not automatically create empty table.
#define MC_GS_NOGRIDLINES   (0x00000002L)
 Do not paint grid lines.
#define MC_GS_COLUMNHEADERNONE   (0x00000000L)
 Columns have no header. This is default.
#define MC_GS_COLUMNHEADERNUMBERED   (0x00001000L)
 Columns have numerical headers (i.e. "1", "2", "3" etc.)
#define MC_GS_COLUMNHEADERALPHABETIC   (0x00002000L)
 Columns have alphabetical headers (i.e. "A", "B", "C" etc.)
#define MC_GS_COLUMNHEADERCUSTOM   (0x00003000L)
 First row is interpreted as column headers.
#define MC_GS_ROWHEADERNONE   (0x00000000L)
 Rows have no header. This is default.
#define MC_GS_ROWHEADERNUMBERED   (0x00004000L)
 Rows have numerical headers (i.e. "1", "2", "3" etc.)
#define MC_GS_ROWHEADERALPHABETIC   (0x00008000L)
 Rows have alphabetical headers (i.e. "A", "B", "C" etc.)
#define MC_GS_ROWHEADERCUSTOM   (0x0000C000L)
 First columns is interpreted as row headers.
MC_GGEOMETRY::fMask Bits

#define MC_GGM_COLUMNHEADERHEIGHT   (1 << 0)
 Set if MC_GGEOMETRY::wColumnHeaderHeight is valid.
#define MC_GGM_ROWHEADERWIDTH   (1 << 1)
 Set if MC_GGEOMETRY::wRowHeaderWidth is valid.
#define MC_GGM_COLUMNWIDTH   (1 << 2)
 Set if MC_GGEOMETRY::wColumnWidth is valid.
#define MC_GGM_ROWHEIGHT   (1 << 3)
 Set if MC_GGEOMETRY::wRowHeight is valid.
#define MC_GGM_PADDINGHORZ   (1 << 4)
 Set if MC_GGEOMETRY::wPaddingHorz is valid.
#define MC_GGM_PADDINGVERT   (1 << 5)
 Set if MC_GGEOMETRY::wPaddingVert is valid.
Control Messages
#define MC_GM_GETTABLE   (WM_USER + 100)
 Gets handle of table attached to the controlo or NULL if none is attached.
#define MC_GM_SETTABLE   (WM_USER + 101)
 Attaches a table to the control.
#define MC_GM_GETCOLUMNCOUNT   (WM_USER + 102)
 Gets count of columns in table attached to the control.
#define MC_GM_GETROWCOUNT   (WM_USER + 103)
 Gets count of rows in table attached to the control.
#define MC_GM_RESIZE   (WM_USER + 104)
 Resizes table attached to the control.
#define MC_GM_CLEAR   (WM_USER + 109)
 Clears the table.
#define MC_GM_SETCELL   (WM_USER + 110)
 Sets a table cell.
#define MC_GM_GETCELL   (WM_USER + 111)
 Gets a table cell.
#define MC_GM_SETGEOMETRY   (WM_USER + 112)
 Sets geometry of the grid.
#define MC_GM_GETGEOMETRY   (WM_USER + 113)
 Sets geometry of the grid.
Unicode Resolution
#define MC_WC_GRID   MC_WC_GRIDW
 Unicode-resolution alias.

Functions

BOOL MCTRL_API mcGrid_Initialize (void)
 Registers window class of the grid control.
void MCTRL_API mcGrid_Terminate (void)
 Unregisters window class of the grid control.

Detailed Description

Grid control (MC_WC_GRID).

The grid control provides user interface for presentation of table data model (see MC_TABLE).

Actually all messages manipulating with contents of the table exist just for convenience: they just call corresponding function manipulating with the underlying MC_TABLE. Thus the table can be resized, its contents can be changed and so on without use of the MC_TABLE API.

By default, the control creates an empty heterogenous table during its creation. You can avoid that by the style MC_GS_NOTABLECREATE. In that case however you have to attach some table to the control manually with the message MC_GM_SETTABLE. Until you do so, all messages attempting to modify the underlying table will just fail.

MC_GM_SETTABLE together with MC_GM_GETTABLE allows attaching one table to multiple controls.

Messages which do not manipulate with the table determine how the table is presented and these are tied to the control. I.e. if any table is attached to multiple control, each of the controls can present the table in other way (e.g. have another dimensions for each cell etc.).

These standard messages are handled by MC_WC_GRID control:


Define Documentation

#define MC_GM_GETTABLE   (WM_USER + 100)

Gets handle of table attached to the controlo or NULL if none is attached.

Note that calling the message does not change reference counter of the returned table. If you want to preserve the handle, you should call mcTable_AddRef() on it and then mcTable_Release() when you no longer need it.

Parameters:
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns:
(&ref MC_TABLE) Handle of the table, or NULL.
#define MC_GM_SETTABLE   (WM_USER + 101)

Attaches a table to the control.

Reference counter of the table is incremented. Previously attached table (if any) is detached and its reference counter is decremented.

If the wParam is NULL, the control creates new table (with reference count set to one), unless the control has style MC_GS_NOTABLECREATE.

Parameters:
wParamReserved, set to zero.
[in]lParam(MC_TABLE) Handle of the table, or NULL.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETCOLUMNCOUNT   (WM_USER + 102)

Gets count of columns in table attached to the control.

Parameters:
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns:
(WORD) Returns count of table columns.
#define MC_GM_GETROWCOUNT   (WM_USER + 103)

Gets count of rows in table attached to the control.

Parameters:
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns:
(WORD) Returns count of table rows.
#define MC_GM_RESIZE   (WM_USER + 104)

Resizes table attached to the control.

Parameters:
[in]wParam(DWORD) The low-order word specifies count of columns, high-order word specifies count of rows.
lParamReserved, set to zero.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_CLEAR   (WM_USER + 109)

Clears the table.

Parameters:
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns:
Not defined, do not rely on return value.
#define MC_GM_SETCELL   (WM_USER + 110)

Sets a table cell.

Parameters:
wParamReserved, set to zero.
lParam[in](MC_GCELL*) Pointer to structure describing the cell.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETCELL   (WM_USER + 111)

Gets a table cell.

Caller has to fill MC_GCELL::wCol and MC_GCELL::wRow before sending this message.

Parameters:
wParamReserved, set to zero.
[in,out]lParam(MC_GCELL*) Pointer to structure describing the cell.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_SETGEOMETRY   (WM_USER + 112)

Sets geometry of the grid.

Parameters:
wParamReserved, set to zero.
lParam[in](MC_GGEOMETRY*) Pointer to structure describing the geometry. Only fields specified by the member fMask are set.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETGEOMETRY   (WM_USER + 113)

Sets geometry of the grid.

Parameters:
wParamReserved, set to zero.
lParam[in,out](MC_GGEOMETRY*) Pointer to structure describing the geometry. Only fields specified by the member fMask are retrieved.
Returns:
(BOOL) TRUE on success, FALSE on failure.
#define MC_WC_GRID   MC_WC_GRIDW

Unicode-resolution alias.

See also:
MC_WC_GRIDW MC_WC_GRIDA

Function Documentation

BOOL MCTRL_API mcGrid_Initialize ( void  )

Registers window class of the grid control.

Returns:
TRUE on success, FALSE on failure.
See also:
About Initialization and Termination
void MCTRL_API mcGrid_Terminate ( void  )

Unregisters window class of the grid control.

See also:
About Initialization and Termination