本文整理汇总了C++中MyClientData::SetInitialized方法的典型用法代码示例。如果您正苦于以下问题:C++ MyClientData::SetInitialized方法的具体用法?C++ MyClientData::SetInitialized怎么用?C++ MyClientData::SetInitialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyClientData
的用法示例。
在下文中一共展示了MyClientData::SetInitialized方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMenuRefreshFolder
void SFTPTreeView::OnMenuRefreshFolder(wxCommandEvent& event)
{
wxTreeListItems items;
m_treeListCtrl->GetSelections(items);
if(items.size() != 1) return;
wxTreeListItem item = items.at(0);
MyClientData* cd = GetItemData(item);
if(!cd || !cd->IsFolder()) {
return;
}
// Uninitialize the folder
cd->SetInitialized(false);
// Delete all the children
wxTreeListItem child = m_treeListCtrl->GetFirstChild(item);
while(child.IsOk()) {
wxTreeListItem nextChild = m_treeListCtrl->GetNextSibling(child);
m_treeListCtrl->DeleteItem(child);
child = nextChild;
}
// Re-append the dummy item
m_treeListCtrl->AppendItem(item, "<dummy>");
m_treeListCtrl->Collapse(item);
}
示例2: DoAddFolder
wxTreeListItem SFTPTreeView::DoAddFolder(const wxTreeListItem& parent, const wxString& path)
{
try {
m_sftp->CreateDir(path);
SFTPAttribute::Ptr_t attr = m_sftp->Stat(path);
// Update the UI
MyClientData* newCd = new MyClientData(path);
newCd->SetIsFolder(true);
newCd->SetInitialized(false);
wxTreeListItem child = m_treeListCtrl->AppendItem(
parent, newCd->GetFullName(), m_bmpLoader.GetMimeImageId(FileExtManager::TypeFolder), wxNOT_FOUND, newCd);
if(IsTypeColumnShown()) {
m_treeListCtrl->SetItemText(child, GetTypeColumnIndex(), attr->GetTypeAsString());
}
if(IsSizeColumnShown()) {
m_treeListCtrl->SetItemText(child, GetSizeColumnIndex(), wxString() << attr->GetSize());
}
m_treeListCtrl->AppendItem(child, "<dummy>");
m_treeListCtrl->SetSortColumn(0);
return child;
} catch(clException& e) {
::wxMessageBox(e.What(), "SFTP", wxICON_ERROR | wxOK | wxCENTER);
}
return wxTreeListItem();
}
示例3: DoAddFile
wxTreeListItem SFTPTreeView::DoAddFile(const wxTreeListItem& parent, const wxString& path)
{
try {
wxMemoryBuffer memBuffer;
m_sftp->Write(memBuffer, path);
SFTPAttribute::Ptr_t attr = m_sftp->Stat(path);
// Update the UI
MyClientData* newFile = new MyClientData(path);
newFile->SetIsFolder(false);
newFile->SetInitialized(false);
wxTreeListItem child = m_treeListCtrl->AppendItem(
parent,
newFile->GetFullName(),
m_bmpLoader.GetMimeImageId(FileExtManager::GetType(path, FileExtManager::TypeText)),
wxNOT_FOUND,
newFile);
m_treeListCtrl->SetSortColumn(0);
return child;
} catch(clException& e) {
::wxMessageBox(e.What(), "SFTP", wxICON_ERROR | wxOK | wxCENTER);
}
return wxTreeListItem();
}
示例4: DoExpandItem
bool SFTPTreeView::DoExpandItem(const wxTreeItemId& item)
{
MyClientData* cd = GetItemData(item);
CHECK_PTR_RET_FALSE(cd);
// already initialized this folder before?
if(cd->IsInitialized()) { return true; }
// get list of files and populate the tree
SFTPAttribute::List_t attributes;
try {
attributes = m_sftp->List(cd->GetFullPath(), clSFTP::SFTP_BROWSE_FILES | clSFTP::SFTP_BROWSE_FOLDERS);
} catch(clException& e) {
::wxMessageBox(e.What(), "SFTP", wxOK | wxICON_ERROR | wxCENTER, EventNotifier::Get()->TopFrame());
return false;
}
// Remove the dummy item and replace it with real items
wxTreeItemIdValue cookie;
wxTreeItemId dummyItem = m_treeCtrl->GetFirstChild(item, cookie);
m_treeCtrl->Delete(dummyItem);
cd->SetInitialized(true);
int nNumOfRealChildren = 0;
SFTPAttribute::List_t::iterator iter = attributes.begin();
for(; iter != attributes.end(); ++iter) {
SFTPAttribute::Ptr_t attr = (*iter);
if(attr->GetName() == "." || attr->GetName() == "..") continue;
++nNumOfRealChildren;
// determine the icon index
int imgIdx = wxNOT_FOUND;
if(attr->IsFolder()) {
imgIdx = m_bmpLoader->GetMimeImageId(FileExtManager::TypeFolder);
} else {
imgIdx = m_bmpLoader->GetMimeImageId(attr->GetName());
}
if(imgIdx == wxNOT_FOUND) { imgIdx = m_bmpLoader->GetMimeImageId(FileExtManager::TypeText); }
wxString path;
path << cd->GetFullPath() << "/" << attr->GetName();
while(path.Replace("//", "/")) {}
MyClientData* childClientData = new MyClientData(path);
childClientData->SetIsFolder(attr->IsFolder());
wxTreeItemId child = m_treeCtrl->AppendItem(item, attr->GetName(), imgIdx, imgIdx, childClientData);
// if its type folder, add a fake child item
if(attr->IsFolder()) { m_treeCtrl->AppendItem(child, "<dummy>"); }
}
return nNumOfRealChildren > 0;
}
示例5: DoAddFolder
wxTreeItemId SFTPTreeView::DoAddFolder(const wxTreeItemId& parent, const wxString& path)
{
try {
m_sftp->CreateDir(path);
SFTPAttribute::Ptr_t attr = m_sftp->Stat(path);
// Update the UI
MyClientData* newCd = new MyClientData(path);
newCd->SetIsFolder(true);
newCd->SetInitialized(false);
wxTreeItemId child = m_treeCtrl->AppendItem(
parent, newCd->GetFullName(), m_bmpLoader->GetMimeImageId(FileExtManager::TypeFolder), wxNOT_FOUND, newCd);
m_treeCtrl->AppendItem(child, "<dummy>");
return child;
} catch(clException& e) {
::wxMessageBox(e.What(), "SFTP", wxICON_ERROR | wxOK | wxCENTER);
}
return wxTreeItemId();
}