Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

TreeView Sample (C++)

Sample classes to use CSftTree and CSftTreeSplit in a view in the same manner as MFC's CTreeView class.

/****************************************************************************/
/* SftTree/DLL 7.5 - Tree Control for C/C++                                 */
/* Copyright (C) 1995, 2016  Softel vdm, Inc. All Rights Reserved.          */
/****************************************************************************/

// Sample classes so CSftTree and CSftTreeSplit can be used as a view
// in the same manner as MFC's CTreeView

class CSftTreeView : public CCtrlView
{
	DECLARE_DYNCREATE(CSftTreeView)

public:
    CSftTreeView::CSftTreeView() : CCtrlView(_T(SFTTREE_CLASS),
            SFTTREESTYLE_NOTIFY |            /* Notify parent window */
            SFTTREESTYLE_LEFTBUTTONONLY |    /* Only respond to left mouse button */
            SFTTREESTYLE_SCROLL |            /* Honor WS_H/VSCROLL */
            SFTTREESTYLE_DISABLENOSCROLL |   /* Disable scrollbars instead of hiding */
            WS_HSCROLL | WS_VSCROLL |        /* Vertical and horizontal scrollbars */
            WS_VISIBLE | WS_CHILD)           /* Visible, child window */
    {
    }

    CSftTree& CSftTreeView::GetTreeCtrl() const
	    { return *(CSftTree*)this; }
};

class CSftTreeSplitView : public CCtrlView
{
	DECLARE_DYNCREATE(CSftTreeSplitView)

public:
    CSftTreeSplitView::CSftTreeSplitView() : CCtrlView(_T(SFTTREESPLIT_CLASS),
            SFTTREESTYLE_NOTIFY |            /* Notify parent window */
            SFTTREESTYLE_LEFTBUTTONONLY |    /* Only respond to left mouse button */
            SFTTREESTYLE_SCROLL |            /* Honor WS_H/VSCROLL */
            SFTTREESTYLE_DISABLENOSCROLL |   /* Disable scrollbars instead of hiding */
            WS_HSCROLL | WS_VSCROLL |        /* Vertical and horizontal scrollbars */
            WS_VISIBLE | WS_CHILD)           /* Visible, child window */
    {
    }

    CSftTreeSplit& CSftTreeSplitView::GetTreeCtrl() const
	    { return *(CSftTreeSplit*)this; }
};