Logo Search packages:      
Sourcecode: tagua version File versions  Download package

void Board::recreateBorder (  )  [private]

this internal function creates a new border, if needed

Definition at line 173 of file board.cpp.

References m_border_text, m_canvas_border_text, m_pieces_group, m_sprites, and updateBorder().

Referenced by createGrid(), and settingsChanged().

                           {
  m_border_text.clear();
  while(!m_canvas_border_text->items()->isEmpty())
    delete m_canvas_border_text->items()->first();

  if(m_border_coords.size() == 0)
    return;

  Point s = m_sprites.getSize();
  for(int w = 0; w<2; w++)
  for(int i = 0;i<s.x;i++) {
    int c = w ? i : i+s.x+s.y;
    QString l = m_border_coords.size()>c ? m_border_coords[c] : QString();
    ConstrainedText *item = new ConstrainedText(m_canvas_border_text);
    item->setColor(m_border_text_color);
    item->setText(l);
    item->setFont(m_border_font);
    item->setColor(m_border_text_color);
    item->show();
    m_border_text.push_back(item);
  }

  for(int w = 0; w<2; w++)
  for(int i = 0;i<s.y;i++) {
    int c = w ? i+s.x : i+2*s.x+s.y;
    QString n = m_border_coords.size()>c ? m_border_coords[c] : QString();
    ConstrainedText *item = new ConstrainedText(m_canvas_border_text);
    item->setColor(m_border_text_color);
    item->setText(n);
    item->setFont(m_border_font);
    item->setColor(m_border_text_color);
    item->show();
    m_border_text.push_back(item);
  }

  m_pieces_group->raise();

  updateBorder();
}


Generated by  Doxygen 1.6.0   Back to index