本文整理汇总了C++中TreeNode::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::SetText方法的具体用法?C++ TreeNode::SetText怎么用?C++ TreeNode::SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::SetText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnNotify
MsgProcResult TreeView::OnNotify(LPNMHDR lpnmhdr)
{
switch(lpnmhdr->code)
{
case TVN_SELCHANGED:
{
LPNMTREEVIEW lpnmtv = reinterpret_cast<LPNMTREEVIEW>(lpnmhdr);
TreeNode* newNode = reinterpret_cast<TreeNode*>(lpnmtv->itemNew.lParam);
TreeNode* oldNode = reinterpret_cast<TreeNode*>(lpnmtv->itemOld.lParam);
SignalSelChanged.emit(newNode, oldNode);
OnSelChanged(newNode, oldNode);
} break;
case NM_DBLCLK:
case NM_RDBLCLK:
case NM_CLICK:
case NM_RCLICK:
{
POINT pt = GetMessageClientPos();
TreeNode* node = HitTest(pt);
if(node)
{
// Select item in case of a right click, otherwise windows jumps back to the previous item
if(lpnmhdr->code == NM_RDBLCLK || lpnmhdr->code == NM_RCLICK)
TreeView_SelectItem(mhWnd, node->GetHandle());
MouseEvent ev(this, pt, lpnmhdr->code == NM_DBLCLK ? 2 : 1, 0,
lpnmhdr->code == NM_DBLCLK || lpnmhdr->code == NM_CLICK ? MouseButton::Left : MouseButton::Right);
SignalItemClick.emit(node, ev);
}
} break;
case TVN_BEGINLABELEDIT:
{
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lpnmhdr;
TreeNode* node = reinterpret_cast<TreeNode*>(ptvdi->item.lParam);
HWND edit = TreeView_GetEditControl(mhWnd);
std::string text = ptvdi->item.pszText;
SignalBeginLabelEdit.emit(node, text);
Edit_SetText(edit, text.c_str());
} break;
case TVN_ENDLABELEDIT:
{
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lpnmhdr;
if(ptvdi->item.pszText == nullptr) break;
TreeNode* node = reinterpret_cast<TreeNode*>(ptvdi->item.lParam);
std::string text = ptvdi->item.pszText;
if(SignalEndLabelEdit.emit(node, text))
node->SetText(text);
return MsgProcResult(false);
} break;
}
return MsgProcResult::Default;
}
示例2: AddNode
TreeNode* TreeNode::AddNode( const UnicodeString& strLabel )
{
TreeNode* node = new TreeNode( this );
node->SetText( strLabel );
node->Dock( Pos::Top );
node->SetRoot( gwen_cast<TreeControl>( this ) != NULL );
node->SetTreeControl( m_TreeControl );
if ( m_TreeControl )
{
m_TreeControl->OnNodeAdded( node );
}
return node;
}
示例3: AddNode
TreeNode* TreeNode::AddNode( const UnicodeString& strLabel )
{
// int sz = sizeof(TreeNode);
TreeNode* node = new TreeNode( this );
node->SetText( strLabel );
node->Dock( Pos::Top );
node->SetRoot( this->DynamicCastTreeControl() != NULL );
node->SetTreeControl( m_TreeControl );
if ( m_TreeControl )
{
m_TreeControl->OnNodeAdded( node );
}
return node;
}