Files
Upsilon/apps/shared/button_with_separator.cpp
Émilie Feral 9aa516fe5d [apps/shared] Improve validate button rendering in float parameter
controllers

Change-Id: I58ccc4da68c83509fe734038781b971d2a8f74c6
2017-03-16 15:12:11 +01:00

28 lines
1.4 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_margin), 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));
}