本文整理汇总了C++中GetItemParent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetItemParent函数的具体用法?C++ GetItemParent怎么用?C++ GetItemParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetItemParent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
int wxSTEditorTreeCtrl::DeleteItem(const wxTreeItemId& id_, bool delete_empty,
int levels, const wxTreeItemId& topId)
{
int n = 0;
wxTreeItemId id = id_;
if (!id)
return 0;
else if (!delete_empty)
{
if (id == m_notePageId) m_notePageId = wxTreeItemId();
Delete(id);
n++;
}
else
{
// back up the tree and delete all parents that have no other children
wxTreeItemId parentId_last;
wxTreeItemId parentId = GetItemParent(id);
wxTreeItemId rootId = GetRootItem();
if (id == m_notePageId) m_notePageId = wxTreeItemId();
Delete(id);
n++;
while( parentId && (parentId != rootId) && (parentId != topId) &&
((n <= levels) || (levels == -1)))
{
unsigned int child_count = GetChildrenCount(parentId, false);
if (child_count <= 1)
{
// verify that if a single child that it's not a file
if (child_count == 1)
{
wxTreeItemIdValue cookie;
wxTreeItemId childId = GetFirstChild(parentId, cookie);
wxSTETreeItemData* itemData = (wxSTETreeItemData*)GetItemData(childId);
if (itemData && (itemData->m_page_num != -1))
break;
}
// no other children in this node, try next parent
parentId_last = parentId;
parentId = GetItemParent(parentId);
n++;
}
else
break;
}
if (parentId_last)
{
if (parentId_last == m_notePageId) m_notePageId = wxTreeItemId();
Delete(parentId_last);
}
}
return n;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:60,代码来源:stetree.cpp
示例2: while
wxString CLocalTreeView::GetDirFromItem(wxTreeItemId item)
{
const wxString separator = wxFileName::GetPathSeparator();
wxString dir;
while (item)
{
#ifdef __WXMSW__
if (item == m_desktop)
{
wxChar path[MAX_PATH + 1];
if (SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, path) != S_OK)
{
if (SHGetFolderPath(0, CSIDL_DESKTOP, 0, SHGFP_TYPE_CURRENT, path) != S_OK)
{
wxMessageBox(_("Failed to get desktop path"));
return _T("/");
}
}
dir = path;
if (dir.Last() != separator)
dir += separator;
return dir;
}
else if (item == m_documents)
{
wxChar path[MAX_PATH + 1];
if (SHGetFolderPath(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, path) != S_OK)
{
wxMessageBox(_("Failed to get 'My Documents' path"));
return _T("/");
}
dir = path;
if (dir.Last() != separator)
dir += separator;
return dir;
}
else if (item == m_drives)
return _T("/");
else if (GetItemParent(item) == m_drives)
{
wxString text = GetItemText(item);
int pos = text.Find(_T(" "));
if (pos == -1)
return text + separator + dir;
else
return text.Left(pos) + separator + dir;
}
else
#endif
if (item == GetRootItem())
return _T("/") + dir;
dir = GetItemText(item) + separator + dir;
item = GetItemParent(item);
}
return separator;
}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:59,代码来源:LocalTreeView.cpp
示例3: GetItemParent
void P3DPlantModelTreeCtrl::OnSetStemModelWingsClick
(wxCommandEvent &event)
{
P3DBranchModel *BranchModel;
P3DBranchModel *ParentBranchModel;
const P3DStemModelTube *ParentStemModel;
P3DStemModel *StemModel;
P3DBranchingAlg *BranchingAlg;
wxTreeItemId ParentId;
ParentId = GetItemParent(GetSelection());
if (!ParentId.IsOk())
{
return;
}
ParentBranchModel = ((P3DPlantModelTreeCtrlItemData*)(GetItemData(ParentId)))->GetBranchModel();
ParentStemModel = dynamic_cast<const P3DStemModelTube*>(ParentBranchModel->GetStemModel());
if (ParentStemModel == 0)
{
return;
}
BranchModel = ((P3DPlantModelTreeCtrlItemData*)(GetItemData(GetSelection())))->GetBranchModel();
StemModel = new P3DStemModelWings(ParentStemModel);
BranchingAlg = new P3DBranchingAlgWings();
unsigned int SubBranchIndex;
wxTreeItemId ItemId;
wxTreeItemId ParentItemId;
SubBranchIndex = 0;
ItemId = GetSelection();
ParentItemId = GetItemParent(ItemId);
while ((ItemId = GetPrevSibling(ItemId)).IsOk())
{
SubBranchIndex++;
}
P3DApp::GetApp()->ExecEditCmd
(new ChangeStemModelCommand
(ParentBranchModel,
SubBranchIndex,
BranchModel,
StemModel,
BranchingAlg,
this,
BranchPanel));
}
开发者ID:Benjamin-L,项目名称:Dinosauria,代码行数:53,代码来源:p3dmedit.cpp
示例4: wxLogTrace
bool DirectoryTree::IsAncestorOf(wxTreeItemId tidPutativeAncestor, wxTreeItemId tid)
{
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("IsAncestorOf(%u, %u)"), (int) tidPutativeAncestor, (int) tid);
wxTreeItemId tidParent = GetItemParent(tid);
while(tidParent.IsOk())
{
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("\tParent: %u"), (int) tidParent);
if(tidParent == tidPutativeAncestor)
return true;
tidParent = GetItemParent(tidParent);
}
return false;
}
开发者ID:joeyates,项目名称:sherpa,代码行数:13,代码来源:DirectoryTree.cpp
示例5: while
wxTreeItemId ComponentTreeCtrl::get_CompId(wxTreeItemId itemid)
{ /* returns the ItemId of the ComponentPackage */
while (GetItemParent(itemid)!=GetRootItem())
{
itemid=GetItemParent(itemid);
}
return itemid;
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:13,代码来源:ComponentTreeCtrl.cpp
示例6: GetSelection
void P3DPlantModelTreeCtrl::OnRemoveStemClick
(wxCommandEvent &event)
{
P3DBranchModel *BranchModel;
P3DBranchModel *ParentBranchModel;
wxTreeItemId ParentId;
wxTreeItemId ItemId;
wxTreeItemId CurrItemId;
unsigned int SubBranchIndex;
ItemId = GetSelection();
ParentId = GetItemParent(ItemId);
if (!ParentId.IsOk())
{
return;
}
SubBranchIndex = 0;
CurrItemId = ItemId;
while (CurrItemId.IsOk())
{
SubBranchIndex++;
CurrItemId = GetPrevSibling(CurrItemId);
}
ParentBranchModel = ((P3DPlantModelTreeCtrlItemData*)(GetItemData(ParentId)))->GetBranchModel();
P3DApp::GetApp()->ExecEditCmd
(new P3DRemoveStemCommand(ParentBranchModel,SubBranchIndex - 1,this));
}
开发者ID:Benjamin-L,项目名称:Dinosauria,代码行数:33,代码来源:p3dmedit.cpp
示例7: wxCHECK_RET
void wxTreeListCtrl::UpdateItemParentStateRecursively(wxTreeListItem item)
{
wxCHECK_RET( item.IsOk(), "Invalid item" );
wxASSERT_MSG( HasFlag(wxTL_3STATE), "Can only be used with wxTL_3STATE" );
for ( ;; )
{
wxTreeListItem parent = GetItemParent(item);
if ( parent == GetRootItem() )
{
// There is no checked state associated with the root item.
return;
}
// Set parent state to the state of this item if all the other children
// have the same state too. Otherwise make it indeterminate.
const wxCheckBoxState stateItem = GetCheckedState(item);
CheckItem(parent, AreAllChildrenInState(parent, stateItem)
? stateItem
: wxCHK_UNDETERMINED);
// And do the same thing with the parent's parent too.
item = parent;
}
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:26,代码来源:treelist.cpp
示例8: while
CServerPath CRemoteTreeView::GetPathFromItem(const wxTreeItemId& item) const
{
std::list<wxString> segments;
wxTreeItemId i = item;
while (i != GetRootItem())
{
const CItemData* const pData = (const CItemData*)GetItemData(i);
if (pData)
{
CServerPath path = pData->m_path;
for (std::list<wxString>::const_iterator iter = segments.begin(); iter != segments.end(); ++iter)
{
if (!path.AddSegment(*iter))
return CServerPath();
}
return path;
}
segments.push_front(GetItemText(i));
i = GetItemParent(i);
}
return CServerPath();
}
开发者ID:oneminot,项目名称:filezilla3,代码行数:25,代码来源:RemoteTreeView.cpp
示例9: findId
bool CocaSystemTree::moveDown( const coca::INode& node )
{
wxTreeItemId id = findId( node );
if ( !id.IsOk() ) { return false; }
wxTreeItemId parentId = GetItemParent( id );
if ( !parentId.IsOk() ) { return false; }
wxTreeItemId nextId = GetNextSibling( id );
if ( !nextId.IsOk() ) { return false; }
// ready to move
bool wasSelected = ( id == GetSelection() );
Delete( id );
id = InsertItem( parentId, nextId,
EditorTools::getName( node ), EditorTools::getImageIndex( node ),
-1, new ItemData( node ) );
COCA_ASSERT( id.IsOk() );
SetItemTextColour( id, EditorTools::getTextColour( node ) );
addChildren( node, id );
if ( wasSelected ) { SelectItem( id ); }
return true;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:27,代码来源:CocaSystemTree.cpp
示例10: wxCHECK_MSG
wxTreeItemId PHPFileLayoutTree::TryGetPrevItem(wxTreeItemId item)
{
wxCHECK_MSG(item.IsOk(), wxTreeItemId(), wxT("invalid tree item"));
// find out the starting point
wxTreeItemId prevItem = GetPrevSibling(item);
if(!prevItem.IsOk()) {
prevItem = GetItemParent(item);
if(prevItem == GetRootItem()) {
return wxTreeItemId();
}
}
// from there we must be able to navigate until this item
while(prevItem.IsOk()) {
ScrollTo(prevItem);
if(!IsVisible(prevItem)) {
return wxTreeItemId();
}
const wxTreeItemId nextItem = GetNextVisible(prevItem);
if(!nextItem.IsOk() || nextItem == item) return prevItem;
prevItem = nextItem;
}
return wxTreeItemId();
}
开发者ID:05storm26,项目名称:codelite,代码行数:30,代码来源:php_file_layout_tree.cpp
示例11: findSession
void SessionTreeControl::removeSession( std::string address )
{
wxTreeItemId item = findSession( rootID, address );
if ( !item.IsOk() )
{
gravUtil::logWarning( "SessionTreeControl::removeObject: "
"item %s not found?\n", address.c_str() );
return;
}
SessionType type;
wxTreeItemId parent = GetItemParent( item );
if ( parent == videoNodeID )
type = VIDEOSESSION;
else if ( parent == audioNodeID )
type = AUDIOSESSION;
else if ( parent == availableVideoNodeID )
type = AVAILABLEVIDEOSESSION;
else
{
gravUtil::logError( "SessionTreeControl::removeObject: "
"cannot remove %s - invalid tree\n", address.c_str() );
return;
}
if ( sessionManager->removeSession( address, type ) )
Delete( item );
else
{
gravUtil::logError( "SessionTreeControl::removeObject: "
"removal of %s failed \n", address.c_str() );
// TODO throw GUI error dialog
}
}
开发者ID:Adhesion,项目名称:grav,代码行数:35,代码来源:SessionTreeControl.cpp
示例12: GetSelection
void wxTreeViewComboPopup::OnMouseClick(wxMouseEvent& event)
{
m_bClicked = true;
wxTreeItemId ItemId = GetSelection();
if(ItemId.IsOk())
{
if(m_PrewItemId.IsOk())
{
CollapseAllChildren(GetItemParent(m_PrewItemId));
}
if(ItemId != GetRootItem())
{
CollapseAllChildren(ItemId);
}
else
{
CollapseAll();
Expand(GetRootItem());
}
wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ItemId);
if(pData != NULL)
{
SelectItem(ItemId);
m_pSelection->Select(pData->m_nObjectID, false, GetId());
m_PrewItemId = ItemId;
}
}
Dismiss();
event.Skip(true);
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:32,代码来源:gxobgdialog.cpp
示例13: GetSelection
void CppSymbolTree::AdvanceSelection(bool forward)
{
wxTreeItemId item = GetSelection();
if (!item.IsOk()) {
return;
}
wxTreeItemId nextItem;
if (forward) {
nextItem = GetNextVisible(item);
if ( !nextItem.IsOk() ) {
// we could not get the next visible, try the next sibling
nextItem = GetNextSibling(item);
if ( !nextItem.IsOk() ) {
// we are the last child... try the sibling of our parent
wxTreeItemId parent = GetItemParent(item);
if ( !parent.IsOk() ) {
return;
}
nextItem = GetNextSibling(parent);
}
}
} else {
nextItem = TryGetPrevItem(item);
}
if (nextItem.IsOk()) {
SelectItem(nextItem);
}
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:31,代码来源:cpp_symbol_tree.cpp
示例14: GetTreeItem
void wxSpinTreeCtrl::addToTree(spin::ReferencedNode *n)
{
wxTreeItemId nodeInTree = GetTreeItem(n);
if (nodeInTree)
{
// If node is already in the tree, we check to see if the parent has
// changed. If it has, we remove it first
wxTreeItemId parentTreeItem = GetTreeItem(n->getParent());
if (parentTreeItem == GetItemParent(nodeInTree))
{
// the parent in the tree is already correct, so we don't need to do
// anything
std::cout << "Warning (wxSpinTreeCtrl::addToTree). Node " << n->getID() << " already exists in tree." << std::endl;
}
else
{
// The node in the tree has the wrong parent, so we need to first
// remove the node from the tree, before we can add it to the proper
// parent.
Freeze();
Delete(nodeInTree);
Thaw();
}
}
wxTreeItemId parentTreeItem = GetTreeItem(n->getParent());
if (parentTreeItem)
addToTree(n,parentTreeItem);
else
addToTree(n,GetRootItem());
}
开发者ID:mikewoz,项目名称:spinframework,代码行数:31,代码来源:wxSpinTreeCtrl.cpp
示例15: GetItemParent
void SkillObjectTree::OnEndDrag(wxTreeEvent& event)
{
wxTreeItemId itemSrc = m_draggedItem,
itemDst = event.GetItem();
m_draggedItem = (wxTreeItemId)0l;
// where to copy the item?
if ( itemDst.IsOk() && !ItemHasChildren(itemDst) )
{
// copy to the parent then
itemDst = GetItemParent(itemDst);
}
if ( !itemDst.IsOk() )
{
wxLogMessage(wxT("OnEndDrag: can't drop here."));
return;
}
wxString text = GetItemText(itemSrc);
wxLogMessage(wxT("OnEndDrag: '%s' copied to '%s'."),
text.c_str(), GetItemText(itemDst).c_str());
// just do append here - we could also insert it just before/after the item
// on which it was dropped, but this requires slightly more work... we also
// completely ignore the client data and icon of the old item but could
// copy them as well.
//
// Finally, we only copy one item here but we might copy the entire tree if
// we were dragging a folder.
//int image = wxGetApp().ShowImages() ? TreeCtrlIcon_File : -1;
//AppendItem(itemDst, text, image);
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:34,代码来源:SkillObjectTree.cpp
示例16: GetFirstChild
bool CLocalTreeView::CheckSubdirStatus(wxTreeItemId& item, const wxString& path)
{
wxTreeItemIdValue value;
wxTreeItemId child = GetFirstChild(item, value);
static const wxLongLong size(-1);
#ifdef __WXMAC__
// By default, OS X has a list of servers mounted into /net,
// listing that directory is slow.
if (GetItemParent(item) == GetRootItem() && (path == _T("/net") || path == _T("/net/")))
{
CFilterManager filter;
const int attributes = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
if (!filter.FilenameFiltered(_T("localhost"), path, true, size, true, attributes))
{
if (!child)
AppendItem(item, _T(""));
return true;
}
}
#endif
if (child)
{
if (GetItemText(child) != _T(""))
return false;
CTreeItemData* pData = (CTreeItemData*)GetItemData(child);
if (pData)
{
bool wasLink;
int attributes;
enum CLocalFileSystem::local_fileType type;
if (path.Last() == CLocalFileSystem::path_separator)
type = CLocalFileSystem::GetFileInfo(path + pData->m_known_subdir, wasLink, 0, 0, &attributes);
else
type = CLocalFileSystem::GetFileInfo(path + CLocalFileSystem::path_separator + pData->m_known_subdir, wasLink, 0, 0, &attributes);
if (type == CLocalFileSystem::dir)
{
CFilterManager filter;
if (!filter.FilenameFiltered(pData->m_known_subdir, path, true, size, true, attributes))
return true;
}
}
}
wxString sub = HasSubdir(path);
if (sub != _T(""))
{
wxTreeItemId subItem = AppendItem(item, _T(""));
SetItemData(subItem, new CTreeItemData(sub));
}
else if (child)
Delete(child);
return true;
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:59,代码来源:LocalTreeView.cpp
示例17: GetItemParent
wxTreeItemId
SamplesTreeCtrl::getSpeaker( const wxTreeItemId &speech ) const
{
wxTreeItemId parentItem = GetItemParent( speech );
while ( true )
{
if ( parentItem.IsOk() )
{
if ( GetItemData( parentItem ) == NULL )
return parentItem;
}
else
return parentItem;
parentItem = GetItemParent( parentItem );
}
}
开发者ID:rainChu,项目名称:ytp-king,代码行数:17,代码来源:SamplesTreeCtrl.cpp
示例18: SetItemImage
void ctlCheckTreeView::SetParentImage(wxTreeItemId node, int newimage)
{
if (node.IsOk())
{
SetItemImage(node, newimage);
SetParentImage(GetItemParent(node), newimage);
}
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:8,代码来源:ctlCheckTreeView.cpp
示例19: ctext
wxTreeItemId CConfigTree::FindNextItemId(wxTreeItemId treeItemId, const wxString& text,
bool checkFirst, bool matchCase, bool matchWord)
{
wxString ctext(text);
if (!matchCase) {
ctext.MakeLower();
}
wxTreeItemId found;
wxTreeItemId id;
wxTreeItemId currentId = treeItemId;
CConfigItem *item = NULL;
wxTreeItemIdValue dummy;
while (currentId.IsOk()) {
if (checkFirst) {
CTreeItemData *data = (CTreeItemData *)GetItemData(currentId);
if (data) {
if ((item = data->GetConfigItem()) != NULL) {
wxString name = item->GetName();
wxString brief = item->GetBriefDescription();
wxString desc = item->GetDescription();
if (!matchCase) {
name.MakeLower();
brief.MakeLower();
desc.MakeLower();
}
if (CUtils::FindString(name, ctext, matchWord) ||
CUtils::FindString(brief, ctext, matchWord) ||
CUtils::FindString(desc, ctext, matchWord)) {
found = currentId;
break;
}
}
}
}
checkFirst = true;
id = GetFirstChild(currentId, dummy);
if (!id.IsOk()) {
id = GetNextSibling(currentId);
if (!id.IsOk()) {
wxTreeItemId parentId = currentId;
do {
parentId = GetItemParent(parentId);
if (!parentId.IsOk()) {
break;
}
id = GetNextSibling(parentId);
} while (!id.IsOk());
}
}
currentId = id;
}
return found;
}
开发者ID:niziak,项目名称:ethernut-4.9,代码行数:57,代码来源:configtree.cpp
示例20: wxGetTextFromUser
void PartitioningTreeCtrl::onregister_at_name_service(wxCommandEvent& event)
{
// opens dialog
// request full scoped Naming Context name to register at
wxString ns_name = wxGetTextFromUser("Enter a name for registering at Name Service","Register at NameService",
"", this,-1,-1,TRUE);
wxString text="NameService: ";
text.Append(ns_name);
// add name to tree
wxTreeItemId itemid = AppendItem(GetSelection(),text,
TreeCtrlIcon_Folder,TreeCtrlIcon_FolderSelected,NULL);
Expand(GetRootItem());
Refresh();
ItemTyp itype;
itype.itemid=itemid;
itype.type=registration;
itype.usagename=ns_name;
itemtypes.push_back(itype);
// add information to instance or port
ElementType etype=GetType(GetSelection());
if (etype==inst) {
// get instance
Instantiation curr_instance = get_Instantiation(GetSelection());
// add register Info to instance
curr_instance.component_registration = ns_name;
replace_Instantiation(curr_instance);
}
if (etype==facet) {
// get instance
Instantiation curr_instance = get_Instantiation(GetItemParent(GetSelection()));
// create new facet-registration
PartitioningTreeCtrl::ItemTyp facet_item = GetItemInfo(GetSelection());
FacetRegistration fr;
fr.facet_name = facet_item.usagename;
fr.ns_name = ns_name;
// add register Info to instance
curr_instance.facet_registrations.push_back(fr);
replace_Instantiation(curr_instance);
}
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:56,代码来源:PartitioningTreeCtrl.cpp
注:本文中的GetItemParent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论