本文整理汇总了C++中ProjectPtr::GetVirtualDirectories方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr::GetVirtualDirectories方法的具体用法?C++ ProjectPtr::GetVirtualDirectories怎么用?C++ ProjectPtr::GetVirtualDirectories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectPtr
的用法示例。
在下文中一共展示了ProjectPtr::GetVirtualDirectories方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoBuildTree
void VirtualDirectorySelectorDlg::DoBuildTree()
{
wxWindowUpdateLocker locker(m_treeCtrl);
m_treeCtrl->DeleteAllItems();
if ( m_images == NULL ) {
m_images = new wxImageList(16, 16);
BitmapLoader bmpLoader;
m_images->Add( bmpLoader.LoadBitmap( wxT( "workspace/16/workspace" ) ) );//0
m_images->Add( bmpLoader.LoadBitmap( wxT( "workspace/16/virtual_folder" ) ) ); //1
m_images->Add( bmpLoader.LoadBitmap( wxT( "workspace/16/project" ) ) ); //2
m_treeCtrl->AssignImageList(m_images);
}
if (m_workspace) {
wxArrayString projects;
m_workspace->GetProjectList(projects);
VisualWorkspaceNode nodeData;
nodeData.name = m_workspace->GetName();
nodeData.type = ProjectItem::TypeWorkspace;
TreeNode<wxString, VisualWorkspaceNode> *tree = new TreeNode<wxString, VisualWorkspaceNode>(m_workspace->GetName(), nodeData);
for (size_t i=0; i<projects.GetCount(); i++) {
if (!m_projectName.empty() && projects.Item(i) != m_projectName) {
// If we were passed a specific project, display only that one
continue;
}
wxString err;
ProjectPtr p = m_workspace->FindProjectByName(projects.Item(i), err);
if (p) {
p->GetVirtualDirectories(tree);
}
}
//create the tree
wxTreeItemId root = m_treeCtrl->AddRoot(nodeData.name, 0, 0);
tree->GetData().itemId = root;
TreeWalker<wxString, VisualWorkspaceNode> walker(tree);
for (; !walker.End(); walker++) {
// Add the item to the tree
TreeNode<wxString, VisualWorkspaceNode>* node = walker.GetNode();
// Skip root node
if (node->IsRoot())
continue;
wxTreeItemId parentHti = node->GetParent()->GetData().itemId;
if (parentHti.IsOk() == false) {
parentHti = root;
}
int imgId(2); // Virtual folder
switch (node->GetData().type) {
case ProjectItem::TypeWorkspace:
imgId = 0;
break;
case ProjectItem::TypeProject:
imgId = 2;
break;
case ProjectItem::TypeVirtualDirectory:
default:
imgId = 1;
break;
}
//add the item to the tree
node->GetData().itemId = m_treeCtrl->AppendItem(
parentHti, // parent
node->GetData().name, // display name
imgId, // item image index
imgId // selected item image
);
m_treeCtrl->SortChildren(parentHti);
}
#if !defined(__WXMSW__)
// For a single project, hide the workspace node. This doesn't work on wxMSW
if (!m_projectName.empty()) {
m_treeCtrl->SetWindowStyle(m_treeCtrl->GetWindowStyle() | wxTR_HIDE_ROOT);
wxTreeItemIdValue cookie;
wxTreeItemId projitem = m_treeCtrl->GetFirstChild(root, cookie);
if (projitem.IsOk() && m_treeCtrl->HasChildren(projitem)) {
m_treeCtrl->Expand(projitem);
}
}
else
#endif
if (root.IsOk() && m_treeCtrl->HasChildren(root)) {
m_treeCtrl->Expand(root);
}
delete tree;
}
// if a initialPath was provided, try to find and select it
//.........这里部分代码省略.........