Files
Upsilon/apps/shared/button_with_separator.cpp
Émilie Feral 406fc0e0a5 [escher] Enable to draw the outline of cells in table view
Change-Id: I2842e9fdada4ebdc3fe49608e6f7886d831aa98b
2017-03-16 15:12:11 +01:00

28 lines
1.5 KiB
C++

#include "button_with_separator.h"
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, const char * textBody, Invocation invocation) :
Button(parentResponder, textBody, invocation, KDText::FontSize::Large, KDColorBlack)
{
}
void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::GreyBright);
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::WallScreen);
// Draw rectangle around cell
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::GreyBright);
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::GreyBright);
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::GreyBright);
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::GreyWhite);
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::GreyBright);
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::GreyMiddle);
}
void ButtonWithSeparator::layoutSubviews() {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
m_pointerTextView.setFrame(KDRect(k_lineThickness, k_margin + k_lineThickness, width-2*k_lineThickness, height - 4*k_lineThickness-k_margin));
}