本文整理匯總了C++中GetChildItem函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetChildItem函數的具體用法?C++ GetChildItem怎麽用?C++ GetChildItem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetChildItem函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetRootItem
/*
================
CPathTreeCtrl::FindItem
Find the given path in the tree.
================
*/
HTREEITEM CPathTreeCtrl::FindItem( const idStr &pathName ) {
int lastSlash;
idStr path, tmpPath, itemName;
HTREEITEM item, parentItem;
parentItem = NULL;
item = GetRootItem();
lastSlash = pathName.Last( '/' );
while( item && lastSlash > path.Length() ) {
itemName = GetItemText( item );
tmpPath = path + itemName;
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
parentItem = item;
item = GetChildItem( item );
path = tmpPath + "/";
} else {
item = GetNextSiblingItem( item );
}
}
for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
itemName = GetItemText( item );
if ( pathName.Icmp( path + itemName ) == 0 ) {
return item;
}
}
return NULL;
}
示例2: SetRedraw
void CDirectoryTreeCtrl::OnTvnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult)
{
CWaitCursor curWait;
SetRedraw(FALSE);
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
HTREEITEM hItem = pNMTreeView->itemNew.hItem;
// remove all subitems
HTREEITEM hRemove = GetChildItem(hItem);
while(hRemove)
{
DeleteItem(hRemove);
hRemove = GetChildItem(hItem);
}
// get the directory
CString strDir = GetFullPath(hItem);
// fetch all subdirectories and add them to the node
AddSubdirectories(hItem, strDir);
SetRedraw(TRUE);
Invalidate();
*pResult = 0;
}
示例3: network
/* #FN#
Pushes down and selects an item one level at a time until either we
can't find anymore parts of the path, or we've finished searching
Doesn't work on network (UNC) paths (Could search NETHOOD when
prefix is \\) */
void
/* #AS#
Nothing */
CShellTree::
TunnelTree(
LPCSTR lpszPath /* #IN# */
)
{
char szSearchPath[ MAX_PATH + 1 ];
BOOL bFound = FALSE;
int i = 0;
HTREEITEM hTopLevelItem;
HTREEITEM hItem;
if( (hTopLevelItem = GetRootItem()) )
{
do /* Enumerate the top level items */
{
if( Expand( hTopLevelItem, TVE_EXPAND ) )
{
hItem = GetChildItem( hTopLevelItem );
while( hItem )
{
for( ; i < (int)strlen( lpszPath ) && lpszPath[ i ] != '\\'; i++ )
szSearchPath[ i ] = lpszPath[ i ];
szSearchPath[ i++ ] = '\0';
/* Add ending backslash to drive name */
if( strlen( szSearchPath ) == 2 && szSearchPath[ 1 ] == ':' )
strcat( szSearchPath, "\\" );
if( SearchTree( hItem, szSearchPath ) )
{
hItem = GetSelectedItem();
if( Expand( hItem, TVE_EXPAND ) )
{
/* Get first leaf of the new bunch */
hItem = GetChildItem( hItem );
}
bFound = TRUE;
}
else
break;
/* Append a folder delimiter */
szSearchPath[ i - 1 ] = '\\';
}
/* The path has not been found, reset the searching "engine" */
if( !bFound )
{
Expand( hTopLevelItem, TVE_COLLAPSE );
i = 0;
}
}
}
while( !bFound && (hTopLevelItem = GetNextSiblingItem( hTopLevelItem )) );
}
} /* #OF# CShellTree::TunnelTree */
示例4: GetRootItem
void CCJShellTree::TunnelTree(CString strFindPath)
{
HTREEITEM subNode = GetRootItem();
CString szPathHop;
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
char delimiter[]="\\";
m_bRefresh = false;
if(!m_shell.Exist(strFindPath))
{
if (strFindPath.GetLength() == 3)
{
}
else
{
MessageBox(strFindPath,_T("Folder not found"),MB_ICONERROR);
return;
}
}
if(strFindPath.ReverseFind(_T('\\')) != strFindPath.GetLength()-1)
{
strFindPath += _T("\\");
}
m_shell.SplitPath(strFindPath,drive,dir,fname,ext);
//search the drive first
szPathHop=drive;
subNode=GetChildItem(subNode);
if(subNode)
{
if(SearchTree(subNode,szPathHop, CCJShellTree::type_drive))
{
SetRedraw(FALSE);
//break down subfolders and search
char *p=strtok(dir,delimiter);
while(p)
{
subNode = GetSelectedItem();
Expand(subNode, TVE_EXPAND);
subNode = GetChildItem(subNode);
if(SearchTree(subNode,p,CCJShellTree::type_folder))
p=strtok(NULL,delimiter);
else
p=NULL;
}
SetRedraw();
}
}
}
示例5: DeleteItemEx
//******************************************
// 刪除一個結點分枝,如果該結點的父結點沒有其它子節點則一起刪除
//******************************************
BOOL DeleteItemEx(HSTREEITEM hItem)
{
if(GetChildItem(hItem)) return FALSE;
while(hItem && !GetChildItem(hItem))
{
HSTREEITEM hParent=GetParentItem(hItem);
DeleteItem(hItem);
hItem=hParent;
}
return TRUE;
}
示例6: GetChildItem
BOOL CTreeCtrlEx::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
if ( pNMTreeView->action == TVE_COLLAPSE )
{
HTREEITEM hItem = GetChildItem( pNMTreeView->itemNew.hItem );
while ( hItem )
{
if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
SetItemState( hItem, 0, TVIS_SELECTED );
// Get the next node: First see if current node has a child
HTREEITEM hNextItem = GetChildItem( hItem );
if ( !hNextItem )
{
// No child: Get next sibling item
if ( !( hNextItem = GetNextSiblingItem( hItem ) ) )
{
HTREEITEM hParentItem = hItem;
while ( !hNextItem )
{
// No more children: Get parent
if ( !( hParentItem = GetParentItem( hParentItem ) ) )
break;
// Quit when parent is the collapsed node
// (Don't do anything to siblings of this)
if ( hParentItem == pNMTreeView->itemNew.hItem )
break;
// Get next sibling to parent
hNextItem = GetNextSiblingItem( hParentItem );
}
// Quit when parent is the collapsed node
if ( hParentItem == pNMTreeView->itemNew.hItem )
break;
}
}
hItem = hNextItem;
}
}
if (m_Parent)
m_Parent->SendMessage(MB_TV_MSG, (WPARAM) pNMHDR, (LPARAM)pResult);
*pResult = 0;
return FALSE; // Allow parent to handle this notification as well
}
示例7: beginResetModel
void CModelMacro::ChangeToIOAnalogData()
{
beginResetModel();
if (rootItem)
{
rootItem->ClearChildren();
}
GetChildItem(rootItem, CGrammarManagerFactory::STR_MACRO_AIN);
GetChildItem(rootItem, CGrammarManagerFactory::STR_MACRO_AOUT);
endResetModel();
}
示例8: GetParentItem
void CCheckBoxTree::vSetCheckParent(HTREEITEM hItem)
{
if(hItem == nullptr)
{
return;
}
HTREEITEM hParentItem = GetParentItem(hItem);
HTREEITEM hChildItem;
BOOL bAllChecked = TRUE;
if( ItemHasChildren(hParentItem))
{
hChildItem = GetChildItem(hParentItem);
while(hChildItem)
{
if(!bIsItemChecked(hChildItem))
{
bAllChecked = FALSE;
break;
}
hChildItem = GetNextSiblingItem(hChildItem);
}
}
BOOL fCheck=0;
vSetCheck(hParentItem, bAllChecked);
vSetCheckParent(hParentItem);
vSetCheckChildren(hParentItem,!fCheck);
}
示例9: Update
void CLibraryFolderCtrl::Update(DWORD nUpdateCookie)
{
CList< CLibraryFolder* > pAlready;
for ( HTREEITEM hItem = GetChildItem( m_hRoot ) ; hItem ; )
{
HTREEITEM hNext = GetNextSiblingItem( hItem );
CLibraryFolder* pFolder = (CLibraryFolder*)GetItemData( hItem );
if ( LibraryFolders.CheckFolder( pFolder ) )
{
Update( pFolder, hItem, NULL, nUpdateCookie, FALSE );
pAlready.AddTail( pFolder );
}
else
{
DeleteItem( hItem );
}
hItem = hNext;
}
for ( POSITION pos = LibraryFolders.GetFolderIterator() ; pos ; )
{
CLibraryFolder* pFolder = LibraryFolders.GetNextFolder( pos );
if ( pAlready.Find( pFolder ) == NULL )
{
Update( pFolder, NULL, m_hRoot, nUpdateCookie, FALSE );
}
}
}
示例10: GetChildItem
std::vector<CTest*> CTestSelectionTree::getSelectedTests()
{
std::vector<CTest*> selectedTestsVect;
HTREEITEM hCurrent = GetChildItem(hRoot);
while (hCurrent != NULL)
{
bool bChecked=GetCheck(hCurrent);
if(bChecked)
{
/*
AfxMessageBox(_T("Item checked =")+GetItemText(hCurrent));
*/
CTest* pTest=(CTest*) GetItemData(hCurrent);
selectedTestsVect.push_back(pTest);
}
// Try to get the next item
hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
//
}
return selectedTestsVect;
}
示例11: SelectItem
/*
EBaseItem* EXTreeCtrl::GetBaseItem(HTREEITEM hTi)
{
if(!hTi)
{
// First see if an item is active
if(m_hActiveItem)
{
hTi = m_hActiveItem;
SelectItem(hTi);
m_hActiveItem = 0;
}
else
{
if(m_bContextMenuActivated)
{
hTi = GetRootItem();
}
else
{
// Try to get active item
hTi = GetSelectedItem();
}
}
if(!hTi)
{
hTi = GetRootItem();
}
}
if(hTi)
{
return reinterpret_cast < EBaseItem * > (GetItemData(hTi));
}
return NULL;
}
*/
void EXTreeCtrl::ExpandTree(HTREEITEM hItem,bool bIncludeSub)
{
if(hItem == NULL)
hItem = GetRootItem();
if(hItem)
{
Expand(hItem,TVE_EXPAND);
if(bIncludeSub)
{
HTREEITEM ChildItem = GetChildItem(hItem);
while(ChildItem != NULL)
{
Expand(ChildItem,TVE_EXPAND);
ExpandTree(ChildItem,true);
ChildItem = GetNextItem(ChildItem,TVGN_NEXT);
}
}
}
/*
if(hItem == NULL)
return;
Expand(hItem,TVE_EXPAND);
HTREEITEM ChildItem = GetChildItem(hItem);
do
{
Expand(ChildItem,TVE_TOGGLE);
}
while( (ChildItem = GetNextSiblingItem( ChildItem )) != NULL );
*/
}
示例12: GetChildItem
//-----------------------------------------------------------------------------
// Purpose: Returns the tree item in the given subtree associated with the given
// visgroup, NULL if none.
//-----------------------------------------------------------------------------
HTREEITEM CGroupList::FindVisGroupItemRecursive(HTREEITEM hItem, CVisGroup *pVisGroup)
{
if (hItem)
{
CVisGroup *pVisGroupCheck = (CVisGroup *)GetItemData(hItem);
if (pVisGroupCheck == pVisGroup)
{
return hItem;
}
if (ItemHasChildren(hItem))
{
HTREEITEM hChildItem = GetChildItem(hItem);
while (hChildItem != NULL)
{
HTREEITEM hFoundItem = FindVisGroupItemRecursive(hChildItem, pVisGroup);
if (hFoundItem)
{
return hFoundItem;
}
hChildItem = GetNextItem(hChildItem, TVGN_NEXT);
}
}
}
return NULL;
}
示例13: return
HTREEITEM CMyTreeCtrl::FindItem( HTREEITEM hItem, DWORD dwData, bool f )
{
if( hItem == (HTREEITEM)NULL )
return (HTREEITEM)NULL;
PSrvrData pSrvrData = (PSrvrData)GetItemData( hItem );
if( f == true ) {
if( pSrvrData->dwId == dwData )
return hItem;
}
else {
if( pSrvrData->dpid == dwData )
return hItem;
}
if( TRUE == ItemHasChildren( hItem ) )
{
HTREEITEM hFind = FindItem( GetChildItem( hItem ), dwData, f );
if( hFind != (HTREEITEM)NULL )
return hFind;
return FindItem( GetNextSiblingItem( hItem ), dwData, f );
}
else
{
return FindItem( GetNextSiblingItem( hItem ), dwData, f );
}
}
示例14: ASSERT
void CMyTreeCtrl::EnumItem( HTREEITEM hItem, bool f )
{
if( hItem == (HTREEITEM)NULL )
return;
if( f == true ) {
m_uSizeofEnumItem = 0;
m_uIndexofEnumItem = 0;
}
PSrvrData pData = (PSrvrData)GetItemData( hItem );
ASSERT( pData );
if( pData->dwId < MAX_ID )
m_ahEnumItem[m_uSizeofEnumItem++] = hItem;
if( TRUE == ItemHasChildren( hItem ) )
{
if( f == false )
EnumItem( GetNextSiblingItem( hItem ), false );
EnumItem( GetChildItem( hItem ), false );
}
else
{
if( f == false )
EnumItem( GetNextSiblingItem( hItem ), false );
}
}
示例15: SortChildrenCB
// Recursively sort the entire tree
void CMultiSelTreeCtrl::SortTree(HTREEITEM topNode/*=NULL*/, HTREEITEM parentNode/*=NULL*/)
{
HTREEITEM item;
// Sort things at the this level
if (parentNode && (m_SortByExtension || m_SortByResolveStat
|| m_SortByAction || m_SortByFilename))
{
TVSORTCB tvsortcb;
tvsortcb.hParent = topNode;
tvsortcb.lParam = (m_SortByResolveStat ? 2 : 0) + (m_SortByExtension ? 1 : 0)
+ (m_SortByFilename ? 8 : 0) + (m_SortByAction ? 4 : 0);
tvsortcb.lpfnCompare = SortTreeCB;
SortChildrenCB(&tvsortcb);
}
else
SortChildren(topNode);
// Get the first item at this level
if(topNode == NULL)
item=GetNextItem(TVI_ROOT, TVGN_ROOT);
else
item=GetChildItem(topNode); // Get first child
// Recurse all items that have children
while(item != NULL)
{
if(ItemHasChildren(item))
SortTree(item, topNode);
item=GetNextSiblingItem(item);
}
}