mCtrl  0.9.6
Data Structures
treelist.h File Reference

Go to the source code of this file.

Detailed Description

Tree-list view control (MC_WC_TREELIST).

Tree-list view control mixes concepts of standard list view control in the report mode (i.e. with the style LVS_REPORT) and tree view. As the list view control with the LVS_REPORT style, the tree-list is usually divided into multiple columns, which can be manipulated with standard header control (child window of the tree-list control).

Unlike the standard list view control, the left-most column resembles the standard tree view control, both in its user experience as well as with its programming interface.

Columns

Usually the very first step after creation of the control, application sets its columns. The messages (MC_TLM_INSERTCOLUMN, MC_TLM_SETCOLUMN etc.) and structure (MC_TLCOLUMN) for this task are very similar to the corresponding messages of the standard list view control.

Note however that the tree-list control manages the left-most column (i.e. the column with index 0) a bit specially. This column is always used for displaying the tree-like hierarchy of all items and the control prevents such changes, which would make the column with index 0 on other position then the left-most one (i.e. for column 0, its MC_TLCOLUMN::iOrder is always 0 too).

Applications attempts to break this rule (e.g. with resetting the order via MC_TLM_SETCOLUMN) will cause the message to fail. The control also supports style MC_TLS_HEADERDRAGDROP which allows user to reorder the columns with mouse, but once again the control prevents change of the order to the left-most column.

Items, Child Items and Subitems

Similarly as the standard list view control, the tree-list view control distinguishes between items and subitems. The item (MC_TLITEM) describes state of the item (or row) as a whole, it also determines its position in the tree hierarchy, and finally contains data to be displayed in the left-most column.

The subitems (MC_TLSUBITEM) then just hold data for the additional columns of each item (currently only textual label). Note that in this regard the tree-list control differs from list view control where the items as well as the subitems are actually described by single structure LVITEM. (The reason behind this is that the item structure is principally different due its tree-like nature.)

Like the tree control, each item can have its child items, which are displayed or hidden depending on the expanded state of their parent.

Inserting the items into the control is very similar to the standard tree view control. The message MC_TLM_INSERTITEM takes pointer to the structure MC_TLINSERTSTRUCT describing the item as well as its desired position in the tree as its parameters. The message returns an item handle (MC_HTREELISTITEM) representing the new item, and this may be used to set subitems of the item to insert child items (see below) and for other manipulations with the item. Of course there are also special pseudo handles MC_TLI_ROOT, MC_TLI_FIRST and MC_TLI_LAST which fulfill similar role as the tree view counterparts TVI_ROOT, TVI_FIRST and TVI_LAST.

Note that when any item is deleted (MC_TLM_DELETEITEM), then the whole subtree of its children is deleted as well.

Dynamically Populated Tree-lists

Every single item inserted into the control takes about 40 bytes (32-bit build) or about 80 bytes respectively (64-bit build), excluding label strings and subitems. If you need to create tree hierarchy of huge number of items, it may consume quite large amount of memory.

The control addresses this issue by allowing application to populate the control dynamically, ad hoc, when an items are expanded, and optionally to release child items when parent items are collapsed.

For huge trees, it is unlikely the user will expand all items, and hence only the expanded items eat the memory.

To support this mechanism, the application initially inserts only root items, and sets MC_TLITEM::cChildren ti indicate whether the item has children or not.

When user attempts to expand the item, the application has to insert the child items dynamically. To achieve this, the application must handle the notification MC_TLN_EXPANDING and check the MC_NMTREELIST::action for MC_TLE_EXPAND.

In a similar manner the application may delete the child items if MC_NMTREELIST::action is set to MC_TLE_COLLAPSE. It may do so by sending MC_TLM_EXPAND with WPARAM set to MC_TLE_COLLAPSE | MC_TLE_COLLAPSERESET.

Multi-selection

The control supports selecting multiple items. To enable this feature, use the style MC_TLS_MULTISELECT. However note that only sibling items, i.e. items belonging to the same parent (or root items) can form the multi-selection.

Also note that when this style is used, the selection-related notifications MC_TLS_SELCHANING and MC_TLS_SELCHANGED behave differently. Refer to their respective documentation for more details.

Item and Subitem Callbacks

The control can be told to ask parent instead of remembering some attributes of items and subitems. Especially for item and subsystem texts, this technique allows further reduction of memory consumption by the control.

To use the callbacks, you can set item or subitem texts to MC_LPSTR_TEXTCALLBACK, any item image to MC_I_IMAGECALLBACK, and/or item cChildren member to MC_I_CHILDRENCALLBACK.

Whenever the control needs to paint the item/subitem, it then sends a notification MC_TLN_GETDISPINFO (for item) or MC_TLN_GETSUBDISPINFO (for subitem), with fMask specifying what members of it the application has to fill.

Standard Messages

These standard messages are handled by the control:

These standard notifications are sent by the control:

Data Structures

struct  MC_TLCOLUMNW
 Structure describing column of the tree-list view (Unicode variant). More...
 
struct  MC_TLCOLUMNA
 Structure describing column of the tree-list view (ANSI variant). More...
 
struct  MC_TLITEMW
 Structure describing item of the tree-list view (Unicode variant). More...
 
struct  MC_TLITEMA
 Structure describing item of the tree-list view (ANSI variant). More...
 
struct  MC_TLSUBITEMW
 Structure describing subitem of the tree-list view (Unicode variant). More...
 
struct  MC_TLSUBITEMA
 Structure describing subitem of the tree-list view (ANSI variant). More...
 
struct  MC_TLINSERTSTRUCTW
 Structure used for inserting an item (Unicode variant). More...
 
struct  MC_TLINSERTSTRUCTA
 Structure used for inserting an item (ANSI variant). More...
 
struct  MC_TLHITTESTINFO
 Structure for message MC_MTM_HITTEST. More...
 
struct  MC_NMTREELIST
 Structure used by many control notifications. More...
 
struct  MC_NMTLCUSTOMDRAW
 Structure used by the standard notification NM_CUSTOMDRAW. More...
 
struct  MC_NMTLDISPINFOW
 Structure used by notifications MC_TLN_GETDISPINFO and MC_TLN_SETDISPINFO (Unicode variant). More...
 
struct  MC_NMTLDISPINFOA
 Structure used by notifications MC_TLN_GETDISPINFO and MC_TLN_SETDISPINFO (ANSI variant). More...
 
struct  MC_NMTLSUBDISPINFOW
 Structure used by notifications MC_TLN_GETSUBDISPINFO and MC_TLN_SETSUBDISPINFO (Unicode variant). More...
 
struct  MC_NMTLSUBDISPINFOA
 Structure used by notifications MC_TLN_GETSUBDISPINFO and MC_TLN_SETSUBDISPINFO (ANSI variant). More...
 

Initialization Functions

BOOL mcTreeList_Initialize (void)
 
void mcTreeList_Terminate (void)
 

Window Class

#define MC_WC_TREELISTW   L"mCtrl.treelist"
 
#define MC_WC_TREELISTA   "mCtrl.treelist"
 

Control Styles

#define MC_TLS_HASBUTTONS   0x0001
 Display expand/collapse buttons next to parent items. More...
 
#define MC_TLS_HASLINES   0x0002
 Use lines to show hierarchy of items. More...
 
#define MC_TLS_LINESATROOT   0x0004
 Use lines to link root items. More...
 
#define MC_TLS_GRIDLINES   0x0008
 Paint grid lines. More...
 
#define MC_TLS_SHOWSELALWAYS   0x0010
 Show selection even when not having a focus. More...
 
#define MC_TLS_FULLROWSELECT   0x0020
 Enable full row select in the control and the entire row of selected item is highlighted. More...
 
#define MC_TLS_NONEVENHEIGHT   0x0040
 Allows item height to be an odd number. More...
 
#define MC_TLS_DOUBLEBUFFER   0x0080
 Use double-buffering when painting. More...
 
#define MC_TLS_NOCOLUMNHEADER   0x0100
 Hide column headers. More...
 
#define MC_TLS_HEADERDRAGDROP   0x0200
 Enable column reordering by mouse drag & drop. More...
 
#define MC_TLS_SINGLEEXPAND   0x0400
 Selected item is automatically expanded and deselected item is automatically collapsed. More...
 
#define MC_TLS_MULTISELECT   0x0800
 Allow multiple selected items. More...
 

MC_TLCOLUMN::fMask Bits

#define MC_TLCF_FORMAT   (1 << 0)
 Set if MC_TLCOLUMNW::fmt or MC_TLCOLUMNA::fmt is valid. More...
 
#define MC_TLCF_WIDTH   (1 << 1)
 Set if MC_TLCOLUMNW::cx or MC_TLCOLUMNA::cx is valid. More...
 
#define MC_TLCF_TEXT   (1 << 2)
 Set if MC_TLCOLUMNW::pszText and ref MC_TLCOLUMNW::cchTextMax, or MC_TLCOLUMNA::pszText and ref MC_TLCOLUMNA::cchTextMax are valid. More...
 
#define MC_TLCF_IMAGE   (1 << 3)
 Set if MC_TLCOLUMNW::iImage or MC_TLCOLUMNA::iImage is valid. More...
 
#define MC_TLCF_ORDER   (1 << 4)
 Set if MC_TLCOLUMNW::iOrder or MC_TLCOLUMNA::iOrder is valid. More...
 

MC_TLCOLUMN::fmt Bits

#define MC_TLFMT_LEFT   0x0
 Text is aligned to left. More...
 
#define MC_TLFMT_RIGHT   0x1
 Text is aligned to right. More...
 
#define MC_TLFMT_CENTER   0x2
 Text is centered. More...
 
#define MC_TLFMT_JUSTIFYMASK   0x3
 A bit-mask of bits for justification. More...
 

Item Pseudo-handles

#define MC_TLI_ROOT   ((MC_HTREELISTITEM)(ULONG_PTR) -0x10000)
 Special handle value denoting root item. More...
 
#define MC_TLI_FIRST   ((MC_HTREELISTITEM)(ULONG_PTR) -0xffff)
 Special handle first child of a parent item. More...
 
#define MC_TLI_LAST   ((MC_HTREELISTITEM)(ULONG_PTR) -0xfffe)
 Special handle last child of a parent item. More...
 

MC_TLITEM::fMask Bits

#define MC_TLIF_STATE   (1 << 0)
 Set if MC_TLITEM::state and MC_TLITEM::stateMask is valid. More...
 
#define MC_TLIF_TEXT   (1 << 1)
 Set if MC_TLITEM::pszText and MC_TLITEM::cchTextMax is valid. More...
 
#define MC_TLIF_PARAM   (1 << 2)
 Set if MC_TLITEM::lParam is valid. More...
 
#define MC_TLIF_LPARAM   (1 << 2)
 Set if MC_TLITEM::lParam is valid. More...
 
#define MC_TLIF_IMAGE   (1 << 3)
 Set if MC_TLITEM::iImage is valid. More...
 
#define MC_TLIF_SELECTEDIMAGE   (1 << 4)
 Set if MC_TLITEM::iSelectedImage is valid. More...
 
#define MC_TLIF_EXPANDEDIMAGE   (1 << 5)
 Set if MC_TLITEM::iExpandedImage is valid. More...
 
#define MC_TLIF_CHILDREN   (1 << 6)
 Set if MC_TLITEM::cChildren is valid. More...
 

MC_TLITEM::state Bits

#define MC_TLIS_SELECTED   (1 << 1)
 The item is selected. More...
 
#define MC_TLIS_EXPANDED   (1 << 5)
 The item is expanded. More...
 

MC_TLSUBITEM::fMask Bits

The item is highlighted.

#define MC_TLSIF_TEXT   (1 << 1)
 Set if MC_TLSUBITEM::pszText and MC_TLSUBITEM::cchTextMax is valid. More...
 

MC_TLHITTESTINFO::flags Bits

#define MC_TLHT_NOWHERE   (1 << 0)
 In the client area, but does not hit any item. More...
 
#define MC_TLHT_ONITEMICON   (1 << 1)
 Never set, reserved for future. More...
 
#define MC_TLHT_ONITEMSTATEICON   (1 << 2)
 Never set, reserved for future. More...
 
#define MC_TLHT_ONITEMLABEL   (1 << 3)
 On (sub)item label. More...
 
#define MC_TLHT_ONITEM   (MC_TLHT_ONITEMICON | MC_TLHT_ONITEMSTATEICON | MC_TLHT_ONITEMLABEL)
 On (sub)item. More...
 
#define MC_TLHT_ONITEMINDENT   (1 << 4)
 On item indentation. More...
 
#define MC_TLHT_ONITEMBUTTON   (1 << 5)
 On item expand/collapse button. More...
 
#define MC_TLHT_ONITEMRIGHT   (1 << 6)
 To right of the (sub)item. More...
 
#define MC_TLHT_ONITEMLEFT   (1 << 7)
 To left of the (sub)item. This can happen only for subitems in a column with other then left justification. More...
 
#define MC_TLHT_ABOVE   (1 << 8)
 Above the client area. More...
 
#define MC_TLHT_BELOW   (1 << 9)
 Below the client area. More...
 
#define MC_TLHT_TORIGHT   (1 << 10)
 To right of the client area. More...
 
#define MC_TLHT_TOLEFT   (1 << 11)
 To left of the client area. More...
 

Action Flags for MC_TLM_EXPAND

#define MC_TLE_COLLAPSE   0x1
 Collapse the child items. More...
 
#define MC_TLE_EXPAND   0x2
 Expand the child items. More...
 
#define MC_TLE_TOGGLE   0x3
 Collapse the child items if expanded, or expand them if collapsed. More...
 
#define MC_TLE_COLLAPSERESET   0x8000
 Delete all children of the collapsed item. More...
 

Item Relationship Flags for MC_TLM_GETNEXTITEM

#define MC_TLGN_ROOT   0x0
 Get first root item, or NULL if there are no items. More...
 
#define MC_TLGN_NEXT   0x1
 Get next sibling item of the specified item, or NULL if no such sibling exists. More...
 
#define MC_TLGN_PREVIOUS   0x2
 Get previous sibling item of the specified item, or NULL if no such sibling exists. More...
 
#define MC_TLGN_PARENT   0x3
 Get parent item of of the specified item, or NULL if the item is root. More...
 
#define MC_TLGN_CHILD   0x4
 Get first child item of the specified item, or NULL it the item has no children. More...
 
#define MC_TLGN_FIRSTVISIBLE   0x5
 Get first visible item, or NULL if there are no items. More...
 
#define MC_TLGN_NEXTVISIBLE   0x6
 Get next visible item, or NULL if no visible item follows. More...
 
#define MC_TLGN_PREVIOUSVISIBLE   0x7
 Get previous visible item, or NULL if no visible item precedes the specified item. More...
 
#define MC_TLGN_CARET   0x9
 Get (next) selected item, or NULL if no (other) item is selected. More...
 
#define MC_TLGN_LASTVISIBLE   0xa
 Get last visible item, or NULL if there are no items. More...
 

Structures

typedef void * MC_HTREELISTITEM
 Opaque handle type representing item of the control. More...
 

Control Messages

#define MC_TLM_INSERTCOLUMNW   (MC_TLM_FIRST + 0)
 Insert a new column (Unicode variant). More...
 
#define MC_TLM_INSERTCOLUMNA   (MC_TLM_FIRST + 1)
 Insert a new column (ANSI variant). More...
 
#define MC_TLM_SETCOLUMNW   (MC_TLM_FIRST + 2)
 Sets attributes of a column (Unicode variant). More...
 
#define MC_TLM_SETCOLUMNA   (MC_TLM_FIRST + 3)
 Sets attributes of a column (ANSI variant). More...
 
#define MC_TLM_GETCOLUMNW   (MC_TLM_FIRST + 4)
 Gets attributes of a column (Unicode variant). More...
 
#define MC_TLM_GETCOLUMNA   (MC_TLM_FIRST + 5)
 Gets attributes of a column (ANSI variant). More...
 
#define MC_TLM_DELETECOLUMN   (MC_TLM_FIRST + 6)
 Delete a column from the control. More...
 
#define MC_TLM_SETCOLUMNORDERARRAY   (MC_TLM_FIRST + 7)
 Sets left-to-right order of columns. More...
 
#define MC_TLM_GETCOLUMNORDERARRAY   (MC_TLM_FIRST + 8)
 Gets left-to-right order of columns. More...
 
#define MC_TLM_SETCOLUMNWIDTH   (MC_TLM_FIRST + 9)
 Changes width of a column. More...
 
#define MC_TLM_GETCOLUMNWIDTH   (MC_TLM_FIRST + 10)
 Gets width of a column. More...
 
#define MC_TLM_INSERTITEMW   (MC_TLM_FIRST + 11)
 Insert new item into the control (Unicode variant). More...
 
#define MC_TLM_INSERTITEMA   (MC_TLM_FIRST + 12)
 Insert new item into the control (ANSI variant). More...
 
#define MC_TLM_SETITEMW   (MC_TLM_FIRST + 13)
 Set item attributes (Unicode variant). More...
 
#define MC_TLM_SETITEMA   (MC_TLM_FIRST + 14)
 Set item attributes (ANSI variant). More...
 
#define MC_TLM_GETITEMW   (MC_TLM_FIRST + 15)
 Get item attributes (Unicode variant). More...
 
#define MC_TLM_GETITEMA   (MC_TLM_FIRST + 16)
 Get item attributes (ANSI variant). More...
 
#define MC_TLM_DELETEITEM   (MC_TLM_FIRST + 17)
 Delete item from the control. More...
 
#define MC_TLM_SETITEMHEIGHT   (MC_TLM_FIRST + 18)
 Set explicitly height of items. More...
 
#define MC_TLM_GETITEMHEIGHT   (MC_TLM_FIRST + 19)
 Get height of items. More...
 
#define MC_TLM_SETSUBITEMW   (MC_TLM_FIRST + 20)
 Set subitem attributes (Unicode variant). More...
 
#define MC_TLM_SETSUBITEMA   (MC_TLM_FIRST + 21)
 Set subitem attributes (ANSI variant). More...
 
#define MC_TLM_GETSUBITEMW   (MC_TLM_FIRST + 22)
 Get subitem attributes (Unicode variant). More...
 
#define MC_TLM_GETSUBITEMA   (MC_TLM_FIRST + 23)
 Get subitem attributes (ANSI variant). More...
 
#define MC_TLM_SETINDENT   (MC_TLM_FIRST + 24)
 Set item indentation. More...
 
#define MC_TLM_GETINDENT   (MC_TLM_FIRST + 25)
 Get item indentation. More...
 
#define MC_TLM_HITTEST   (MC_TLM_FIRST + 26)
 Tests which item or subitem (and its part) is placed on specified position. More...
 
#define MC_TLM_EXPAND   (MC_TLM_FIRST + 27)
 Expand or collapse child items. More...
 
#define MC_TLM_GETNEXTITEM   (MC_TLM_FIRST + 28)
 Get item of the specified relationship to a specified item. More...
 
#define MC_TLM_GETVISIBLECOUNT   (MC_TLM_FIRST + 29)
 Gets count of items which currently fit into the client area. More...
 
#define MC_TLM_ENSUREVISIBLE   (MC_TLM_FIRST + 30)
 Ensure the item is visible. More...
 
#define MC_TLM_SETIMAGELIST   (MC_TLM_FIRST + 31)
 Associates an image list with the control. More...
 
#define MC_TLM_GETIMAGELIST   (MC_TLM_FIRST + 32)
 Gets an image list associated with the control. More...
 
#define MC_TLM_GETSELECTEDCOUNT   (MC_TLM_FIRST + 33)
 Returns the number of currently selected items. More...
 

Control Notifications

#define MC_TLN_DELETEITEM   (MC_TLN_FIRST + 0)
 Fired when deleting an item. More...
 
#define MC_TLN_SELCHANGING   (MC_TLN_FIRST + 1)
 Fired when a selection item is about to change. More...
 
#define MC_TLN_SELCHANGED   (MC_TLN_FIRST + 2)
 Fired when selection has changed. More...
 
#define MC_TLN_EXPANDING   (MC_TLN_FIRST + 3)
 Fired when a parent item is about to expand or collapse. More...
 
#define MC_TLN_EXPANDED   (MC_TLN_FIRST + 4)
 Fired when a parent item has expanded or collapsed. More...
 
#define MC_TLN_GETDISPINFOW   (MC_TLN_FIRST + 7)
 Fired when control needs to retrieve some item data, the parent holds (Unicode variant). More...
 
#define MC_TLN_GETDISPINFOA   (MC_TLN_FIRST + 8)
 Fired when control needs to retrieve some item data, the parent holds (ANSI variant). More...
 
#define MC_TLN_GETSUBDISPINFOW   (MC_TLN_FIRST + 11)
 
#define MC_TLN_GETSUBDISPINFOA   (MC_TLN_FIRST + 12)
 

Unicode Resolution

#define MC_WC_TREELIST   MCTRL_NAME_AW(MC_WC_TREELIST)
 
#define MC_TLCOLUMN   MCTRL_NAME_AW(MC_TLCOLUMN)
 
#define MC_TLITEM   MCTRL_NAME_AW(MC_TLITEM)
 
#define MC_TLSUBITEM   MCTRL_NAME_AW(MC_TLSUBITEM)
 
#define MC_TLINSERTSTRUCT   MCTRL_NAME_AW(MC_TLINSERTSTRUCT)
 
#define MC_NMTLDISPINFO   MCTRL_NAME_AW(MC_NMTLDISPINFO)
 
#define MC_NMTLSUBDISPINFO   MCTRL_NAME_AW(MC_NMTLSUBDISPINFO)
 
#define MC_TLM_SETCOLUMN   MCTRL_NAME_AW(MC_TLM_SETCOLUMN)
 
#define MC_TLM_INSERTCOLUMN   MCTRL_NAME_AW(MC_TLM_INSERTCOLUMN)
 
#define MC_TLM_SETCOLUMN   MCTRL_NAME_AW(MC_TLM_SETCOLUMN)
 
#define MC_TLM_GETCOLUMN   MCTRL_NAME_AW(MC_TLM_GETCOLUMN)
 
#define MC_TLM_INSERTITEM   MCTRL_NAME_AW(MC_TLM_INSERTITEM)
 
#define MC_TLM_SETITEM   MCTRL_NAME_AW(MC_TLM_SETITEM)
 
#define MC_TLM_GETITEM   MCTRL_NAME_AW(MC_TLM_GETITEM)
 
#define MC_TLM_SETSUBITEM   MCTRL_NAME_AW(MC_TLM_SETSUBITEM)
 
#define MC_TLM_GETSUBITEM   MCTRL_NAME_AW(MC_TLM_GETSUBITEM)
 
#define MC_TLN_SETDISPINFO   MCTRL_NAME_AW(MC_TLN_SETDISPINFO)
 
#define MC_TLN_GETDISPINFO   MCTRL_NAME_AW(MC_TLN_GETDISPINFO)
 
#define MC_TLN_SETSUBDISPINFO   MCTRL_NAME_AW(MC_TLN_SETSUBDISPINFO)
 
#define MC_TLN_GETSUBDISPINFO   MCTRL_NAME_AW(MC_TLN_GETSUBDISPINFO)
 

Data Structure Documentation

struct MC_TLCOLUMNW

Structure describing column of the tree-list view (Unicode variant).

See Also
MC_TLM_INSERTCOLUMNW MC_TLM_SETCOLUMNW MC_TLM_GETCOLUMNW
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLCF_xxxx.

int fmt

Alignment of the column header and the subitem text in the column. Note the alignment of leftmost column is always MC_TLFMT_LEFT; it cannot be changed. See MC_TLFMT_xxxx.

int cx

Width of the column in pixels.

WCHAR * pszText

Pointer to buffer with column text.

int cchTextMax

Size of the buffer pointed by pszText.

int iImage

Zero-based index of image in the image list.

int iOrder

Zero-based offset of the column (zero indicates the left-most column).

struct MC_TLCOLUMNA

Structure describing column of the tree-list view (ANSI variant).

See Also
MC_TLM_INSERTCOLUMNA MC_TLM_SETCOLUMNA MC_TLM_GETCOLUMNA
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLCF_xxxx.

int fmt

Alignment of the column header and the subitem text in the column. Note the alignment of leftmost column is always MC_TLFMT_LEFT; it cannot be changed. See MC_TLFMT_xxxx.

int cx

Width of the column in pixels.

char * pszText

Pointer to buffer with column text.

int cchTextMax

Size of the buffer pointed by pszText.

int iImage

Zero-based index of image in the image list.

int iOrder

Zero-based offset of the column (zero indicates the left-most column).

struct MC_TLITEMW

Structure describing item of the tree-list view (Unicode variant).

See Also
MC_TLM_INSERTITEMW MC_TLM_SETITEMW MC_TLM_GETITEMW
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLIF_xxxx.

UINT state

State of the item. See MC_TLIS_xxxx.

UINT stateMask

Mask determining what bits of state are valid. Ignored when getting the item data.

WCHAR * pszText

The item text. Can be MC_LPSTR_TEXTCALLBACK.

int cchTextMax

Size of the buffer pointed with pszText. Ignored when setting the item data.

LPARAM lParam

User data.

int iImage

Image. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int iSelectedImage

Image when selected. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int iExpandedImage

Image when expanded. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int cChildren

Flag indicating whether the item has children. When set to 1, control assumes it has children even though application has not inserted them. Can be MC_I_CHILDRENCALLBACK

struct MC_TLITEMA

Structure describing item of the tree-list view (ANSI variant).

See Also
MC_TLM_INSERTITEMA MC_TLM_SETITEMA MC_TLM_GETITEMA
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLIF_xxxx.

UINT state

State of the item. See MC_TLIS_xxxx.

UINT stateMask

Mask determining what bits of state are valid. Ignored when getting the item data.

char * pszText

The item text. Can be MC_LPSTR_TEXTCALLBACK.

int cchTextMax

Size of the buffer pointed with pszText. Ignored when setting the item data.

LPARAM lParam

User data.

int iImage

Image. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int iSelectedImage

Image when selected. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int iExpandedImage

Image when expanded. Can be MC_I_IMAGENONE or MC_I_IMAGECALLBACK.

int cChildren

Flag indicating whether the item has children. When set to 1, control assumes it has children even though application has not inserted them. Can be MC_I_CHILDRENCALLBACK

struct MC_TLSUBITEMW

Structure describing subitem of the tree-list view (Unicode variant).

See Also
MC_TLM_SETSUBITEMW MC_TLM_GETSUBITEMW
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLSIF_xxxx.

int iSubItem

ID of subitem to set or get.

WCHAR * pszText

Subitem text. Can be MC_LPSTR_TEXTCALLBACK.

int cchTextMax

Size of the buffer pointed with pszText. Ignored when setting the item data.

struct MC_TLSUBITEMA

Structure describing subitem of the tree-list view (ANSI variant).

See Also
MC_TLM_SETSUBITEMA MC_TLM_GETSUBITEMA
Data Fields
UINT fMask

Bit-mask specifying what other members are valid. See MC_TLSIF_xxxx.

int iSubItem

ID of subitem to set or get.

char * pszText

The subitem text. Can be MC_LPSTR_TEXTCALLBACK.

int cchTextMax

Size of the buffer pointed with pszText. Ignored when setting the item data.

struct MC_TLINSERTSTRUCTW

Structure used for inserting an item (Unicode variant).

See Also
MC_TLM_INSERTITEMW
Data Fields
MC_HTREELISTITEM hParent

Handle of parent item where to insert the item or MC_TLI_ROOT.

MC_HTREELISTITEM hInsertAfter

Handle of parent item where to insert the item. Can be MC_TLI_FIRST or MC_TLI_LAST.

MC_TLITEMW item

The new item data.

struct MC_TLINSERTSTRUCTA

Structure used for inserting an item (ANSI variant).

See Also
MC_TLM_INSERTITEMA
Data Fields
MC_HTREELISTITEM hParent

Handle of parent item where to insert the item or MC_TLI_ROOT.

MC_HTREELISTITEM hInsertAfter

Handle of parent item where to insert the item. Can be MC_TLI_FIRST or MC_TLI_LAST.

MC_TLITEMA item

The new item data.

struct MC_TLHITTESTINFO

Structure for message MC_MTM_HITTEST.

Data Fields
POINT pt

Client coordinate of the point to test.

UINT flags

Flag receiving detail about result of the test. See MC_TLHT_xxxx

MC_HTREELISTITEM hItem

Handle of the item that occupies the point.

int iSubItem

Index of the subitem that occupies the point (or zero if it is the item itself).

struct MC_NMTREELIST

Structure used by many control notifications.

Many control notifications use this structure to provide the information about what happens. Refer to documentation of particular messages how it sets the members of the structure. Members not actually used by the notification can be used in future versions of MCTRL.DLL so do not rely on their value.

If the notification specifies old and/or new item, their its handle and lParam is stored. If application needs additional information about the item it has to use MC_TLM_GETITEM message to retrieve it.

Data Fields
NMHDR hdr

Standard notification structure header.

UINT action

Notification specific value.

MC_HTREELISTITEM hItemOld

Handle of the old item.

LPARAM lParamOld

lParam of the old item.

MC_HTREELISTITEM hItemNew

Handle of the new item.

LPARAM lParamNew

lParam of the new item.

struct MC_NMTLCUSTOMDRAW

Structure used by the standard notification NM_CUSTOMDRAW.

Data Fields
MC_NMCUSTOMDRAW nmcd

Standard custom-draw structure.

int iLevel

Level of the item to be painted. Valid only if nmcd.dwDrawStage has the flags CDDS_ITEM.

int iSubItem

Subitem of the item to be painted. Valid only if nmcd.dwDrawStage has the flags CDDS_SUBITEM.

COLORREF clrText

Item/subitem text color.

COLORREF clrTextBk

Item/subitem background color.

struct MC_NMTLDISPINFOW

Structure used by notifications MC_TLN_GETDISPINFO and MC_TLN_SETDISPINFO (Unicode variant).

Data Fields
NMHDR hdr

Common notification structure header.

MC_HTREELISTITEM hItem

Handle specifying the item.

MC_TLITEMW item

Structure that identifies the item.

struct MC_NMTLDISPINFOA

Structure used by notifications MC_TLN_GETDISPINFO and MC_TLN_SETDISPINFO (ANSI variant).

Data Fields
NMHDR hdr

Common notification structure header.

MC_HTREELISTITEM hItem

Handle specifying the item.

MC_TLITEMA item

Structure that identifies the item.

struct MC_NMTLSUBDISPINFOW

Structure used by notifications MC_TLN_GETSUBDISPINFO and MC_TLN_SETSUBDISPINFO (Unicode variant).

Data Fields
NMHDR hdr

Common notification structure header.

MC_HTREELISTITEM hItem

Handle specifying the item.

LPARAM lItemParam

LPARAM of the item.

MC_TLSUBITEMW subitem

Structure that identifies the subitem.

struct MC_NMTLSUBDISPINFOA

Structure used by notifications MC_TLN_GETSUBDISPINFO and MC_TLN_SETSUBDISPINFO (ANSI variant).

Data Fields
NMHDR hdr

Common notification structure header.

MC_HTREELISTITEM hItem

Handle specifying the item.

LPARAM lItemParam

LPARAM of the item.

MC_TLSUBITEMA subitem

Structure that identifies the subitem.

Macro Definition Documentation

#define MC_WC_TREELISTW   L"mCtrl.treelist"

Window class name (Unicode variant).

#define MC_WC_TREELISTA   "mCtrl.treelist"

Window class name (ANSI variant).

#define MC_TLS_HASBUTTONS   0x0001

Display expand/collapse buttons next to parent items.

To include buttons with root items, application must also use MC_TLS_LINESATROOT.

#define MC_TLS_HASLINES   0x0002

Use lines to show hierarchy of items.

#define MC_TLS_LINESATROOT   0x0004

Use lines to link root items.

Has no effect if none of MC_TLS_HASBUTTONS and MC_TLS_HASLINES is set.

#define MC_TLS_GRIDLINES   0x0008

Paint grid lines.

#define MC_TLS_SHOWSELALWAYS   0x0010

Show selection even when not having a focus.

#define MC_TLS_FULLROWSELECT   0x0020

Enable full row select in the control and the entire row of selected item is highlighted.

#define MC_TLS_NONEVENHEIGHT   0x0040

Allows item height to be an odd number.

If not set, the control rounds odds height to the even value.

#define MC_TLS_DOUBLEBUFFER   0x0080

Use double-buffering when painting.

#define MC_TLS_NOCOLUMNHEADER   0x0100

Hide column headers.

#define MC_TLS_HEADERDRAGDROP   0x0200

Enable column reordering by mouse drag & drop.

Note that the left-most column can never be reordered.

#define MC_TLS_SINGLEEXPAND   0x0400

Selected item is automatically expanded and deselected item is automatically collapsed.

The user can disable avoid this by pressing <CTRL> when clicking on an item. Also note this style is ignored completely if style MC_TLS_MULTISELECT is used.

#define MC_TLS_MULTISELECT   0x0800

Allow multiple selected items.

Note that only sibling items (i.e. items with the same parent item) can be selected at the same time.

#define MC_TLCF_FORMAT   (1 << 0)

Set if MC_TLCOLUMNW::fmt or MC_TLCOLUMNA::fmt is valid.

#define MC_TLCF_WIDTH   (1 << 1)

Set if MC_TLCOLUMNW::cx or MC_TLCOLUMNA::cx is valid.

#define MC_TLCF_TEXT   (1 << 2)
#define MC_TLCF_IMAGE   (1 << 3)
#define MC_TLCF_ORDER   (1 << 4)
#define MC_TLFMT_LEFT   0x0

Text is aligned to left.

#define MC_TLFMT_RIGHT   0x1

Text is aligned to right.

#define MC_TLFMT_CENTER   0x2

Text is centered.

#define MC_TLFMT_JUSTIFYMASK   0x3

A bit-mask of bits for justification.

#define MC_TLI_ROOT   ((MC_HTREELISTITEM)(ULONG_PTR) -0x10000)

Special handle value denoting root item.

Can be used only where explicitly allowed.

See Also
MC_TLM_INSERTITEM MC_TLM_DELETEITEM
#define MC_TLI_FIRST   ((MC_HTREELISTITEM)(ULONG_PTR) -0xffff)

Special handle first child of a parent item.

Can be used only where explicitly allowed.

See Also
MC_TLM_INSERTITEM
#define MC_TLI_LAST   ((MC_HTREELISTITEM)(ULONG_PTR) -0xfffe)

Special handle last child of a parent item.

Can be used only where explicitly allowed.

See Also
MC_TLM_INSERTITEM
#define MC_TLIF_STATE   (1 << 0)

Set if MC_TLITEM::state and MC_TLITEM::stateMask is valid.

#define MC_TLIF_TEXT   (1 << 1)

Set if MC_TLITEM::pszText and MC_TLITEM::cchTextMax is valid.

#define MC_TLIF_PARAM   (1 << 2)

Set if MC_TLITEM::lParam is valid.

#define MC_TLIF_LPARAM   (1 << 2)

Set if MC_TLITEM::lParam is valid.

Note
Obsolete. Use MC_TLIF_PARAM.
#define MC_TLIF_IMAGE   (1 << 3)

Set if MC_TLITEM::iImage is valid.

#define MC_TLIF_SELECTEDIMAGE   (1 << 4)

Set if MC_TLITEM::iSelectedImage is valid.

#define MC_TLIF_EXPANDEDIMAGE   (1 << 5)

Set if MC_TLITEM::iExpandedImage is valid.

#define MC_TLIF_CHILDREN   (1 << 6)

Set if MC_TLITEM::cChildren is valid.

#define MC_TLIS_SELECTED   (1 << 1)

The item is selected.

#define MC_TLIS_EXPANDED   (1 << 5)

The item is expanded.

#define MC_TLSIF_TEXT   (1 << 1)

Set if MC_TLSUBITEM::pszText and MC_TLSUBITEM::cchTextMax is valid.

#define MC_TLHT_NOWHERE   (1 << 0)

In the client area, but does not hit any item.

#define MC_TLHT_ONITEMICON   (1 << 1)

Never set, reserved for future.

#define MC_TLHT_ONITEMSTATEICON   (1 << 2)

Never set, reserved for future.

#define MC_TLHT_ONITEMLABEL   (1 << 3)

On (sub)item label.

On (sub)item.

#define MC_TLHT_ONITEMINDENT   (1 << 4)

On item indentation.

#define MC_TLHT_ONITEMBUTTON   (1 << 5)

On item expand/collapse button.

#define MC_TLHT_ONITEMRIGHT   (1 << 6)

To right of the (sub)item.

#define MC_TLHT_ONITEMLEFT   (1 << 7)

To left of the (sub)item. This can happen only for subitems in a column with other then left justification.

#define MC_TLHT_ABOVE   (1 << 8)

Above the client area.

#define MC_TLHT_BELOW   (1 << 9)

Below the client area.

#define MC_TLHT_TORIGHT   (1 << 10)

To right of the client area.

#define MC_TLHT_TOLEFT   (1 << 11)

To left of the client area.

#define MC_TLE_COLLAPSE   0x1

Collapse the child items.

#define MC_TLE_EXPAND   0x2

Expand the child items.

#define MC_TLE_TOGGLE   0x3

Collapse the child items if expanded, or expand them if collapsed.

#define MC_TLE_COLLAPSERESET   0x8000

Delete all children of the collapsed item.

Can be only used together with MC_TLE_EXPAND.

#define MC_TLGN_ROOT   0x0

Get first root item, or NULL if there are no items.

#define MC_TLGN_NEXT   0x1

Get next sibling item of the specified item, or NULL if no such sibling exists.

#define MC_TLGN_PREVIOUS   0x2

Get previous sibling item of the specified item, or NULL if no such sibling exists.

#define MC_TLGN_PARENT   0x3

Get parent item of of the specified item, or NULL if the item is root.

#define MC_TLGN_CHILD   0x4

Get first child item of the specified item, or NULL it the item has no children.

#define MC_TLGN_FIRSTVISIBLE   0x5

Get first visible item, or NULL if there are no items.

It is the item painted on top of the control, i.e. it depends on position of vertical scrollbar.

#define MC_TLGN_NEXTVISIBLE   0x6

Get next visible item, or NULL if no visible item follows.

The next visible item is the item painted just after the specified item. I.e. it is determined regardless the tree hierarchy. It does not check if the next item is in the view-port defined by vertical scrollbar.

#define MC_TLGN_PREVIOUSVISIBLE   0x7

Get previous visible item, or NULL if no visible item precedes the specified item.

The previous visible item is the item painted just before the specified item. I.e. it is determined regardless the tree hierarchy. It does not check if the previous item is in the view-port defined by vertical scrollbar.

#define MC_TLGN_CARET   0x9

Get (next) selected item, or NULL if no (other) item is selected.

If the style MC_TLS_MULTISELECT is used, this can also be used to retrieve all selected items: To get first selected item, use zero as LPARAM of MC_TLM_GETNEXTITEM. To get next selected item, use non-NULL LPARAM. After MC_TLM_GETNEXTITEM returns NULL, you have enumerated over all selected items.

#define MC_TLGN_LASTVISIBLE   0xa

Get last visible item, or NULL if there are no items.

Note
This is not symmetric to MC_TLGN_FIRSTVISIBLE. It gets the last item which can be displayed by scrolling. It does not check current state of scrollbars.
#define MC_TLM_INSERTCOLUMNW   (MC_TLM_FIRST + 0)

Insert a new column (Unicode variant).

Parameters
[in]wParam(int) Index of the new column.
[in]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
Return the index of the new column, or -1 on failure.
#define MC_TLM_INSERTCOLUMNA   (MC_TLM_FIRST + 1)

Insert a new column (ANSI variant).

Parameters
[in]wParam(int) Index of the new column.
[in]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
Return the index of the new column, or -1 on failure.
#define MC_TLM_SETCOLUMNW   (MC_TLM_FIRST + 2)

Sets attributes of a column (Unicode variant).

Parameters
[in]wParam(int) Index of the new column.
[in]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETCOLUMNA   (MC_TLM_FIRST + 3)

Sets attributes of a column (ANSI variant).

Parameters
[in]wParam(int) Index of the new column.
[in]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETCOLUMNW   (MC_TLM_FIRST + 4)

Gets attributes of a column (Unicode variant).

Parameters
[in]wParam(int) Index of the new column.
[out]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETCOLUMNA   (MC_TLM_FIRST + 5)

Gets attributes of a column (ANSI variant).

Parameters
[in]wParam(int) Index of the new column.
[out]lParam(MC_TLCOLUMN*) Pointer to the column structure.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_DELETECOLUMN   (MC_TLM_FIRST + 6)

Delete a column from the control.

Parameters
[in]wParam(int) Index of the new column.
lParamReserved, set to zero.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETCOLUMNORDERARRAY   (MC_TLM_FIRST + 7)

Sets left-to-right order of columns.

Parameters
[in]wParam(int) Size of buffer pointed by lParam.
[out]lParam(int*) The array which specify the order of columns from left to right.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETCOLUMNORDERARRAY   (MC_TLM_FIRST + 8)

Gets left-to-right order of columns.

Parameters
[in]wParam(int) Size of buffer pointed by lParam.
[out]lParam(int*) The array which receives the column index values. The array must be large enough to hold wParam elements.
Returns
(int) Count of elements written to the lParam, or zero on failure.
#define MC_TLM_SETCOLUMNWIDTH   (MC_TLM_FIRST + 9)

Changes width of a column.

Parameters
[in]wParam(int) Index of the new column.
[in]lParam(int) New width of the column in pixels.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETCOLUMNWIDTH   (MC_TLM_FIRST + 10)

Gets width of a column.

Parameters
[in]wParam(int) Index of the new column.
lParamReserved, set to zero.
Returns
(int) The column width, or zero on failure.
#define MC_TLM_INSERTITEMW   (MC_TLM_FIRST + 11)

Insert new item into the control (Unicode variant).

Note application may set MC_TLINSERTSTRUCT::hParent to MC_TLI_ROOT to insert the new item as the root item, and similarly the member MC_TLINSERTSTRUCT::hInsertAfter may be set to MC_TLI_FIRST or MC_TLI_LAST to insert the item as first or last child item of the parent.

Parameters
wParamReserved, set to zero.
[in]lParam(MC_TLINSERTSTRUCTW*) Pointer to the structure specifying new item position in the tree and other attributes of the item.
Returns
(MC_HTREELISTITEM) Handle of the new item, or NULL on failure.
#define MC_TLM_INSERTITEMA   (MC_TLM_FIRST + 12)

Insert new item into the control (ANSI variant).

Note application may set MC_TLINSERTSTRUCT::hParent to MC_TLI_ROOT to insert the new item as the root item, and similarly the member MC_TLINSERTSTRUCT::hInsertAfter may be set to MC_TLI_FIRST or MC_TLI_LAST to insert the item as first or last child item of the parent.

Parameters
wParamReserved, set to zero.
[in]lParam(MC_TLINSERTSTRUCTA*) Pointer to the structure specifying new item position in the tree and other attributes of the item.
Returns
(MC_HTREELISTITEM) Handle of the new item, or NULL on failure.
#define MC_TLM_SETITEMW   (MC_TLM_FIRST + 13)

Set item attributes (Unicode variant).

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLITEMW*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETITEMA   (MC_TLM_FIRST + 14)

Set item attributes (ANSI variant).

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLITEMA*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETITEMW   (MC_TLM_FIRST + 15)

Get item attributes (Unicode variant).

Application has to set MC_TLITEM::fMask prior sending the message to indicate what attributes of the item to retrieve. If the application uses MC_TLIF_TEXT, then it also has to set MC_TLITEM::pszText to point to a buffer where the text will be stored and set MC_TLITEM::cchTextMax to specify size of the buffer.

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[out]lParam(MC_TLITEMW*) Pointer to the structure where the attributes will be written.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETITEMA   (MC_TLM_FIRST + 16)

Get item attributes (ANSI variant).

Application has to set MC_TLITEM::fMask prior sending the message to indicate what attributes of the item to retrieve. If the application uses MC_TLIF_TEXT, then it also has to set MC_TLITEM::pszText to point to a buffer where the text will be stored and set MC_TLITEM::cchTextMax to specify size of the buffer.

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[out]lParam(MC_TLITEMA*) Pointer to the structure where the attributes will be written.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_DELETEITEM   (MC_TLM_FIRST + 17)

Delete item from the control.

Note the message also deletes all child items recursively, i.e. whole subtree is deleted. If you specify MC_TLI_ROOT as the item to delete, then all items of the control are deleted.

Parameters
wParamReserved, set to zero.
[in]lParam(MC_HTREELISTITEM) Handle of the item or MC_TLI_ROOT.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETITEMHEIGHT   (MC_TLM_FIRST + 18)

Set explicitly height of items.

Parameters
[in]wParam(int) New height of item in the control. Heights less then zero will be set to 1. If this value is not even and the control does not have the style MC_TLS_NONEVENHEIGHT, it shall be rounded down to the nearest even value. If set to -1, the control will revert to default height.
lParamReserved, set to zero.
Returns
(int) The previous height of the items, in pixels.
#define MC_TLM_GETITEMHEIGHT   (MC_TLM_FIRST + 19)

Get height of items.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(int) The height of the items, in pixels.
#define MC_TLM_SETSUBITEMW   (MC_TLM_FIRST + 20)

Set subitem attributes (Unicode variant).

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLSUBITEMW*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETSUBITEMA   (MC_TLM_FIRST + 21)

Set subitem attributes (ANSI variant).

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLSUBITEMW*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETSUBITEMW   (MC_TLM_FIRST + 22)

Get subitem attributes (Unicode variant).

Application has to set MC_TLSUBITEM::iSubItem to indicate which subitem it is interested in and MC_TLSUBITEM::fMask prior sending the message to indicate what attributes of the item to retrieve. If the application uses MC_TLSIF_TEXT, then it also has to set MC_TLSUBITEM::pszText to point to a buffer where the text will be stored and set MC_TLSUBITEM::cchTextMax to specify size of the buffer.

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLSUBITEMW*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETSUBITEMA   (MC_TLM_FIRST + 23)

Get subitem attributes (ANSI variant).

Application has to set MC_TLSUBITEM::iSubItem to indicate which subitem it is interested in and MC_TLSUBITEM::fMask prior sending the message to indicate what attributes of the item to retrieve. If the application uses MC_TLSIF_TEXT, then it also has to set MC_TLSUBITEM::pszText to point to a buffer where the text will be stored and set MC_TLSUBITEM::cchTextMax to specify size of the buffer.

Parameters
[in]wParam(MC_HTREELISTITEM) Handle of the item.
[in]lParam(MC_TLSUBITEMA*) Pointer to the structure specifying new attributes of the item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_SETINDENT   (MC_TLM_FIRST + 24)

Set item indentation.

[in] wParam (int) The indentation, in pixels.

Parameters
lParamReserved, set to zero.
Returns
None.
#define MC_TLM_GETINDENT   (MC_TLM_FIRST + 25)

Get item indentation.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(int) The indentation, in pixels.
#define MC_TLM_HITTEST   (MC_TLM_FIRST + 26)

Tests which item or subitem (and its part) is placed on specified position.

Parameters
wParamReserved, set to zero.
[in,out]lParam(MC_TLHITTESTINFO*) Pointer to a hit test structure. Set MC_TLHITTESTINFO::pt on input.
Returns
(MC_HTREELISTITEM) Handle of the hit item, or NULL.
#define MC_TLM_EXPAND   (MC_TLM_FIRST + 27)

Expand or collapse child items.

Parameters
[in]wParam(int) Action flag. See MC_TLE_xxxx.
[in]lParam(MC_HTREELISTITEM) Handle of the parent item.
Returns
(BOOL) TRUE on success, FALSE otherwise.
#define MC_TLM_GETNEXTITEM   (MC_TLM_FIRST + 28)

Get item of the specified relationship to a specified item.

Parameters
[in]wParam(int) Flag determining the item to retrieve. See MC_TLGN_xxxx.
[in]lParam(MC_HTREELISTITEM) Handle of an item.
Returns
(MC_HTREELISTITEM) Handle of the item in the specified relationship, or NULL.
#define MC_TLM_GETVISIBLECOUNT   (MC_TLM_FIRST + 29)

Gets count of items which currently fit into the client area.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(int) The count of items.
#define MC_TLM_ENSUREVISIBLE   (MC_TLM_FIRST + 30)

Ensure the item is visible.

The message can expand parent items or scroll if necessary.

Parameters
wParamReserved, set to zero.
[in]lParam(MC_HTREELISTITEM) Handle of the item.
Returns
(BOOL) TRUE if the control scrolled the items and no items were expanded, FALSE otherwise.
#define MC_TLM_SETIMAGELIST   (MC_TLM_FIRST + 31)

Associates an image list with the control.

Note the control does not delete the previously associated image list. It also does not delete the currently associated image list when destroying the control.

Parameters
wParamReserved, set to zero.
[in]lParam(HIMAGELIST) Handle to the image list.
Returns
(HIMAGELIST) Image list handle previously associated with the control.
#define MC_TLM_GETIMAGELIST   (MC_TLM_FIRST + 32)

Gets an image list associated with the control.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(HIMAGELIST) Image list handle associated with the control.
#define MC_TLM_GETSELECTEDCOUNT   (MC_TLM_FIRST + 33)

Returns the number of currently selected items.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(int) The number of items selected.
#define MC_TLN_DELETEITEM   (MC_TLN_FIRST + 0)

Fired when deleting an item.

The members hItemOld and lParamOld of MC_NMTREELIST specify which item is being deleted.

Parameters
[in]wParam(int) Id of the control sending the notification.
[in]lParam(MC_NMTREELIST*) Pointer to a MC_NMTREELIST structure.
Returns
Application should return zero if it processes the notification.
#define MC_TLN_SELCHANGING   (MC_TLN_FIRST + 1)

Fired when a selection item is about to change.

When style MC_TLS_MULTISELECT is not used, MC_NMTREELIST describes how the selection changes: The members hItemOld and lParamOld describe the current selection, and the members hItemNew and lParamNew specify the to-be-selection.

However when style MC_TLS_MULTISELECT is used, the notification behaves differently: The notification is only sent for items which are going to be selected (once per such item), and the members hItemOld and lParamOld are always set to NULL.

Parameters
[in]wParam(int) Id of the control sending the notification.
[in]lParam(MC_NMTREELIST*) Pointer to a MC_NMTREELIST structure.
Returns
Application may prevent TRUE to prevent the selection change, or FALSE otherwise to allow it.
#define MC_TLN_SELCHANGED   (MC_TLN_FIRST + 2)

Fired when selection has changed.

When style MC_TLS_MULTISELECT is not used, MC_NMTREELIST describes how the selection has changed: The members hItemOld and lParamOld describe the old selection, and the members hItemNew and lParamNew specify the new selection.

However when style MC_TLS_MULTISELECT is used, the notification behaves differently: It sends notification just once for the control and all MC_NMTREELIST members are set to NULL. Application can iterate through currently selected items by using the message MC_TLM_GETNEXTITEM.

Parameters
[in]wParam(int) Id of the control sending the notification.
[in]lParam(MC_NMTREELIST*) Pointer to a MC_NMTREELIST structure.
Returns
Application should return zero if it processes the notification.
#define MC_TLN_EXPANDING   (MC_TLN_FIRST + 3)

Fired when a parent item is about to expand or collapse.

The members hItemNew and lParamNew of MC_NMTREELIST specify the item which is changing its state. The member action is set to MC_TLE_EXPAND or MC_TLE_COLLAPSE to specify that the item is going to expand or collapse respectively.

Parameters
[in]wParam(int) Id of the control sending the notification.
[in]lParam(MC_NMTREELIST*) Pointer to a MC_NMTREELIST structure.
Returns
Application may prevent TRUE to prevent the item state change, or FALSE otherwise to allow it.
#define MC_TLN_EXPANDED   (MC_TLN_FIRST + 4)

Fired when a parent item has expanded or collapsed.

The members hItemNew and lParamNew of MC_NMTREELIST specify the item which has changed its state, The member action is set to MC_TLE_EXPAND or MC_TLE_COLLAPSE to specify that the item has expanded or collapsed respectively.

Parameters
[in]wParam(int) Id of the control sending the notification.
[in]lParam(MC_NMTREELIST*) Pointer to a MC_NMTREELIST structure.
Returns
Application should return zero if it processes the notification.
#define MC_TLN_GETDISPINFOW   (MC_TLN_FIRST + 7)

Fired when control needs to retrieve some item data, the parent holds (Unicode variant).

This may happen when some members of an item were set to a callback magical value such as MC_LPSTRTEXTCALLBACK, MC_I_IMAGECALLBACK and MC_I_CHILDRENCALLBACK.

Parameters
wParam
lParam@refMC_NMTLDISPINFO* "in,out" Pointer to a MC_NMTLDISPINFO structure.
Returns
None.
#define MC_TLN_GETDISPINFOA   (MC_TLN_FIRST + 8)

Fired when control needs to retrieve some item data, the parent holds (ANSI variant).

This may happen when some members of an item were set to a callback magical value such as MC_LPSTRTEXTCALLBACK, MC_I_IMAGECALLBACK and MC_I_CHILDRENCALLBACK.

Parameters
wParam
lParam@refMC_NMTLDISPINFO* "in,out" Pointer to a MC_NMTLDISPINFO structure.
Returns
None.
#define MC_WC_TREELIST   MCTRL_NAME_AW(MC_WC_TREELIST)

Unicode-resolution alias.

See Also
MC_WC_TREELISTW MC_WC_TREELISTA
#define MC_TLCOLUMN   MCTRL_NAME_AW(MC_TLCOLUMN)

Unicode-resolution alias.

See Also
MC_TLCOLUMNW MC_TLCOLUMNA
#define MC_TLITEM   MCTRL_NAME_AW(MC_TLITEM)

Unicode-resolution alias.

See Also
MC_TLITEMW MC_TLITEMA
#define MC_TLSUBITEM   MCTRL_NAME_AW(MC_TLSUBITEM)

Unicode-resolution alias.

See Also
MC_TLSUBITEMW MC_TLSUBITEMA
#define MC_TLINSERTSTRUCT   MCTRL_NAME_AW(MC_TLINSERTSTRUCT)

Unicode-resolution alias.

See Also
MC_TLINSERTSTRUCTW MC_TLINSERTSTRUCTA
#define MC_NMTLDISPINFO   MCTRL_NAME_AW(MC_NMTLDISPINFO)

Unicode-resolution alias.

See Also
MC_NMTLDISPINFOW MC_NMTLDISPINFOA
#define MC_NMTLSUBDISPINFO   MCTRL_NAME_AW(MC_NMTLSUBDISPINFO)

Unicode-resolution alias.

See Also
MC_NMTLSUBDISPINFOW MC_NMTLSUBDISPINFOA
#define MC_TLM_SETCOLUMN   MCTRL_NAME_AW(MC_TLM_SETCOLUMN)

Unicode-resolution alias.

See Also
MC_TLM_SETCOLUMNW MC_TLM_SETCOLUMNA
#define MC_TLM_INSERTCOLUMN   MCTRL_NAME_AW(MC_TLM_INSERTCOLUMN)

Unicode-resolution alias.

See Also
MC_TLM_INSERTCOLUMNW MC_TLM_INSERTCOLUMNA
#define MC_TLM_SETCOLUMN   MCTRL_NAME_AW(MC_TLM_SETCOLUMN)

Unicode-resolution alias.

See Also
MC_TLM_SETCOLUMNW MC_TLM_SETCOLUMNA
#define MC_TLM_GETCOLUMN   MCTRL_NAME_AW(MC_TLM_GETCOLUMN)

Unicode-resolution alias.

See Also
MC_TLM_GETCOLUMNW MC_TLM_GETCOLUMNA
#define MC_TLM_INSERTITEM   MCTRL_NAME_AW(MC_TLM_INSERTITEM)

Unicode-resolution alias.

See Also
MC_TLM_INSERTITEMW MC_TLM_INSERTITEMA
#define MC_TLM_SETITEM   MCTRL_NAME_AW(MC_TLM_SETITEM)

Unicode-resolution alias.

See Also
MC_TLM_SETITEMW MC_TLM_SETITEMA
#define MC_TLM_GETITEM   MCTRL_NAME_AW(MC_TLM_GETITEM)

Unicode-resolution alias.

See Also
MC_TLM_GETITEMW MC_TLM_GETITEMA
#define MC_TLM_SETSUBITEM   MCTRL_NAME_AW(MC_TLM_SETSUBITEM)

Unicode-resolution alias.

See Also
MC_TLM_SETSUBITEMW MC_TLM_SETSUBITEMA
#define MC_TLM_GETSUBITEM   MCTRL_NAME_AW(MC_TLM_GETSUBITEM)

Unicode-resolution alias.

See Also
MC_TLM_GETSUBITEMW MC_TLM_GETSUBITEMA
#define MC_TLN_SETDISPINFO   MCTRL_NAME_AW(MC_TLN_SETDISPINFO)

Unicode-resolution alias.

See Also
MC_TLN_SETDISPINFOW MC_TLN_SETDISPINFOA
#define MC_TLN_GETDISPINFO   MCTRL_NAME_AW(MC_TLN_GETDISPINFO)

Unicode-resolution alias.

See Also
MC_TLN_GETDISPINFOW MC_TLN_GETDISPINFOA
#define MC_TLN_SETSUBDISPINFO   MCTRL_NAME_AW(MC_TLN_SETSUBDISPINFO)

Unicode-resolution alias.

See Also
MC_TLN_SETSUBDISPINFOW MC_TLN_SETSUBDISPINFOA
#define MC_TLN_GETSUBDISPINFO   MCTRL_NAME_AW(MC_TLN_GETSUBDISPINFO)

Unicode-resolution alias.

See Also
MC_TLN_GETSUBDISPINFOW MC_TLN_GETSUBDISPINFOA

Typedef Documentation

typedef void* MC_HTREELISTITEM

Opaque handle type representing item of the control.

Function Documentation

BOOL mcTreeList_Initialize ( void  )

Registers window class of the control.

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

Unregisters window class of the control.