コード例 #1
0
void CNBTreeView::Visit(CDiskObjectPtr o)
{
	const CObjectUIHandler *pHandler = CObjectUIHandler::GetUIHandler(o);

	switch ( m_nAction )
	{
	case NDASBINDVIEW_INSERT_OBJECT:
		{
			m_htiLast = CTreeViewCtrlEx::InsertItem( 
				pHandler->GetTitle(o), 
				pHandler->GetIconIndex(o),
				pHandler->GetSelectedIconIndex(o),
				m_htiParent,
				TVI_LAST 
				);
			m_htiLast.SetData( o->GetUniqueID() );
			m_mapIDToTreeItem[o->GetUniqueID()] = m_htiLast;
			Expand(m_htiParent, TVE_EXPAND);
		}
		break;
	case NDASBINDVIEW_UPDATE_OBJECT:
		{
			CTreeItem htiUpdate = m_mapIDToTreeItem[o->GetUniqueID()];
			htiUpdate.SetText( pHandler->GetTitle(o) );
			htiUpdate.SetImage(
				pHandler->GetIconIndex(o),
				pHandler->GetSelectedIconIndex(o)
				);
		}
	}
};
コード例 #2
0
ファイル: TreeView.cpp プロジェクト: hjhong/Duilib_Ext
void TreeViewUI::SetItemStateImage(CTreeItem hItem, unsigned int iImage, unsigned int iSelectedImage)
{
	CImageList imagelist = pTreeViewWnd->treeControl.GetImageList(0);
	if (imagelist.m_hImageList == nullptr)
	{
		return;
	}
	
	if (hItem.m_hTreeItem == nullptr)
	{
		return;
	}

	hItem.SetImage(iImage, iSelectedImage);
}