当前位置: 首页>>代码示例>>C++>>正文


C++ CTreeNode::Expand方法代码示例

本文整理汇总了C++中CTreeNode::Expand方法的典型用法代码示例。如果您正苦于以下问题:C++ CTreeNode::Expand方法的具体用法?C++ CTreeNode::Expand怎么用?C++ CTreeNode::Expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTreeNode的用法示例。


在下文中一共展示了CTreeNode::Expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RefreshChildren

bool RefreshChildren(const std::_tstring & qualifiedLabel, CTreeNode * startingNode)
{
	CTreeNode * found = Locate(qualifiedLabel, startingNode, 0);
	if (found)
	{
		found->Expand(TVE_COLLAPSE | TVE_COLLAPSERESET);
		found->Expand();
		return true;
	}
	return false;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:11,代码来源:TreeNode.cpp

示例2: Select

bool Select(const std::_tstring & qualifiedLabel, CTreeNode * startingNode, bool bExpand)
{
	CTreeNode * found = Locate(qualifiedLabel, startingNode, 0);
	if (found)
	{
		found->Select();
		if (bExpand)
			found->Expand();
		found->EnsureVisible();
		return true;
	}
	return false;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:13,代码来源:TreeNode.cpp

示例3: NotifyLButtonDown

void CTreeWnd::NotifyLButtonDown(UINT nFlags,CPoint point)
{
//    TRACE("lbuttondown %d,%d\n",point.x,point.y);
    //TRACE("%x CTreeWnd::NotifyLButtonDown - %d\n",this,m_shapes.size());

	// test expand box hit first.
	CTreeNode* pExpandNode = HitTestExpandBox(point);
	if (pExpandNode)
	{
        if (pExpandNode->IsExpanded() == false && (m_style & MTS_EXPANDRECURSIVE))
        {
            pExpandNode->Expand(true);//>ToggleExpanded();
        }
        else
            pExpandNode->ToggleExpanded();

        ForceLayout();
        Invalidate(TRUE);
		return;
	}

    CShape* pShape = HitTestShape(point);
    if (pShape)
    {
        //TRACE("CTreeWnd::NotifyLButtonDown HIT SHAPE\n");
		InvalidateNode(m_selection.lastSelected());

        CTreeNode* pNode = NodeFromShape(pShape);
		if (pNode)
		{		
            if (m_selection.NotifyItemClicked(pNode))
				OnNodeSelected(pNode);

            ForceLayout();
		}
    }
}
开发者ID:mattcawley,项目名称:mnews,代码行数:37,代码来源:TreeWnd.cpp

示例4: OnKeyDown

void CTreeWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    // Let the selection do its stuff with this keypress
    //
    m_selection.NotifyKeyPress(nChar);

	if (m_selection.empty())
		return;


	CTreeNode* pLastSel = m_selection.lastSelected();

	switch (nChar)
	{
		case VK_LEFT:
			if (pLastSel && pLastSel->IsExpanded())
			{
				pLastSel->ToggleExpanded();
				ForceLayout();
				Invalidate();
			}
			break;

		case VK_RIGHT:
			if (pLastSel && (!pLastSel->IsExpanded()))
			{
				if (m_style & MTS_EXPANDRECURSIVE)
                    pLastSel->Expand(true);
                else
                    pLastSel->ToggleExpanded();
				ForceLayout();
				Invalidate();
			}

			break;

		case VK_UP:
		{
			//InvalidateNode(pLastSel);
            //pLastSel = pLastSel->PrevNode();
			//m_selection.SelectItem(pLastSel);

//			GetParent()->SendMessage(WM_MTREE_ITEM_SELECTED,(WPARAM)pLastSel,0);

			// Force scroll up if node is not in view.
			//
			CRect a;
			GetClientRect(a);

			CShape* pShape = ShapeFromNode(pLastSel);
			if (!pShape || pShape->bottom < a.top)
			{
				SendMessage(WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),NULL);
			}

    		ForceLayout();
			InvalidateNode(pLastSel);
		}
		break;

		case VK_DOWN:
		{
			//InvalidateNode(pLastSel);
            //pLastSel = pLastSel->NextNode();
			//m_selection.SelectItem(pLastSel);
		//	GetParent()->SendMessage(WM_MTREE_ITEM_SELECTED,(WPARAM)pLastSel,0);

			// Force scroll down if node is not in view.
			//
			CRect a;
			GetClientRect(a);

			CShape* pShape = ShapeFromNode(pLastSel);
			if (!pShape || pShape->bottom > a.bottom)
			{
				SendMessage(WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),NULL);
			}
			InvalidateNode(pLastSel);
    		ForceLayout();
		}
		break;


        case VK_RETURN:
            if (pLastSel)
                OnNodeDoubleClicked(pLastSel);
            break;

        case VK_DELETE:
            if (pLastSel && CanDeleteNode(pLastSel))
            {
				OnNodeDeleted(pLastSel);

				if (pLastSel->PrevSibling() == NULL)
					m_firstVisible = NULL;

                pLastSel->getmtNode()->deleteNode();
				m_selection.Clear();
                delete pLastSel;

//.........这里部分代码省略.........
开发者ID:mattcawley,项目名称:mnews,代码行数:101,代码来源:TreeWnd.cpp


注:本文中的CTreeNode::Expand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。