Files
Upsilon/apps/graph/list/function_expression_view.cpp
Émilie Feral e5ff8f65c3 [apps/graph] Handle undefined function
Change-Id: Id26e0f81ba5c1446655f33b2c63f97ab5b684e41
2016-10-24 15:24:01 +02:00

27 lines
838 B
C++

#include "function_expression_view.h"
namespace Graph {
FunctionExpressionView::FunctionExpressionView() :
FunctionCell()
{
}
void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
EvenOddCell::drawRect(ctx, rect);
if (m_function->layout() == nullptr) {
return;
}
// Select the background color according to the even line and the cursor selection
KDColor background = backgroundColor();
// Select text color according to the state of the function
bool active = m_function->isActive();
KDColor text = active ? KDColorBlack : FunctionCell::k_desactiveTextColor;
//Position the origin of expression
KDSize expressionSize = m_function->layout()->size();
KDPoint origin(0, 0.5f*(m_frame.height() - expressionSize.height()));
m_function->layout()->draw(ctx, origin, text, background);
}
}