#include "stdafx.h"
#include "Unit.h"

void UnitRecordWrapper::displayIn(QTreeWidgetItemUnit* item) const
{
  item->setCustomData(m_id);
  item->setText(0, m_name);

  if (!m_accessible)
  {
    QFont font(item->font(0));
    font.setItalic(true);
    item->setFont(0, font);
  }
  
  QBrush brush = item->foreground(0);
  QColor color;
  if (m_player == BWAPI::Broodwar->self())
    color = QColor(0, 0, 255);
  else if (m_player == BWAPI::Broodwar->enemy())
    color = QColor(255, 0, 0);
  else
    color = QColor(150, 150, 150);
  brush.setColor(color);
  item->setForeground(0, brush);

  item->setExpanded(true);
};
