Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

LPFNSFTTREE_OWNERDRAWPROC Type Definition

Defines the type of an application-supplied owner-draw function, which is called whenever an object needs to be rendered.

typedef BOOL (CALLBACK* LPFNSFTTREE_OWNERDRAWPROC)(
        HWND hwnd,
        LPSFTTREE_OWNERDRAW lpInfo,
        SFTTREE_DWORD_PTR UserData);

Parameters

hwnd

The window handle of the tree control.

lpInfo

A pointer to the SFTTREE_OWNERDRAW structure describing the action required and the object to render.

UserData

An application-specific value, as supplied in the SFTTREE_OWNERDRAWPARM structure.

Returns

The return value is TRUE if the owner-draw callback was successful, FALSE otherwise.

Comments

LPFNSFTTREE_OWNERDRAWPROC defines the type of an application-supplied owner-draw function, which is called whenever an object needs to be rendered.

An owner-draw function cannot modify the tree control attributes in any way.

Examples

C

        SftTree_SetShowRowHeader(g_hwndTree, SFTTREE_ROWSTYLE_BUTTONCOUNT1);/* Row style */
        SftTree_SetRowColHeaderText(g_hwndTree, TEXT("?"));/* Row/column header text */
        SftTree_SetRowColHeaderStyle(g_hwndTree, ES_LEFT | SFTTREE_HEADER_UP);/* Row/column header style */
        SftTree_SetRowColHeaderPictureStyle(g_hwndTree, SFTTREE_BMP_RIGHT);/* Row/column picture alignment */
        SftTree_SetCharSearchMode(g_hwndTree, SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
        /* Use an ownerdraw callback routine */
        {
            SFTTREE_OWNERDRAWPARM Parm;      /* Parameter list */
            Parm.lpfnOwnerDrawProc = (LPFNSFTTREE_OWNERDRAWPROC) Tree_OwnerDrawCallback;/* User supplied drawing routine */
            Parm.OwnerDrawUserData = (SFTTREE_DWORD_PTR)0;/* User supplied data */
            SftTree_SetOwnerDrawCallback(g_hwndTree, &Parm);
        }
        /* Change the default colors */
        {
            SFTTREE_COLORS Colors;
            SftTree_GetCtlColors(g_hwndTree, &Colors);/* Get current color settings */

C++

    m_Tree.SetShowRowHeader(SFTTREE_ROWSTYLE_BUTTONCOUNT1);/* Row style */
    m_Tree.SetRowColHeaderText(_T("?"));       /* Row/column header text */
    m_Tree.SetRowColHeaderStyle(ES_LEFT | SFTTREE_HEADER_UP);/* Row/column header style */
    m_Tree.SetCharSearchMode(SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
    /* Use an ownerdraw callback routine */
    {
        SFTTREE_OWNERDRAWPARM Parm;      /* Parameter list */
        Parm.lpfnOwnerDrawProc = (LPFNSFTTREE_OWNERDRAWPROC) CSampleView::OwnerDrawCallback;/* User supplied drawing routine */
        Parm.OwnerDrawUserData = (SFTTREE_DWORD_PTR)this;/* User supplied data */
        m_Tree.SetOwnerDrawCallback(&Parm);
    }
    /* Change the default colors */
    {
        SFTTREE_COLORS Colors;
        m_Tree.GetCtlColors(&Colors);    /* Get current color settings */
        Colors.colorTreeLines = COLOR_3DDKSHADOW | 0x80000000L;/* Tree line color */

See Also C/C++ API | Categories | Notifications