mCtrl  0.9.0
Data Structures
treelist.h File Reference

Tree-list view control (MC_WC_TREELIST). More...

Go to the source code of this file.

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
 

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.
 
#define MC_TLS_HASLINES   0x0002
 Use lines to show hiearchy of items.
 
#define MC_TLS_LINESATROOT   0x0004
 Use lines to link root items.
 
#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.
 
#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.
 
#define MC_TLS_SINGLEEXPAND   0x0400
 Selected item is automatically expanded, deselected item is automatcially collapsed (unless user holds CTRL key).
 

MC_TLCOLUMN::fMask Bits

#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)
 Set if MC_TLCOLUMNW::pszText and ref MC_TLCOLUMNW::cchTextMax, or MC_TLCOLUMNA::pszText and ref MC_TLCOLUMNA::cchTextMax are valid.
 
#define MC_TLCF_IMAGE   (1 << 3)
 Set if MC_TLCOLUMNW::iImage or MC_TLCOLUMNA::iImage is valid.
 
#define MC_TLCF_ORDER   (1 << 4)
 Set if MC_TLCOLUMNW::iOrder or MC_TLCOLUMNA::iOrder is valid.
 

MC_TLCOLUMN::fmt Bits

#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 bitmask of bits for justification.
 

Item Pseudohandles

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

MC_TLITEM::fMask Bits

#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_LPARAM   (1 << 2)
 Set if MC_TLITEM::lParam is valid.
 
#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.
 

MC_TLITEM::state Bits

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

MC_TLSUBITEM::fMask Bits

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

MC_TLHITTESTINFO::flags Bits

#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.
 
#define MC_TLHT_ONITEM   (MC_TLHT_ONITEMICON | MC_TLHT_ONITEMSTATEICON | MC_TLHT_ONITEMLABEL)
 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.
 

Action Flags for @ref MC_TLM_EXPAND

#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.
 

Item Relationship Flags for @ref MC_TLM_GETNEXTITEM

#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.
 
#define MC_TLGN_NEXTVISIBLE   0x6
 Get next visible item, or NULL if no visible item follows.
 
#define MC_TLGN_PREVIOUSVISIBLE   0x7
 Get previous visible item, or NULL if no visible item precedes the specified item.
 
#define MC_TLGN_CARET   0x9
 Get selected item, or NULL if no item is selected.
 
#define MC_TLGN_LASTVISIBLE   0xa
 Get last visible item, or NULL if there are no items.
 

Structures

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

Control Messages

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

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_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)
 

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 corresponsing 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 hiearchy 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 contain display data for the additional columns of each item (currently onle 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.

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 gets pointer to the structure MC_TLINSERTSTRUCT describing the item as well as its desired position in the tree. 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.

Standard Messages

These standard messages are handled by the control:

These standard notifications are sent by the control:


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

Bitmask specifying what other members are valid. See MC_TLCF_xxxx.

int fmt

Alignement of the column header and the subitem text in the column. Note the alignement 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

Bitmask specifying what other members are valid. See MC_TLCF_xxxx.

int fmt

Alignement of the column header and the subitem text in the column. Note the alignement 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

Bitmask specifying what other members are valid. See MC_TLIF_xxxx.

UINT state

State of the item. See MC_TLIS_xxxx.

UINT stateMask

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

WCHAR * pszText

The item text.

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.

int iSelectedImage

Image whem selected. Can be MC_I_IMAGENONE.

int iExpandedImage

Image whem expanded. Can be MC_I_IMAGENONE.

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

Bitmask specifying what other members are valid. See MC_TLIF_xxxx.

UINT state

State of the item. See MC_TLIS_xxxx.

UINT stateMask

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

char * pszText

The item text.

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.

int iSelectedImage

Image whem selected. Can be MC_I_IMAGENONE.

int iExpandedImage

Image whem expanded. Can be MC_I_IMAGENONE.

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

Bitmask specifying what other members are valid. See MC_TLSIF_xxxx.

int iSubItem

ID of subitem to set or get.

WCHAR * pszText

Subitem text.

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

Bitmask specifying what other members are valid. See MC_TLSIF_xxxx.

int iSubItem

ID of subitem to set or get.

char * pszText

The subitem text.

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).

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, applicaiton must also use MC_TLS_LINESATROOT.

#define MC_TLS_HASLINES   0x0002

Use lines to show hiearchy 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_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, deselected item is automatcially collapsed (unless user holds CTRL key).

#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 bitmask of bits for justification.

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

Special handle value denoiting 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_LPARAM   (1 << 2)

Set if MC_TLITEM::lParam is valid.

#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_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_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 hiearchy. It does not check if the next item is in the viewport 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 hiearchy. It does not check if the previous item is in the viewport defined by vertical scrollbar.

#define MC_TLGN_CARET   0x9

Get selected item, or NULL if no item is selected.

#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 struture.
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 struture.
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 struture.
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 struture.
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 struture.
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 struture.
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
[in]wParam(MC_HTREELISTITEM) Handle of the item or MC_TLI_ROOT.
lParamReserved, set to zero.
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 spacified item.

Parameters
[in]wParam(int) Flag determining the item to retrieve. See MC_TLGN_xxxx.
[in]lParam(MC_HTREELISTITEM) Hnadle 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_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_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

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.