void EGridCtrl::AddRow( IGridRow* pRowHost ) { // // collect properties (columns) for the row // Row* pRow = new Row( pRowHost ); pRowHost->GetGridColumns( *pRow ); pRowHost->m_pGridCtrl = this; // // prepare the dc for size calculations // CDC* pDC = GetDC(); pDC->SelectObject( &m_Font ); // // // pRow->m_nHeight = GetRowHeight( pRow , pDC ); m_vRows.push_back( pRow ); // // update column list // std::list<Row*>::iterator iter = m_vRows.begin(); std::list<Row*>::iterator iend = m_vRows.end(); while( iter != iend ) //for all rows... { Row* pRow = *iter; ASSERT( pRow->GetTabCount()==1 ); ASSERT( pRow->GetActiveTab()==0 ); int n = pRow->Size(); for( int i=0 ; i<n ; i++ ) { EProperty* pProperty = pRow->Get(i); int m = EIconTextButtonProperty::s_nMargin; CString sName = pProperty->GetName(); Column* pColumn = GetColumn( sName , true , m + pDC->GetTextExtent(sName).cx + m ); pColumn->EnsureWidth( pProperty->GetPreferedWidth(pDC) ); } iter++; } ReleaseDC(pDC); // // calculate left of each column // RefreshColumnLefts( m_ViewportOrg.x ); RefreshRowTops( m_ViewportOrg.y ); // // // BuildPropertyMap(); // // // Invalidate(); }