Files
Upsilon/apps/graph/even_odd_cell.cpp
Émilie Feral f809d089d6 [escher] Make table view accept only table view cell
Change-Id: I393375d0887e692a85747198d5b42d26d207dc83
2016-10-25 17:55:28 +02:00

33 lines
875 B
C++

#include "even_odd_cell.h"
namespace Graph {
constexpr KDColor EvenOddCell::k_evenLineBackgroundColor;
constexpr KDColor EvenOddCell::k_oddLineBackgroundColor;
constexpr KDColor EvenOddCell::k_selectedLineBackgroundColor;
EvenOddCell::EvenOddCell() :
TableViewCell(),
m_even(false)
{
}
void EvenOddCell::setEven(bool even) {
m_even = even;
reloadCell();
}
KDColor EvenOddCell::backgroundColor() const {
// Select the background color according to the even line and the cursor selection
KDColor background = m_even ? EvenOddCell::k_evenLineBackgroundColor : EvenOddCell::k_oddLineBackgroundColor;
background = isHighlighted() ? EvenOddCell::k_selectedLineBackgroundColor : background;
return background;
}
void EvenOddCell::drawRect(KDContext * ctx, KDRect rect) const {
KDColor background = backgroundColor();
ctx->fillRect(rect, background);
}
}