本文整理汇总了C++中ItemHasChildren函数的典型用法代码示例。如果您正苦于以下问题:C++ ItemHasChildren函数的具体用法?C++ ItemHasChildren怎么用?C++ ItemHasChildren使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ItemHasChildren函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRootItem
CString CStatisticsTree::GetText(bool onlyVisible, HTREEITEM theItem, int theItemLevel, bool firstItem)
{
bool bPrintHeader = firstItem;
HTREEITEM hCurrent;
if (theItem == NULL)
{
hCurrent = GetRootItem(); // Copy All Vis or Copy All
}
else
{
if (bPrintHeader && (!ItemHasChildren(theItem) || !IsExpanded(theItem)))
bPrintHeader = false;
hCurrent = theItem;
}
CString strBuffer;
if (bPrintHeader)
strBuffer.Format(_T("eMule v%s %s [%s]\r\n\r\n"), theApp.m_strCurVersionLong, GetResString(IDS_SF_STATISTICS) ,thePrefs.GetUserNick());
while (hCurrent != NULL)
{
for (int i = 0; i < theItemLevel; i++)
strBuffer += _T(" ");
strBuffer += GetItemText(hCurrent);
if (bPrintHeader || !firstItem)
strBuffer += _T("\r\n");
if (ItemHasChildren(hCurrent) && (!onlyVisible || IsExpanded(hCurrent)))
strBuffer += GetText(onlyVisible, GetChildItem(hCurrent), theItemLevel+1, false);
hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
if (firstItem && theItem != NULL)
break; // Copy Selected Branch was used, so we don't want to copy all branches at this level. Only the one that was selected.
}
return strBuffer;
}
示例2: GetNextChild
VectorTreeItemId BFBackupTree::GetTaskItems (wxTreeItemId idParent, bool bGoDeep /*= true*/)
{
VectorTreeItemId vec;
wxTreeItemId idCurr;
wxTreeItemIdValue idCookie;
if (ItemHasChildren(idParent))
{
for (idCurr = GetFirstChild(idParent, idCookie);
idCurr.IsOk();
idCurr = GetNextChild(idParent, idCookie))
{
if (ItemHasChildren(idCurr) == bGoDeep)
{
VectorTreeItemId vecSub(GetTaskItems(idCurr, true));
for (ItVectorTreeItemId it = vecSub.begin();
it != vecSub.end();
it++)
{
vec.push_back(*it);
}
}
else
{
if (IsTask(idCurr))
vec.push_back(idCurr);
}
}
}
return vec;
}
示例3: switch
void ctlTree::NavigateTree(int keyCode)
{
switch(keyCode)
{
case WXK_LEFT:
{
//If tree item has children and is expanded, collapse it, otherwise select it's parent if has one
wxTreeItemId currItem = GetSelection();
if (ItemHasChildren(currItem) && IsExpanded(currItem))
{
Collapse(currItem);
}
else
{
wxTreeItemId parent = GetItemParent(currItem);
if (parent.IsOk())
{
SelectItem(currItem, false);
SelectItem(parent, true);
}
}
}
break;
case WXK_RIGHT:
{
//If tree item do not have any children ignore it,
//otherwise expand it if not expanded, and select first child if already expanded
wxTreeItemId currItem = GetSelection();
if(ItemHasChildren(currItem))
{
if (!IsExpanded(currItem))
{
Expand(currItem);
}
else
{
wxCookieType cookie;
wxTreeItemId firstChild = GetFirstChild(currItem, cookie);
SelectItem(currItem, false);
SelectItem(firstChild, true);
}
}
}
break;
default:
wxASSERT_MSG(false, _("Currently handles only right and left arrow key, other keys are working"));
break;
}
}
示例4: locker
void svSymbolTree::BuildTree(const wxFileName& fn)
{
TagEntryPtrVector_t newTags;
ITagsStoragePtr db = TagsManagerST::Get()->GetDatabase();
if ( !db ) {
return;
}
db->SelectTagsByFile(fn.GetFullPath(), newTags);
if ( TagsManagerST::Get()->AreTheSame(newTags, m_currentTags) )
return;
wxWindowUpdateLocker locker(this);
SymbolTree::BuildTree(fn, &newTags);
// Request from the parsing thread list of include files
++m_uid;
ParseRequest *req = new ParseRequest(this);
req->setFile(fn.GetFullPath());
req->setType(ParseRequest::PR_PARSE_INCLUDE_STATEMENTS);
req->_uid = m_uid; // Identifies this request
ParseThreadST::Get()->Add( req );
wxTreeItemId root = GetRootItem();
if( root.IsOk() && ItemHasChildren(root) ) {
wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild(root, cookie);
while ( child.IsOk() ) {
Expand(child);
child = GetNextChild(root, cookie);
}
}
}
示例5: 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 );
}
}
示例6: ASSERT
void CMyTreeCtrl::PostEnumItem( HTREEITEM hItem, bool f, PENUMITEM pEnumItem )
{
if( hItem == (HTREEITEM)NULL )
return;
if( f == true )
pEnumItem = new ENUMITEM;
PSrvrData pData = (PSrvrData)GetItemData( hItem );
ASSERT( pData );
if( pData->dwId < MAX_ID )
pEnumItem->m_ahEnumItem[pEnumItem->m_uSizeofEnumItem++] = hItem;
if( TRUE == ItemHasChildren( hItem ) )
{
if( f == false )
PostEnumItem( GetNextSiblingItem( hItem ), false, pEnumItem );
PostEnumItem( GetChildItem( hItem ), false, pEnumItem );
}
else
{
if( f == false )
PostEnumItem( GetNextSiblingItem( hItem ), false, pEnumItem );
}
if( f == true )
{
m_lspEnumItem.push_back( pEnumItem );
}
}
示例7: GetTreeItem
wxTreeItemId wxSpinTreeCtrl::GetTreeItem(const char *nodeId, wxTreeItemId idParent, wxTreeItemIdValue cookie)
{
if (! idParent.IsOk())
return NULL;
wxSpinTreeItemData *treeData = (wxSpinTreeItemData*)GetItemData(idParent);
if (treeData && treeData->m_pNode.valid())
{
if (strcmp(treeData->m_pNode->id->s_name, nodeId) == 0)
{
return idParent;
}
}
if (ItemHasChildren(idParent))
{
wxTreeItemId child;
for (child = GetFirstChild(idParent, cookie); child.IsOk(); child = GetNextChild(idParent, cookie))
{
wxTreeItemId targetItem = GetTreeItem(nodeId, child, cookie);
if (targetItem.IsOk())
return targetItem;
}
}
return GetTreeItem(nodeId, GetNextSibling(idParent), cookie);
}
示例8: Expand
void wxGxTreeViewBase::OnObjectRefreshed(wxGxCatalogEvent& event)
{
wxTreeItemId TreeItemId = m_TreeMap[event.GetObjectID()];
if(TreeItemId.IsOk())
{
wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(TreeItemId);
if(pData != NULL)
{
if(pData->m_bExpandedOnce)
{
//deleted via refresh
//DeleteChildren(TreeItemId);
pData->m_bExpandedOnce = false;
Expand(TreeItemId);
}
else
{
wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
wxGxObjectContainer* pGxObjectContainer = dynamic_cast<wxGxObjectContainer*>(pGxObject);
wxBusyCursor wait;
if(pGxObjectContainer && pGxObjectContainer->HasChildren() && !ItemHasChildren(TreeItemId))
{
SetItemHasChildren(TreeItemId);
}
}
}
}
}
示例9: FindItemByPath
wxTreeItemId BFBackupTree::FindItemByPath (wxTreeItemId idStart, const wxString& strPath)
{
wxTreeItemId idCurr, idLast;
wxTreeItemIdValue idCookie;
wxString str;
// check start item
if (HasPath(idStart, strPath))
return idStart;
if (ItemHasChildren(idStart))
{
for (idCurr = GetFirstChild(idStart, idCookie);
idCurr.IsOk();
idCurr = GetNextChild(idStart, idCookie))
{
idLast = FindItemByPath(idCurr, strPath);
if (idLast.IsOk())
return idLast;
}
}
return wxTreeItemId();
}
示例10: while
BOOL CDirTreeCtrl::AddSubDirAsItem1(HTREEITEM hParent)
{
CString strPath,strFileName;
HTREEITEM hChild;
//---------------------去除该父项下所有的子项------------ // 因为有dummy项,并且有时子目录再次打开,或子目录会刷新等,因此必须去除。
while ( ItemHasChildren(hParent)) {
hChild = GetChildItem(hParent);
DeleteItem( hChild );
} //-----------------------装入该父项下所有子项--------------
strPath = GetFullPath(hParent);
CString strSearchCmd = strPath;
if( strSearchCmd.Right( 1 ) != _T( "\\" ))
strSearchCmd += _T( "\\" );
strSearchCmd += _T( "*.*" );
CFileFind find;
BOOL bContinue = find.FindFile( strSearchCmd );
while ( bContinue ) {
bContinue = find.FindNextFile();
strFileName = find.GetFileName();
if(!find.IsHidden() && ! find.IsDots() && find.IsDirectory() )
{
hChild = AddItem( hParent, strFileName );
}
if ( !find.IsHidden() && ! find.IsDots() && !find.IsDirectory() ) {
InsertItem( strFileName, 0, 0, hParent );
}
}
return TRUE;
}
示例11: GetItemText
//------------------------------------------------------------------------------
wxTreeItemId OutputTree::FindItem(wxTreeItemId parentId, const wxString &name)
{
#if DEBUG_OUTPUT_TREE
MessageInterface::ShowMessage
("OutputTree::FindItem() parentId=%s, name=%s\n",
GetItemText(parentId).c_str(), name.c_str());
#endif
wxTreeItemId itemId;
if (ItemHasChildren(parentId))
{
wxString itemText;
wxTreeItemIdValue cookie;
wxTreeItemId childId = GetFirstChild(parentId, cookie);
while (childId.IsOk())
{
itemText = GetItemText(childId);
if (itemText == name)
return childId;
childId = GetNextChild(parentId, cookie);
}
}
return itemId;
}
示例12: GetFirstChild
wxTreeItemId SessionTreeControl::findSession( wxTreeItemId root,
std::string address )
{
wxTreeItemIdValue temp; // unused var, needed in getchild
wxTreeItemId targetItem;
wxTreeItemId current = GetFirstChild( root, temp );
while ( current.IsOk() )
{
wxString text = GetItemText( current );
std::string target = std::string( text.char_str() );
if ( target.compare( address ) == 0 )
return current;
if ( ItemHasChildren( current ) )
{
targetItem = findSession( current, address );
if ( targetItem.IsOk() )
return targetItem;
}
current = GetNextChild( root, temp );
}
wxTreeItemId none;
return none; // return default value if not found
}
示例13: GetRootItem
void KGTreeCtrl::SortTree(HTREEITEM hTreeItem)
{
HTREEITEM hSubItem = NULL;
if (!hTreeItem)
{
hTreeItem = GetRootItem();
// hTreeItem = GetChildItem(TVI_ROOT);
KG_PROCESS_ERROR(hTreeItem);
SortChildren(NULL);
}
hSubItem = hTreeItem;
SortChildren(hSubItem);
HTREEITEM BrotherItem = hSubItem;
if (ItemHasChildren(hSubItem))
{
hSubItem = GetChildItem(hSubItem);
SortTree(hSubItem);
}
hSubItem = GetNextSiblingItem(BrotherItem);
KG_PROCESS_ERROR(hSubItem);
SortTree(hSubItem);
Exit0:
return ;
}
示例14: DClickTreeItem
void MyGameTreeCtrl::DClickTreeItem( HTREEITEM htree)
{
if(ItemHasChildren(htree))
return ;
m_iCurItem = GetItemData(htree);
SearchTreeItem( htree );
}
示例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);
}
}