[apps/settings] Create a parent class CellWithSeparator to

MessageTableCellWithEditableTextWithSeparator for future factorization
This commit is contained in:
Émilie Feral
2019-10-04 14:19:59 +02:00
committed by Léa Saviot
parent 3627dc0c0f
commit 953c9dfe64
6 changed files with 65 additions and 48 deletions

View File

@@ -0,0 +1,30 @@
#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);
}
}