2 #include "../constant.h" 9 KeyboardView::KeyboardView() :
15 return m_testedKeyIndex;
27 drawKey(i, ctx, rect);
31 void KeyboardView::drawKey(
int keyIndex,
KDContext * ctx,
KDRect rect)
const {
33 if (keyIndex == m_testedKeyIndex) {
40 x = (
uint8_t)key == 3 ? x + 2*k_smallSquareSize : x;
42 y = (
uint8_t)key == 2 ? y + 2*k_smallSquareSize : y;
43 ctx->
fillRect(
KDRect(x, y, k_smallSquareSize, k_smallSquareSize), color);
47 KDCoordinate x = (
uint8_t)key == 4 ? 5*k_margin + 3*k_smallSquareSize + 2*k_bigRectWidth : 6*k_margin + 3*k_smallSquareSize + 2*k_bigRectWidth + k_bigSquareSize;
49 ctx->
fillRect(
KDRect(x, y, k_bigSquareSize, k_bigSquareSize), color);
55 ctx->
fillRect(
KDRect(x, y, k_bigRectWidth, k_bigRectHeight), color);
60 int i = ((
uint8_t)key - 12) - 6*j;
62 KDCoordinate y = 2*k_bigRectHeight + (j+3)*k_margin + j*k_smallRectHeight;
63 ctx->
fillRect(
KDRect(x, y, k_smallRectWidth, k_smallRectHeight), color);
68 int i = ((
uint8_t)key - 30) - 6*j;
70 KDCoordinate y = 2*k_bigRectHeight + 3*k_smallRectHeight + (j+6)*k_margin + j*k_bigRectHeight;
71 ctx->
fillRect(
KDRect(x, y, k_bigRectWidth, k_bigRectHeight), color);
constexpr KDColor KDColorBlue
int testedKeyIndex() const
void markRectAsDirty(KDRect rect)
constexpr int NumberOfValidKeys
constexpr KDColor KDColorWhite
constexpr KDColor KDColorBlack
void fillRect(KDRect rect, KDColor color)
void drawRect(KDContext *ctx, KDRect rect) const override
constexpr KDColor KDColorGreen
constexpr Key ValidKeys[]
void setTestedKeyIndex(int i)