[apps/shared] Separable class

This commit is contained in:
Léa Saviot
2019-09-09 18:28:16 +02:00
parent e67160b878
commit a50c1aafbf
9 changed files with 81 additions and 56 deletions

View File

@@ -1,27 +1,22 @@
#include "store_cell.h"
#include <escher/metric.h>
namespace Shared {
void StoreCell::setSeparatorLeft(bool separator) {
if (m_separatorLeft != separator) {
m_separatorLeft = separator;
reloadCell();
}
}
void StoreCell::drawRect(KDContext * ctx, KDRect rect) const {
HideableEvenOddEditableTextCell::drawRect(ctx, rect);
// Draw the separator
KDRect separatorRect(0, 0, Metric::TableSeparatorThickness, bounds().height());
if (m_separatorLeft) {
ctx->fillRect(separatorRect, HideableEvenOddEditableTextCell::hideColor());
ctx->fillRect(separatorRect(bounds()), HideableEvenOddEditableTextCell::hideColor());
}
}
void StoreCell::layoutSubviews() {
KDRect boundsThis = bounds();
editableTextCell()->setFrame(KDRect(boundsThis.left() + Metric::TableSeparatorThickness, boundsThis.top(), boundsThis.width() - Metric::TableSeparatorThickness - k_rightMargin, boundsThis.height()));
editableTextCell()->setFrame(rectWithoutSeparator(KDRect(boundsThis.left(), boundsThis.top(), boundsThis.width() - k_rightMargin, boundsThis.height())));
}
void StoreCell::didSetSeparator() {
reloadCell();
}
}