- unsigned int ci;
- int cellX = x + 1;
- int nextCellWidth = state->m_colWidths[0] -
- (greyDepthX - m_marginWidth);
- wxRect cellRect(greyDepthX+1, y, 0, rowHeight-1);
- int textXAdd = textMarginHere - greyDepthX;
+ // Magic fine-tuning for non-category rows
+ cellRect.x += 1;
+ }
+
+ int firstCellWidth = colWidths[0] - (greyDepthX - m_marginWidth);
+ int firstCellX = cellRect.x;
+
+ // Calculate cellRect.x for the last cell
+ unsigned int ci = 0;
+ int cellX = x + 1;
+ for ( ci=0; ci<colWidths.size(); ci++ )
+ cellX += colWidths[ci];
+ cellRect.x = cellX;
+
+ // Draw cells from back to front so that we can easily tell if the
+ // cell on the right was empty from text
+ bool prevFilled = true;
+ ci = colWidths.size();
+ do
+ {
+ ci--;
+
+ int textXAdd = 0;
+
+ if ( ci == 0 )
+ {
+ textXAdd = textMarginHere - greyDepthX;
+ cellRect.width = firstCellWidth;
+ cellRect.x = firstCellX;
+ }
+ else
+ {
+ int colWidth = colWidths[ci];
+ cellRect.width = colWidth;
+ cellRect.x -= colWidth;
+ }