本文整理汇总了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;
}
示例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;
}
示例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();
}
}
}
示例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;
//.........这里部分代码省略.........