bool CListProcess::TransferDataToWindow() { wxString sTime; bool bStartTime = false; bool bStopTime = false; bool bRtn = true; bool bIsShown = IsShownOnScreen(); if(bIsShown) { Show(false); } size_t n = m_pDirList->GetCount(); long nItem; CDirEntry *pDirEntry; ClearAll(); InsertColumn(ITEM_DIR,_T("Directory"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_START,_T("Start"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_STOP,_T("Stop"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_STATUS,_T("Status"),wxLIST_FORMAT_LEFT); for(size_t i = 0; (i < n) && bRtn; i++) { pDirEntry = m_pDirList->At(i); const wxString &sInput(pDirEntry->GetInputDir()); const wxString &sStatus(pDirEntry->GetStatusString()); nItem = InsertItem((long)i,sInput); sTime = pDirEntry->FormatStartTime(); SetItem(nItem,ITEM_START,sTime); if(!sTime.IsEmpty()) { bStartTime = true; } sTime = pDirEntry->FormatStopTime(); SetItem(nItem,ITEM_STOP,sTime); if(!sTime.IsEmpty()) { bStopTime = true; } SetItem(nItem,ITEM_STATUS,sStatus); SetItemTextColour(nItem,pDirEntry->GetStatusColour()); } SetColumnWidth(ITEM_DIR,wxLIST_AUTOSIZE ); #define HEADER_SIZE 80 SetColumnWidth(ITEM_START,bStartTime ? wxLIST_AUTOSIZE : HEADER_SIZE); SetColumnWidth(ITEM_STOP,bStopTime ? wxLIST_AUTOSIZE : HEADER_SIZE); #undef HEADER_SIZE SetColumnWidth(ITEM_STATUS,wxLIST_AUTOSIZE ); if(bIsShown) { Show(true); } Refresh(); return bRtn; }
void CListProcess::UpdateStatus(int nItem) { wxString sTime; bool bStartTime = false; bool bStopTime = false; long nMin; long nMax; long nCount = (long) m_pDirList->GetCount(); if(nItem >= 0) { nMin = (long) nItem; nMax = nMin; nMax++; if(nMax > nCount) { nMax = nCount; } } else { nMin = 0; nMax = nCount; } wxListItem info; CDirEntry *pDirEntry; for(long i = nMin; i < nMax; i++) { pDirEntry = m_pDirList->At((size_t)i); const wxString &sStatus(pDirEntry->GetStatusString()); sTime = pDirEntry->FormatStartTime(); SetItem(i,ITEM_START,sTime); if(!sTime.IsEmpty()) { bStartTime = true; } sTime = pDirEntry->FormatStopTime(); SetItem(i,ITEM_STOP,sTime); if(!sTime.IsEmpty()) { bStopTime = true; } SetItem(i,ITEM_STATUS,sStatus); SetItemTextColour(i,pDirEntry->GetStatusColour()); } if(bStartTime) { SetColumnWidth(ITEM_START,wxLIST_AUTOSIZE ); } if(bStopTime) { SetColumnWidth(ITEM_STOP,wxLIST_AUTOSIZE ); } SetColumnWidth(ITEM_STATUS,wxLIST_AUTOSIZE); // Refresh(); }