Exemplo n.º 1
0
  protected void drawCells(
      GC gc, Rectangle clipRect, int fromCol, int toCol, int fromRow, int toRow) {
    int cnt = 0;
    Rectangle r;

    if (m_CellEditor != null) {
      if (!isCellVisible(m_CellEditor.m_Col, m_CellEditor.m_Row)) {
        Rectangle hide = new Rectangle(-101, -101, 100, 100);
        m_CellEditor.setBounds(hide);
      } else {
        m_CellEditor.setBounds(getCellRect(m_CellEditor.m_Col, m_CellEditor.m_Row));
      }
    }

    for (int row = fromRow; row < toRow; row++) {
      r = getCellRect(0, row);
      if (r.y + r.height < clipRect.y) {
        continue;
      }
      if (r.y > clipRect.y + clipRect.height) {
        break;
      }

      for (int col = fromCol; col < toCol; col++) {
        r = getCellRect(col, row);
        if (r.x > clipRect.x + clipRect.width) {
          break;
        }
        if (canDrawCell(col, row, clipRect)) {
          drawCell(gc, col, row);
          cnt++;
        }
      }
    }
  }