Files
Upsilon/apps/graph/values/title_cell.cpp
Émilie Feral 96a9ac3a9c [apps/graph] Wrap in namespace Graph
Change-Id: I08b37438f42749ff86e105770cd5aa566f84a237
2016-10-14 11:47:19 +02:00

27 lines
728 B
C++

#include "title_cell.h"
#include "../function_store.h"
namespace Graph {
TitleCell::TitleCell() :
EvenOddCell(),
m_text(nullptr)
{
}
void TitleCell::setText(const char * title) {
m_text = (char *)title;
}
void TitleCell::drawRect(KDContext * ctx, KDRect rect) const {
EvenOddCell::drawRect(ctx, rect);
// Write the content of the cell
KDColor background = backgroundColor();
KDSize textSize = KDText::stringSize(m_text);
KDPoint origin(0.5f*(m_frame.width() - textSize.width()), 0.5f*(m_frame.height() - textSize.height()));
ctx->drawString(m_text, origin, KDColorBlack, background);
ctx->drawString(Function::Parameter, origin.translatedBy(KDPoint(textSize.width(), 0)), KDColorBlack, background);
}
}