banner_view.cpp 1.31 KB
#include "banner_view.h"

namespace Regression {

constexpr KDColor BannerView::k_textColor;
constexpr KDColor BannerView::k_backgroundColor;

BannerView::BannerView() :
  m_dotNameView(k_fontSize, 0.0f, 0.5f, k_textColor, k_backgroundColor),
  m_xView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_yView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_regressionTypeView(k_fontSize, (I18n::Message)0, 0.0f, 0.5f, k_textColor,k_backgroundColor),
  m_subText1(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_subText2(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_subText3(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_subText4(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
  m_subText5(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor)
{
}

int BannerView::numberOfSubviews() const {
  return k_numberOfTextViews;
}

TextView * BannerView::textViewAtIndex(int i) const {
  const TextView * textViews[k_numberOfTextViews] = {&m_dotNameView, &m_xView, &m_yView, &m_regressionTypeView, &m_subText1, &m_subText2, &m_subText3, &m_subText4, &m_subText5};
  return (TextView *)textViews[i];
}

MessageTextView * BannerView::messageTextViewAtIndex(int i) const {
  if (i == 3) {
    return (MessageTextView *)&m_regressionTypeView;
  }
  return nullptr;
}

}