mCtrl  0.9.3
Data Structures
grid.h File Reference

Grid control (MC_WC_GRID). More...

Go to the source code of this file.

Data Structures

struct  MC_GGEOMETRY
 Structure describing inner geometry of the grid. More...
 

Initialization Functions

BOOL mcGrid_Initialize (void)
 
void mcGrid_Terminate (void)
 

Window Class

#define MC_WC_GRIDW   L"mCtrl.grid"
 
#define MC_WC_GRIDA   "mCtrl.grid"
 

Control Styles

#define MC_GS_NOTABLECREATE   0x0001
 Do not automatically create empty table. More...
 
#define MC_GS_NOGRIDLINES   0x0002
 Do not paint grid lines. More...
 
#define MC_GS_COLUMNHEADERNONE   0x0000
 Columns have no header. This is default. More...
 
#define MC_GS_COLUMNHEADERNUMBERED   0x1000
 Columns have numerical headers (i.e. "1", "2", "3" etc.) More...
 
#define MC_GS_COLUMNHEADERALPHABETIC   0x2000
 Columns have alphabetical headers (i.e. "A", "B", "C" etc.) More...
 
#define MC_GS_COLUMNHEADERCUSTOM   0x3000
 First table row is interpreted as column headers. More...
 
#define MC_GS_ROWHEADERNONE   0x0000
 Rows have no header. This is default. More...
 
#define MC_GS_ROWHEADERNUMBERED   0x4000
 Rows have numerical headers (i.e. "1", "2", "3" etc.) More...
 
#define MC_GS_ROWHEADERALPHABETIC   0x8000
 Rows have alphabetical headers (i.e. "A", "B", "C" etc.) More...
 
#define MC_GS_ROWHEADERCUSTOM   0xC000
 First table column is interpreted as row headers. More...
 

MC_GGEOMETRY::fMask Bits

#define MC_GGF_COLUMNHEADERHEIGHT   (1 << 0)
 Set if MC_GGEOMETRY::wColumnHeaderHeight is valid. More...
 
#define MC_GGF_ROWHEADERWIDTH   (1 << 1)
 Set if MC_GGEOMETRY::wRowHeaderWidth is valid. More...
 
#define MC_GGF_COLUMNWIDTH   (1 << 2)
 Set if MC_GGEOMETRY::wColumnWidth is valid. More...
 
#define MC_GGF_ROWHEIGHT   (1 << 3)
 Set if MC_GGEOMETRY::wRowHeight is valid. More...
 
#define MC_GGF_PADDINGHORZ   (1 << 4)
 Set if MC_GGEOMETRY::wPaddingHorz is valid. More...
 
#define MC_GGF_PADDINGVERT   (1 << 5)
 Set if MC_GGEOMETRY::wPaddingVert is valid. More...
 

Control Messages

#define MC_GM_GETTABLE   (MC_GM_FIRST + 0)
 Gets handle of table attached to the controlo or NULL if none is attached. More...
 
#define MC_GM_SETTABLE   (MC_GM_FIRST + 1)
 Attaches a table to the control. More...
 
#define MC_GM_GETCOLUMNCOUNT   (MC_GM_FIRST + 2)
 Gets count of columns in table attached to the control. More...
 
#define MC_GM_GETROWCOUNT   (MC_GM_FIRST + 3)
 Gets count of rows in table attached to the control. More...
 
#define MC_GM_RESIZE   (MC_GM_FIRST + 4)
 Resizes table attached to the control. More...
 
#define MC_GM_CLEAR   (MC_GM_FIRST + 5)
 Clears the table. More...
 
#define MC_GM_SETCELL   (MC_GM_FIRST + 6)
 Sets a table cell. More...
 
#define MC_GM_GETCELL   (MC_GM_FIRST + 7)
 Gets a table cell. More...
 
#define MC_GM_SETGEOMETRY   (MC_GM_FIRST + 8)
 Sets geometry of the grid. More...
 
#define MC_GM_GETGEOMETRY   (MC_GM_FIRST + 9)
 Sets geometry of the grid. More...
 
#define MC_GM_SETVALUE   (MC_GM_FIRST + 10)
 Sets a table value. More...
 
#define MC_GM_GETVALUE   (MC_GM_FIRST + 11)
 Gets a table value. More...
 

Unicode Resolution

#define MC_WC_GRID   MCTRL_NAME_AW(MC_WC_GRID)
 

Detailed Description

Grid control (MC_WC_GRID).

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

Actually all messages manipulating with contents of the table exist just for convenience: they just call corresponding function manipulating with the underlying MC_HTABLE. Thus the table can be resized, its contents can be changed and so on without use of the MC_HTABLE 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:


Data Structure Documentation

struct MC_GGEOMETRY

Structure describing inner geometry of the grid.

Structures

See Also
MC_GM_SETGEOMETRY MC_GM_GETGEOMETRY
Data Fields
DWORD fMask

Bitmask specifying what other members are valid. See MC_GGF_xxxx.

WORD wColumnHeaderHeight

Height of column header cells.

WORD wRowHeaderWidth

Width of row header cells.

WORD wColumnWidth

Width of regular contents cells.

WORD wRowHeight

Height of regular contents cells.

WORD wPaddingHorz

Horizontal padding in cells.

WORD wPaddingVert

Vertical padding in cells.

Macro Definition Documentation

#define MC_WC_GRIDW   L"mCtrl.grid"

Window class name (unicode variant).

#define MC_WC_GRIDA   "mCtrl.grid"

Window class name (ANSI variant).

#define MC_GS_NOTABLECREATE   0x0001

Do not automatically create empty table.

#define MC_GS_NOGRIDLINES   0x0002

Do not paint grid lines.

#define MC_GS_COLUMNHEADERNONE   0x0000

Columns have no header. This is default.

#define MC_GS_COLUMNHEADERNUMBERED   0x1000

Columns have numerical headers (i.e. "1", "2", "3" etc.)

#define MC_GS_COLUMNHEADERALPHABETIC   0x2000

Columns have alphabetical headers (i.e. "A", "B", "C" etc.)

#define MC_GS_COLUMNHEADERCUSTOM   0x3000

First table row is interpreted as column headers.

#define MC_GS_ROWHEADERNONE   0x0000

Rows have no header. This is default.

#define MC_GS_ROWHEADERNUMBERED   0x4000

Rows have numerical headers (i.e. "1", "2", "3" etc.)

#define MC_GS_ROWHEADERALPHABETIC   0x8000

Rows have alphabetical headers (i.e. "A", "B", "C" etc.)

#define MC_GS_ROWHEADERCUSTOM   0xC000

First table column is interpreted as row headers.

#define MC_GGF_COLUMNHEADERHEIGHT   (1 << 0)
#define MC_GGF_ROWHEADERWIDTH   (1 << 1)
#define MC_GGF_COLUMNWIDTH   (1 << 2)

Set if MC_GGEOMETRY::wColumnWidth is valid.

#define MC_GGF_ROWHEIGHT   (1 << 3)

Set if MC_GGEOMETRY::wRowHeight is valid.

#define MC_GGF_PADDINGHORZ   (1 << 4)

Set if MC_GGEOMETRY::wPaddingHorz is valid.

#define MC_GGF_PADDINGVERT   (1 << 5)

Set if MC_GGEOMETRY::wPaddingVert is valid.

#define MC_GM_GETTABLE   (MC_GM_FIRST + 0)

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
(MC_HTABLE) Handle of the table, or NULL.
#define MC_GM_SETTABLE   (MC_GM_FIRST + 1)

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_HTABLE) Handle of the table, or NULL.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETCOLUMNCOUNT   (MC_GM_FIRST + 2)

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   (MC_GM_FIRST + 3)

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   (MC_GM_FIRST + 4)

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   (MC_GM_FIRST + 5)

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   (MC_GM_FIRST + 6)

Sets a table cell.

Parameters
[in]wParam(DWORD) Low word specifies column, high word specifies row.
[in]lParam(MC_TABLECELL*) Pointer to structure describing the cell.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETCELL   (MC_GM_FIRST + 7)

Gets a table cell.

Before calling this function, the member MC_TABLECELL::fMask must specify what attributes of the cell to retrieve.

Parameters
[in]wParam(DWORD) Low word specifies column, high word specifies row.
[out]lParam(MC_TABLECELL*) Pointer to structure describing the cell.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_SETGEOMETRY   (MC_GM_FIRST + 8)

Sets geometry of the grid.

Parameters
wParamReserved, set to zero.
lParam@refMC_GGEOMETRY* "in" Pointer to structure describing the geometry. Only fields specified by the member fMask are set. If lParam is NULL, the geometry is reset to a default values.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETGEOMETRY   (MC_GM_FIRST + 9)

Sets geometry of the grid.

Parameters
wParamReserved, set to zero.
lParam@refMC_GGEOMETRY* "in,out" 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_GM_SETVALUE   (MC_GM_FIRST + 10)

Sets a table value.

Parameters
[in]wParam(DWORD) Low word specifies column, high word specifies row.
[in]lParam(MC_HVALUE) Pointer to the value.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_GM_GETVALUE   (MC_GM_FIRST + 11)

Gets a table value.

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

Parameters
[in]wParam(DWORD) Low word specifies column, high word specifies row.
lParamReserved, set to zero.
Returns
(MC_HVALUE) The value, NULL on failure.
#define MC_WC_GRID   MCTRL_NAME_AW(MC_WC_GRID)

Unicode-resolution alias.

See Also
MC_WC_GRIDW MC_WC_GRIDA

Function Documentation

BOOL mcGrid_Initialize ( void  )

Registers window class of the control.

Returns
TRUE on success, FALSE on failure.
void mcGrid_Terminate ( void  )

Unregisters window class of the control.