Files
Upsilon/apps/graph/list/function_expression_view.cpp
Émilie Feral 22271b1f74 [apps/graph/list] Improve the drawing of the list of functions
Change-Id: I5325ed1a8959b55958dfd14c111e5369aed4ce81
2016-10-12 17:38:40 +02:00

20 lines
759 B
C++

#include "function_expression_view.h"
FunctionExpressionView::FunctionExpressionView() :
FunctionCell()
{
}
void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
EvenOddCell::drawRect(ctx, rect);
// 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);
}