本文整理汇总了C++中MyClientData::IsInitialized方法的典型用法代码示例。如果您正苦于以下问题:C++ MyClientData::IsInitialized方法的具体用法?C++ MyClientData::IsInitialized怎么用?C++ MyClientData::IsInitialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyClientData
的用法示例。
在下文中一共展示了MyClientData::IsInitialized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}