[escher] Create a class Bordered instead of BorderedCell: this enable

non-cell view to use it as well
This commit is contained in:
Émilie Feral
2020-01-16 10:28:09 +01:00
committed by Léa Saviot
parent 398b529811
commit 3fa4e0838a
9 changed files with 48 additions and 40 deletions

15
escher/src/bordered.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include <escher/bordered.h>
void Bordered::drawBorderOfRect(KDContext * ctx, KDRect rect, KDColor borderColor) const {
KDCoordinate width = rect.width();
KDCoordinate height = rect.height();
// Draw rectangle around cell
ctx->fillRect(KDRect(0, 0, width, k_separatorThickness), borderColor);
ctx->fillRect(KDRect(0, k_separatorThickness, k_separatorThickness, height-k_separatorThickness), borderColor);
ctx->fillRect(KDRect(width-k_separatorThickness, k_separatorThickness, k_separatorThickness, height-k_separatorThickness), borderColor);
ctx->fillRect(KDRect(0, height-k_separatorThickness, width, k_separatorThickness), borderColor);
}
void Bordered::drawInnerRect(KDContext * ctx, KDRect rect, KDColor backgroundColor) const {
ctx->fillRect(KDRect(k_separatorThickness, k_separatorThickness, rect.width()-2*k_separatorThickness, rect.height()-k_separatorThickness), backgroundColor);
}