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


C++ TreeNode::SetText方法代码示例

本文整理汇总了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;
}
开发者ID:Eisenheim9,项目名称:ww,代码行数:56,代码来源:TreeView.cpp

示例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;
}
开发者ID:dabroz,项目名称:gwen-plus,代码行数:15,代码来源:TreeNode.cpp

示例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;
}
开发者ID:Aatch,项目名称:bullet3,代码行数:16,代码来源:TreeNode.cpp


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