/************************************************ OnPaint Paints the corner button object. The corner button object uses a CUGCell located at position -1,-1 from the default datasource then uses the cell type associated with this cell to draw itself with. Params: <none> Return: <none> *************************************************/ void CUGCnrBtn::OnPaint() { if ( m_GI->m_paintMode == FALSE ) return; CPaintDC dc(this); // device context for painting m_ctrl->OnScreenDCSetup(&dc,NULL,UG_TOPHEADING); RECT rect; GetClientRect(&rect); CUGCellType * cellType; CUGCell cell; m_ctrl->GetCellIndirect(-1,-1,&cell); //get the cell type to draw the cell if(cell.IsPropertySet(UGCELL_CELLTYPE_SET)) cellType = m_ctrl->GetCellType(cell.GetCellType()); else cellType = m_ctrl->GetCellType(-1); CFont * pOldFont = NULL; // get the default font if there is one if( m_GI->m_defFont != NULL ) { pOldFont = dc.SelectObject( ( CFont* )m_GI->m_defFont ); } cellType->OnDraw(&dc,&rect,-1,-1,&cell,0,0); if( m_GI->m_defFont != NULL && pOldFont != NULL ) dc.SelectObject( pOldFont ); }
// v7.2 - update 04 - added as a pared down version of OnPaint to handle // WM_PRINT message - called from WindowProc below. TD void CUGCnrBtn::OnPrint(CDC *dc) { RECT rect; GetClientRect(&rect); CUGCellType * cellType; CUGCell cell; m_ctrl->GetCellIndirect(-1,-1,&cell); //get the cell type to draw the cell if(cell.IsPropertySet(UGCELL_CELLTYPE_SET)) cellType = m_ctrl->GetCellType(cell.GetCellType()); else cellType = m_ctrl->GetCellType(-1); CFont * pOldFont = NULL; // get the default font if there is one if( m_GI->m_defFont != NULL ) { pOldFont = dc->SelectObject( ( CFont* )m_GI->m_defFont ); } cellType->OnDraw(dc,&rect,-1,-1,&cell,0,0); if( m_GI->m_defFont != NULL && pOldFont != NULL ) dc->SelectObject( pOldFont ); }
VOID CALLBACK EXPORT CUGMarqueeType::TimerProc( HWND hwnd, // handle to window UINT uMsg, // WM_TIMER message unsigned int idEvent, // timer identifier DWORD dwTime // current system time ) #endif { UNREFERENCED_PARAMETER(dwTime); UNREFERENCED_PARAMETER(uMsg); CUGCtrl* ctrl = (CUGCtrl*)CWnd::FromHandle(hwnd); //check for errors if(ctrl == NULL) return; //check to see if any CUGMarqueeType cells are visible //if so then mark them for redraw int leftCol = ctrl->GetLeftCol(); int rightCol = ctrl->GetRightCol(); long topRow = ctrl->GetTopRow(); long bottomRow = ctrl->GetBottomRow(); CUGCell cell; for(long rows = topRow; rows <= bottomRow; rows++){ for(int cols = leftCol; cols <= rightCol; cols++){ ctrl->GetCell(cols,rows,&cell); if(cell.GetCellType() == (int)idEvent){ //run other windows messages first //update the position for the next time the cell is drawn cell.SetParam(cell.GetParam() +1); ctrl->SetCell(cols,rows,&cell); RECT rect; ctrl->GetCellRect(cols,rows,&rect); ctrl->m_CUGGrid->m_drawHint.AddHint(cols,rows,cols,rows); if(ctrl->GetCurrentRow() != rows || ctrl->GetCurrentCol() != cols) ctrl->TempDisableFocusRect(); ctrl->m_CUGGrid->PaintDrawHintsNow(&rect); } } } }
/*************************************************** DrawCellsIntern function is the key to the fast redraw functionality in the Ultimate Grid. This function is responsible for drawing cells within the grid area, it makes sure that only the cells that are marked as invalid (by calling CUGDrawHint::IsInvalid function) are redrawn. Params: dc - pointer DC to draw on Returns: <none> *****************************************************/ void CUGTopHdg::DrawCellsIntern(CDC *dc) { CRect rect(0,0,0,0), cellRect; CUGCell cell; CUGCellType * cellType; int dcID; int xIndex,col; long yIndex,row; m_ctrl->OnScreenDCSetup(dc,NULL,UG_TOPHEADING); //set the default font if(m_GI->m_defFont != NULL) dc->SelectObject((CFont *) m_GI->m_defFont); int blankRight = 0; for(yIndex = (m_GI->m_numberTopHdgRows * -1); yIndex < 0 ; yIndex++) { row = yIndex; for(xIndex = 0;xIndex < m_GI->m_numberCols;xIndex++) { if(xIndex == m_GI->m_numLockCols) xIndex = m_GI->m_leftCol; col = xIndex; row = yIndex; //draw if invalid if(m_drawHint.IsInvalid(col,row) != FALSE) { GetCellRect(col,row,&rect); CopyRect(&cellRect,&rect); m_ctrl->GetCellIndirect(col,row,&cell); if(cell.IsPropertySet(UGCELL_JOIN_SET)) { GetCellRect(col,row,&cellRect); m_ctrl->GetJoinStartCell(&col,&row,&cell); if(m_drawHint.IsValid(col,row)) continue; m_drawHint.SetAsValid(col,row); } if(cellRect.left < cellRect.right) { cellType = m_ctrl->GetCellType(cell.GetCellType()); dcID = dc->SaveDC(); if(m_swapEndCol >=0 && col == m_swapStartCol) cellType->OnDraw(dc,&cellRect,col,row,&cell,1,0); else cellType->OnDraw(dc,&cellRect,col,row,&cell,0,0); dc->RestoreDC(dcID); } } if(rect.right > m_GI->m_gridWidth) break; } if(blankRight < rect.right) blankRight = rect.right; } if(blankRight < m_GI->m_gridWidth) { rect.top = 0; rect.bottom = m_GI->m_topHdgHeight; rect.left = blankRight; rect.right = m_GI->m_gridWidth; // fill-in the area that is not covered by cells CBrush brush( m_ctrl->OnGetDefBackColor( UG_TOPHEADING )); dc->FillRect( rect, &brush ); } }