+
+ wxRect update = GetUpdateRegion().GetBox();
+ m_owner->CalcUnscrolledPosition( update.x, update.y, &update.x, &update.y );
+
+ wxDataViewListModel *model = GetOwner()->GetModel();
+
+ size_t item_start = update.y / m_lineHeight;
+ size_t item_count = (update.height / m_lineHeight) + 1;
+
+ wxRect cell_rect;
+ cell_rect.x = 0;
+ cell_rect.height = m_lineHeight;
+ size_t cols = GetOwner()->GetNumberOfColumns();
+ size_t i;
+ for (i = 0; i < cols; i++)
+ {
+ wxDataViewColumn *col = GetOwner()->GetColumn( i );
+ wxDataViewCell *cell = col->GetCell();
+ cell_rect.width = col->GetWidth();
+
+ size_t item;
+ for (item = item_start; item <= item_start+item_count; item++)
+ {
+ cell_rect.y = item*m_lineHeight;
+ wxVariant value;
+ model->GetValue( value, col->GetModelColumn(), item );
+ cell->SetValue( value );
+ wxSize size = cell->GetSize();
+ // cannot be bigger than allocated space
+ size.x = wxMin( size.x, cell_rect.width );
+ size.y = wxMin( size.y, cell_rect.height );
+ // TODO: check for left/right/centre alignment here
+ wxRect item_rect;
+ // for now: centre
+ item_rect.x = cell_rect.x + (cell_rect.width / 2) - (size.x / 2);
+ item_rect.y = cell_rect.y + (cell_rect.height / 2) - (size.y / 2);
+
+ item_rect.width = size.x;
+ item_rect.height= size.y;
+ cell->Render( item_rect, &dc, 0 );
+ }
+
+ cell_rect.x += cell_rect.width;
+ }