mCtrl 0.8.0
|
Grid control (MC_WC_GRID
).
More...
Go to the source code of this file.
Data Structures | |
struct | MC_GCELL |
Structure for manipulating with the tab item (unicode variant). 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). | |
#define | MC_WC_GRID MC_WC_GRIDW |
Unicode-resolution alias. | |
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. | |
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_GETCELL (WM_USER + 111) |
Gets a table cell. | |
#define | MC_GM_SETCELL (WM_USER + 110) |
Sets a table cell. | |
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. |
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:
WM_GETFONT
WM_SETFONT
WM_SETREDRAW
#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.
wParam | Reserved, set to zero. |
lParam | Reserved, set to zero. |
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.
wParam | Reserved, set to zero. | |
[in] | lParam | (MC_TABLE) Handle of the table, or NULL . |
BOOL
) TRUE
on success, FALSE
on failure. #define MC_GM_GETCOLUMNCOUNT (WM_USER + 102) |
Gets count of columns in table attached to the control.
wParam | Reserved, set to zero. |
lParam | Reserved, set to zero. |
WORD
) Returns count of table columns. #define MC_GM_GETROWCOUNT (WM_USER + 103) |
Gets count of rows in table attached to the control.
wParam | Reserved, set to zero. |
lParam | Reserved, set to zero. |
WORD
) Returns count of table rows. #define MC_GM_RESIZE (WM_USER + 104) |
Resizes table attached to the control.
[in] | wParam | (DWORD ) The low-order word specifies count of columns, high-order word specifies count of rows. |
lParam | Reserved, set to zero. |
BOOL
) TRUE
on success, FALSE
on failure. #define MC_GM_CLEAR (WM_USER + 109) |
Clears the table.
wParam | Reserved, set to zero. |
lParam | Reserved, set to zero. |
#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.
wParam | Reserved, set to zero. | |
[in,out] | lParam | (MC_GCELL*) Pointer to structure describing the cell. |
BOOL
) TRUE
on success, FALSE
on failure. #define MC_GM_SETCELL (WM_USER + 110) |
Sets a table cell.
wParam | Reserved, set to zero. |
lParam[in] | (MC_GCELL*) Pointer to structure describing the cell. |
BOOL
) TRUE
on success, FALSE
on failure. BOOL MCTRL_API mcGrid_Initialize | ( | void | ) |
Registers window class of the grid control.
TRUE
on success, FALSE
on failure. void MCTRL_API mcGrid_Terminate | ( | void | ) |
Unregisters window class of the grid control.