Files
Upsilon/apps/settings/cell_with_separator.cpp
Émilie Feral 953c9dfe64 [apps/settings] Create a parent class CellWithSeparator to
MessageTableCellWithEditableTextWithSeparator for future factorization
2020-02-12 15:13:15 +01:00

31 lines
916 B
C++

#include "cell_with_separator.h"
namespace Settings {
void CellWithSeparator::setHighlighted(bool highlight) {
cell()->setHighlighted(highlight);
HighlightCell::setHighlighted(highlight);
}
void CellWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
//ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::GreyBright);
KDCoordinate height = bounds().height();
ctx->fillRect(KDRect(0, m_separatorBelow ? height - k_margin : Metric::CellSeparatorThickness, bounds().width(), k_margin), Palette::WallScreen);
}
int CellWithSeparator::numberOfSubviews() const {
return 1;
}
View * CellWithSeparator::subviewAtIndex(int index) {
assert(index == 0);
return cell();
}
void CellWithSeparator::layoutSubviews(bool force) {
KDRect frame = KDRect(0, m_separatorBelow ? 0 : k_margin, bounds().width(), bounds().height()-k_margin);
cell()->setFrame(frame, force);
}
}