本文整理汇总了C++中ItemData::SetFile方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemData::SetFile方法的具体用法?C++ ItemData::SetFile怎么用?C++ ItemData::SetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData::SetFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoAddFolder
void PHPWorkspaceView::DoAddFolder(const wxTreeItemId& parent, PHPFolder::Ptr_t folder, PHPProject::Ptr_t project)
{
// add the folder itself
ItemData* itemData = new ItemData(ItemData::Kind_Folder);
itemData->SetFolderPath(folder->GetPathRelativeToProject());
itemData->SetProjectName(project->GetName());
itemData->SetFolderName(folder->GetName()); // display name
wxTreeItemId folderItem = EnsureFolderExists(
DoGetProjectItem(project->GetName()), folder->GetPathRelativeToProject(), project->GetName());
// Get list of folders
const PHPFolder::List_t& children = folder->GetChildren();
PHPFolder::List_t::const_iterator iter = children.begin();
for(; iter != children.end(); ++iter) {
DoAddFolder(folderItem, *iter, project);
}
wxArrayString folderFiles;
folder->GetFiles(folderFiles, project->GetFilename().GetPath(), 0);
// Add the files
for(size_t i = 0; i < folderFiles.GetCount(); ++i) {
ItemData* itemData = new ItemData(ItemData::Kind_File);
itemData->SetFile(folderFiles.Item(i));
itemData->SetProjectName(project->GetName());
itemData->SetFolderPath(folder->GetPathRelativeToProject());
int imgId = DoGetItemImgIdx(folderFiles.Item(i));
m_treeCtrlView->AppendItem(folderItem, wxFileName(folderFiles.Item(i)).GetFullName(), imgId, imgId, itemData);
}
}
示例2: DoAddFolderFiles
void PHPWorkspaceView::DoAddFolderFiles(const wxString& project,
const wxString& folder,
const wxTreeItemId& folderTreeItemId,
wxStringSet_t* filesAdded)
{
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(project);
CHECK_PTR_RET(pProject);
PHPFolder::Ptr_t pFolder = pProject->Folder(folder);
CHECK_PTR_RET(pFolder);
wxArrayString files;
pFolder->GetFiles(files, pProject->GetFilename().GetPath());
files.Sort();
for(size_t i = 0; i < files.GetCount(); ++i) {
wxFileName fn(files.Item(i));
// create the user data
ItemData* itemData = new ItemData(ItemData::Kind_File);
itemData->SetFile(fn.GetFullPath());
itemData->SetFolderPath(folder);
itemData->SetProjectName(project);
int imgId = DoGetItemImgIdx(fn.GetFullName());
m_treeCtrlView->AppendItem(folderTreeItemId, fn.GetFullName(), imgId, imgId, itemData);
if(filesAdded) {
filesAdded->insert(fn.GetFullPath());
}
}
}
示例3: DoAddFilesToTreeView
void PHPWorkspaceView::DoAddFilesToTreeView(const wxTreeItemId& folderId, PHPProject::Ptr_t pProject, PHPFolder::Ptr_t pFolder, const wxArrayString& files)
{
for(size_t i=0; i<files.GetCount(); ++i) {
ItemData *itemData = new ItemData(ItemData::Kind_File);
itemData->SetFile( files.Item(i) );
itemData->SetProjectName( pProject->GetName() );
itemData->SetFolderPath( pFolder->GetPathRelativeToProject() );
int imgId = DoGetItemImgIdx(files.Item(i));
m_treeCtrlView->AppendItem(folderId, wxFileName(files.Item(i)).GetFullName(), imgId, imgId, itemData);
}
m_treeCtrlView->SortChildren( folderId );
}
示例4: OnRenameFile
void PHPWorkspaceView::OnRenameFile(wxCommandEvent& e)
{
wxTreeItemId item = DoGetSingleSelection();
CHECK_ITEM_RET(item);
ItemData *data = DoGetItemData(item);
CHECK_PTR_RET(data);
CHECK_ID_FILE(data);
wxFileName old_file_name = data->GetFile();
wxString new_name = ::wxGetTextFromUser(_("New file name:"), _("Rename file"), old_file_name.GetFullName() );
if ( new_name.IsEmpty() )
return;
if ( new_name == old_file_name.GetFullName() )
return;
// Check to see if we got a file with the old path opened
bool reopenFile = false;
IEditor *editor = m_mgr->FindEditor(old_file_name.GetFullPath());
if ( editor ) {
m_mgr->ClosePage( editor->GetFileName().GetFullName() );
reopenFile = true;
editor = NULL;
}
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(DoGetSelectedProject());
CHECK_PTR_RET(pProject);
if ( pProject->RenameFile(old_file_name.GetFullPath(), new_name) ) {
// Locate the folder
pProject->Save();
m_treeCtrlView->SetItemText(item, new_name);
// Update the item data
old_file_name.SetFullName(new_name);
data->SetFile( old_file_name.GetFullPath() );
// Open the file if it was opened earlier
// old_file_name now contains the new full path to the new file
if ( reopenFile ) {
m_mgr->OpenFile( old_file_name.GetFullPath() );
}
}
}