Files
Upsilon/apps/graph/list/function_name_view.cpp
Émilie Feral 47a02344c2 [apps/graph/list] Modify the controller of functions to use a table view instead of a list view
Change-Id: I3767de865ef07761eb80310cfe80d6eb60821bb0
2016-09-30 17:12:32 +02:00

25 lines
1.1 KiB
C++

#include "function_name_view.h"
FunctionNameView::FunctionNameView() :
FunctionCell()
{
}
void FunctionNameView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
// First color the color indicator
KDColor functionColor = m_function->color();
ctx->fillRect(KDRect(0, 0, k_colorIndicatorThickness, height), functionColor);
// Select the background color according to the even line and the cursor selection
bool evenLine = m_even;
KDColor background = evenLine ? FunctionCell::k_evenLineBackgroundColor : FunctionCell::k_oddLineBackgroundColor;
background = m_highlighted ? FunctionCell::k_selectedLineBackgroundColor : background;
ctx->fillRect(KDRect(4, 0, width-4, height), background);
// Select text color according to the state of the function
bool active = m_function->isActive();
KDColor text = active ? KDColorBlack : FunctionCell::k_desactiveTextColor;
ctx->drawString(m_function->name(), KDPoint(4, 0), text, background);
// m_function->layout()->draw(ctx, KDPointZero);
}