本文整理汇总了C++中GetRootItem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRootItem函数的具体用法?C++ GetRootItem怎么用?C++ GetRootItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRootItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGetTextFromUser
void PartitioningTreeCtrl::onadd_h(wxCommandEvent& event)
{
wxString cid= wxGetTextFromUser("Enter a usagename of homeplacement","Usagename",
"", this,-1,-1,TRUE);
wxString text="Homeplacement(";
text.Append(cid);
text.Append(")");
wxTreeItemId itemid = AppendItem(GetSelection(),text,
TreeCtrlIcon_Folder,TreeCtrlIcon_FolderSelected,NULL);
Expand(GetRootItem());
Refresh();
ItemTyp itype;
itype.itemid=itemid;
itype.type=home;
itype.usagename=cid;
itemtypes.push_back(itype);
}
示例2: wxTreeItemId
void BFBackupTree::Init ()
{
lastItemId_ = wxTreeItemId();
Freeze();
// recreate the treeCtrl with all tasks
BFBackup::Instance().InitThat(this);
// expand all items in the treeCtlr
ExpandAll();
if ( lastItemId_.IsOk() )
SelectItem(lastItemId_);
else
SelectItem(GetRootItem());
Thaw();
}
示例3: GetDriveItems
void CDirstatDoc::OnViewShowunknown()
{
CArray<CItem *, CItem *> drives;
GetDriveItems(drives);
if(m_showUnknown)
{
for(int i = 0; i < drives.GetSize(); i++)
{
CItem *unknown = drives[i]->FindUnknownItem();
ASSERT(unknown != NULL);
// FIXME: Multi-select
if(GetSelection(0) == unknown)
{
SetSelection(unknown->GetParent());
}
if(GetZoomItem() == unknown)
{
m_zoomItem = unknown->GetParent();
}
drives[i]->RemoveUnknownItem();
}
m_showUnknown = false;
}
else
{
for(int i = 0; i < drives.GetSize(); i++)
{
drives[i]->CreateUnknownItem();
}
m_showUnknown = true;
}
if(drives.GetSize() > 0)
{
SetWorkingItem(GetRootItem());
}
UpdateAllViews(NULL);
}
示例4: GetItemText
void browsers::CellBrowser::ShowMenu(wxTreeItemId id, const wxPoint& pt) {
wxMenu menu;
RBcellID = id;
if ( id.IsOk() && (id != GetRootItem())) {
wxString RBcellname = GetItemText(id);
menu.Append(CELLTREEOPENCELL, wxT("Open " + RBcellname));
menu.Append(tui::TMCELL_REF_B , wxT("Add reference to " + RBcellname));
menu.Append(tui::TMCELL_AREF_B, wxT("Add array of " + RBcellname));
wxString ost;
ost << wxT("export ") << RBcellname << wxT(" to GDS");
menu.Append(tui::TMGDS_EXPORTC, ost);
menu.Append(tui::TMCELL_REPORTLAY, wxT("Report layers used in " + RBcellname));
}
else {
menu.Append(tui::TMCELL_NEW, wxT("New cell")); // will be catched up in toped.cpp
menu.Append(tui::TMGDS_EXPORTL, wxT("GDS export"));
}
PopupMenu(&menu, pt);
}
示例5: Freeze
void wxTreeCtrlBase::ExpandAllChildren(const wxTreeItemId& item)
{
Freeze();
// expand this item first, this might result in its children being added on
// the fly
if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) )
Expand(item);
//else: expanding hidden root item is unsupported and unnecessary
// then (recursively) expand all the children
wxTreeItemIdValue cookie;
for ( wxTreeItemId idCurr = GetFirstChild(item, cookie);
idCurr.IsOk();
idCurr = GetNextChild(item, cookie) )
{
ExpandAllChildren(idCurr);
}
Thaw();
}
示例6: GetRootItem
wxTreeItemId DirectoryTree::PopulatePath(const wxString& sPath)
{
wxString sSeparator = wxFileName::GetPathSeparator();
wxChar chSeparator = sSeparator.GetChar(0);
// Ensure path finishes in path separator
wxString sTerminatedPath = sPath;
if(sTerminatedPath.Right(1) != sSeparator)
sTerminatedPath += sSeparator;
// Start from root path
wxTreeItemId tid = GetRootItem(sPath);
if(!tid.IsOk())
{
wxLogDebug(wxT("DirectoryTree::PopulatePath(): GetRootItem(sPath) failed;"), (int) tid);
return wxTreeItemId();
}
sTerminatedPath = sTerminatedPath.AfterFirst(chSeparator);
while(sTerminatedPath != wxT(""))
{
// Ensure all children exist
AddChildren(tid);
// Select the sub-directory
wxString sDir = sTerminatedPath.BeforeFirst(chSeparator);
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("CreatePath(): Directory '%s'"), sDir.c_str());
wxTreeItemId tidChild = GetChildByName(tid, sDir);
// Fail if we can't find the sub-directory
if(!tidChild.IsOk())
{
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("CreatePath(): GetChildByName(%u, '%s') failed"), (int) tid, sDir.c_str());
break;
}
sTerminatedPath = sTerminatedPath.AfterFirst(chSeparator);
tid = tidChild;
}
// Return the item
return tid;
}
示例7: update_locker
wxSize AutoResizingTreeCtrl::DoGetBestSize() const
{
AutoResizingTreeCtrl& myself = const_cast<AutoResizingTreeCtrl&>(*this);
wxWindowUpdateLocker update_locker(&myself);
wxSize best_size(0, 0);
wxTreeItemId const selection = GetSelection();
wxTreeItemId const first_visible = GetFirstVisibleItem();
wxTreeItemId const root = GetRootItem();
myself.DoGetBestSizePrivate(best_size, root, true);
// need some minimal size even for an empty tree
if(best_size.x == 0 || best_size.y == 0)
{
wxSize min_size = wxTreeCtrl::DoGetBestSize();
if(best_size.x == 0)
{
best_size.x = min_size.x;
}
if(best_size.y == 0)
{
best_size.y = min_size.y;
}
}
best_size += GetSize() - GetClientSize();
if(selection.IsOk())
{
myself.SelectItem(selection);
}
if(first_visible.IsOk())
{
myself.ScrollTo(first_visible);
}
CacheBestSize(best_size);
return best_size;
}
示例8: GetRootItem
wxTreeItemId
SamplesTreeCtrl::getTreeItem( smp::Sample *sample ) const
{
wxTreeItemId root = GetRootItem();
wxTreeItemIdValue cookie;
wxTreeItemId speakerItem = GetFirstChild( root, cookie );
wxTreeItemId foundItem;
while( speakerItem.IsOk() )
{
if ( (foundItem = getTreeItem( sample, speakerItem )).IsOk() )
return foundItem;
speakerItem = GetNextChild( root, cookie );
}
return foundItem;
}
示例9: GetRootItem
HTREEITEM CCWTreeCtrl::GetNextTreeItem(HTREEITEM hItem)
{
if (NULL == hItem)
return GetRootItem();
// First, try to go to this item's 1st child
HTREEITEM hReturn = GetChildItem(hItem);
// If no more child items...
while (hItem && !hReturn) {
// Get this item's next sibling
hReturn = GetNextSiblingItem(hItem);
// If hReturn is NULL, then there are no sibling items, and we're on a leaf node.
// Backtrack up the tree one level, and we'll look for a sibling on the next
// iteration (or we'll reach the root and quit).
hItem = GetParentItem(hItem);
}
return hReturn;
}
示例10: GetRootItem
// Select the tree item corresponding to the WORKSHEET_DATAITEM aItem
void DESIGN_TREE_FRAME::SelectCell( WORKSHEET_DATAITEM* aItem )
{
wxTreeItemId rootcell = GetRootItem();
wxTreeItemIdValue cookie;
wxTreeItemId cell = GetFirstChild( rootcell, cookie );
while( cell.IsOk() )
{
DESIGN_TREE_ITEM_DATA* data = (DESIGN_TREE_ITEM_DATA*) GetItemData( cell );
if( data->GetItem() == aItem )
{
SelectItem( cell );
return;
}
cell = GetNextChild( rootcell, cookie );
}
}
示例11: GetRootItem
//选择粒子基本参数Item
void SkillObjectTree::SelectSkillSetting()
{
wxTreeItemId rootId = GetRootItem();
wxTreeItemIdValue idValue;
wxTreeItemId childId = GetFirstChild(rootId,idValue);
while(childId.IsOk())
{
SkillTreeItemData* pItemData = dynamic_cast<SkillTreeItemData*>(GetItemData(childId));
if(pItemData->GetDesc() == "Skill BasicSetting")
{
//SelectItem(childId);
Expand(childId);
mSelectSkillObject = NULL;
break;
}
childId = GetNextSibling(childId);
}
}
示例12: GetRootItem
/*
================
CPathTreeCtrl::SearchTree
Search the three using the search string.
Adds the matched tree items to the result tree.
Returns the number of items added to the result tree.
================
*/
int CPathTreeCtrl::SearchTree( treeItemCompare_t compare, void *data, CPathTreeCtrl &result ) {
idPathTreeStack stack, searchStack;
HTREEITEM item, child;
idStr name;
int id, numItems;
numItems = 0;
result.DeleteAllItems();
stack.PushRoot( NULL );
item = GetRootItem();
searchStack.PushRoot( item );
id = 0;
while( searchStack.Num() > 0 ) {
for ( child = GetChildItem( item ); child; child = GetChildItem( child ) ) {
searchStack.Push( item, GetItemText( item ) );
item = child;
}
name = searchStack.TopName();
name += GetItemText( item );
id = GetItemData( item );
if ( compare( data, item, name ) ) {
result.AddPathToTree( name, id, stack );
numItems++;
}
for ( item = GetNextSiblingItem( item ); item == NULL; ) {
item = GetNextSiblingItem( searchStack.TopItem() );
searchStack.Pop();
if ( searchStack.Num() <= 0 ) {
return numItems;
}
}
}
return numItems;
}
示例13: GetRootItem
int SMCTreeCtrl::InsertColumn(int iCol,int nWid)
{
if(iCol < 0) iCol = m_arrColWidth.GetCount();
m_arrColWidth.InsertAt(iCol,nWid);
HSTREEITEM hItem = GetRootItem();
while(hItem)
{
MCITEM *pMcItem = (MCITEM*)STreeCtrl::GetItemData(hItem);
pMcItem->arrText.InsertAt(iCol,SStringT());
hItem = GetNextItem(hItem);
}
m_nItemWid = -1;
CalcItemWidth(0);
CSize szView = GetViewSize();
szView.cx = m_nItemWid;
SetViewSize(szView);
Invalidate();
return iCol;
}
示例14: OnBeginDrag
void SkillObjectTree::OnBeginDrag(wxTreeEvent& event)
{
// need to explicitly allow drag
if ( event.GetItem() != GetRootItem() )
{
m_draggedItem = event.GetItem();
wxPoint clientpt = event.GetPoint();
wxPoint screenpt = ClientToScreen(clientpt);
//wxLogMessage(wxT("OnBeginDrag: started dragging %s at screen coords (%i,%i)"),
// GetItemText(m_draggedItem).c_str(),
// screenpt.x, screenpt.y);
event.Allow();
}
else
{
//wxLogMessage(wxT("OnBeginDrag: this item can't be dragged."));
}
}
示例15: GetRootItem
// Collapse all the tree sections. This is recursive
// so that we can collapse submenus. SetRedraw should
// be FALSE while this is executing.
void CStatisticsTree::CollapseAll(HTREEITEM theItem)
{
HTREEITEM hCurrent;
if (theItem == NULL) {
hCurrent = GetRootItem();
m_bExpandingAll = true;
}
else
hCurrent = theItem;
while (hCurrent != NULL)
{
if (ItemHasChildren(hCurrent))
CollapseAll(GetChildItem(hCurrent));
Expand(hCurrent, TVE_COLLAPSE);
hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
}
if (theItem == NULL) m_bExpandingAll = false;
}