virtual BOOL on_draw   (HELEMENT he, UINT draw_type, HDC hdc, const RECT& rc ) 
    { 
      if( draw_type != DRAW_CONTENT )
        return FALSE; /*do default draw*/ 

      dom::element el = he;
      
      UINT pta = GetTextAlign(hdc);
      SetTextAlign(hdc, TA_LEFT | TA_TOP |TA_NOUPDATECP); 
#ifdef _WIN32_WCE
    CString fileName(el.text());
    CString dottedFileName;
    FormatFileName(hdc, fileName, dottedFileName, rc.right - rc.left);
    DrawTextW(hdc, dottedFileName, -1, const_cast<RECT*>(&rc), DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_NOCLIP);
#else
      DrawTextW(hdc, el.text(), -1, const_cast<RECT*>(&rc), DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_PATH_ELLIPSIS | DT_NOPREFIX);
#endif
      SetTextAlign(hdc, pta); 
      return TRUE; /*skip default draw as we did it already*/ 
    }
Пример #2
0
FILE * CreateDumpFile(const char * szFormat, TCascStorage * hs)
{
    FILE * fp = NULL;
    char * szFileName;

    // Validate the storage handle
    if(hs != NULL)
    {
        // Format the real file name
        szFileName = FormatFileName(szFormat, hs);
        if(szFileName != NULL)
        {
            // Create the dump file
            fp = fopen(szFileName, "wt");
            CASC_FREE(szFileName);
        }
    }

    return fp;
}
void CViewTransfersGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
    wxInt32 docCount = GetDocCount();

    // We haven't connected up to the CC yet, there is nothing to display, make sure
    //   everything is deleted.
    if ( docCount <= 0 ) {
        if ( m_pGridPane->GetNumberRows() ) {
            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows());
        }
        return;
    }
    
    // Right-size the grid so that the number of rows matches
    //   the document state.
    if(docCount != m_pGridPane->GetNumberRows()) {
        if (docCount > m_pGridPane->GetNumberRows()) {
    	    m_pGridPane->AppendRows(docCount - m_pGridPane->GetNumberRows());
        } else {
            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - docCount);
    	    m_bForceUpdateSelection = true;
        }
        wxASSERT(docCount == m_pGridPane->GetNumberRows());
    }

    m_bIgnoreUIEvents = true;
    m_pGridPane->SaveSelection();
    m_bIgnoreUIEvents = false;

	//update cell values
	wxString strBuffer;
    int iMax = m_pGridPane->GetNumberRows();
    for(int iRow = 0; iRow < iMax; iRow++) {

        FormatProjectName(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_PROJECT) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_PROJECT, strBuffer);
        }

		FormatFileName(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_FILE) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_FILE, strBuffer);
        }

        FormatProgress(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_PROGRESS) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_PROGRESS, strBuffer);
		    m_pGridPane->SetCellAlignment(iRow, COLUMN_PROGRESS, wxALIGN_CENTRE, wxALIGN_CENTRE);
        }

        FormatSize(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_SIZE) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_SIZE, strBuffer);
        }

        FormatTime(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_TIME) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_TIME, strBuffer);
        }
		
        FormatSpeed(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_SPEED) != strBuffer) {
		    m_pGridPane->SetCellValue(iRow, COLUMN_SPEED, strBuffer);
        }

        strBuffer = wxEmptyString;
        FormatStatus(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_STATUS) != strBuffer) {
    		m_pGridPane->SetCellValue(iRow, COLUMN_STATUS, strBuffer);
        }

        FormatProjectURL(iRow, strBuffer);
        if (m_pGridPane->GetCellValue(iRow, COLUMN_HIDDEN_URL) != strBuffer) {
    		m_pGridPane->SetCellValue(iRow, COLUMN_HIDDEN_URL, strBuffer);
        }
    }

    m_pGridPane->SortData();

    m_bIgnoreUIEvents = true;
    m_pGridPane->RestoreSelection();
    m_bIgnoreUIEvents = false;

    UpdateSelection();
}