Beispiel #1
0
void wex::grid::set_cells_value(
  const wxGridCellCoords& start_coords, 
  const std::string& data)
{
  tokenizer tkz(data, "\n");

  auto start_at_row = start_coords.GetRow();

  while (tkz.has_more_tokens())
  {
    const auto line(tkz.get_next_token());

    tokenizer tkz(line, "\t");

    auto next_col = start_coords.GetCol();

    while (tkz.has_more_tokens() && next_col < GetNumberCols())
    {
      const std::string value = tkz.get_next_token();

      if (!IsReadOnly(start_at_row, next_col))
      {
        set_grid_cell_value(wxGridCellCoords(start_at_row, next_col), value);
      }

      next_col++;
    }

    start_at_row++;
  }
}
Beispiel #2
0
bool wex::grid::is_allowed_drop_selection(
  const wxGridCellCoords& drop_coords, const std::string& data)
{
  tokenizer tkz(data, "\n");

  int start_at_row = drop_coords.GetRow();

  while (tkz.has_more_tokens())
  {
    const auto line(tkz.get_next_token());

    tokenizer tkz(line, "\t");

    int next_col = drop_coords.GetCol();
    while (tkz.has_more_tokens() && next_col < GetNumberCols())
    {
      tkz.get_next_token(); // skip the value

      // If readonly, or this cell is part of the current selection, or outside grid
      // do not allow. Otherwise when dropping and clearing old selection afterwards,
      // we also cleared the new cells.
      // If moving is really supported by wxGrid, this might be changed.
      if (IsReadOnly(start_at_row, next_col) ||
          IsInSelection(start_at_row, next_col) ||
          start_at_row > GetNumberRows() ||
          next_col > GetNumberCols())
      {
        return false;
      }

      next_col++;
    }

    start_at_row++;
  }

  return true;
}
Beispiel #3
0
INLINE
void  wxeReturn::add(wxGridCellCoords val) {
    addInt(val.GetRow());
    addInt(val.GetCol());
    addTupleCount(2);
}