Files
Upsilon/escher/src/even_odd_cell.cpp
Émilie Feral 35b979798d [escher] Optimize redrawing when changing features in cells (color,
highlight, even)

Change-Id: I0afa8b6fad656d578bb8e071183646196bc816f9
2017-11-21 17:37:25 +01:00

28 lines
668 B
C++

#include <escher/even_odd_cell.h>
#include <escher/palette.h>
EvenOddCell::EvenOddCell() :
HighlightCell(),
m_even(false)
{
}
void EvenOddCell::setEven(bool even) {
if (even != m_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 ? KDColorWhite : Palette::WallScreen ;
background = isHighlighted() ? Palette::Select : background;
return background;
}
void EvenOddCell::drawRect(KDContext * ctx, KDRect rect) const {
KDColor background = backgroundColor();
ctx->fillRect(rect, background);
}