Numworks Epsilon  1.4.1
Graphing Calculator Operating System
button_with_separator.cpp
Go to the documentation of this file.
2 
3 ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
4  Button(parentResponder, message, invocation, KDText::FontSize::Large, KDColorBlack)
5 {
6 }
7 
9  KDCoordinate width = bounds().width();
10  KDCoordinate height = bounds().height();
11  ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::GreyBright);
12  ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::WallScreen);
13  // Draw rectangle around cell
14  ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::GreyBright);
15  ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::GreyBright);
16  ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::GreyBright);
17  ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::GreyWhite);
18  ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::GreyBright);
19  ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::GreyMiddle);
20 }
21 
22 
23 void ButtonWithSeparator::layoutSubviews() {
24  KDCoordinate width = bounds().width();
25  KDCoordinate height = bounds().height();
26  m_messageTextView.setFrame(KDRect(k_lineThickness, k_margin + k_lineThickness, width-2*k_lineThickness, height - 4*k_lineThickness-k_margin));
27 }
void setFrame(KDRect frame)
Definition: view.cpp:125
int16_t KDCoordinate
Definition: coordinate.h:6
Definition: text.h:8
ButtonWithSeparator(Responder *parentResponder, I18n::Message textBody, Invocation invocation)
MessageTextView m_messageTextView
Definition: button.h:20
constexpr KDColor KDColorBlack
Definition: color.h:41
static constexpr KDColor GreyMiddle
Definition: palette.h:14
void drawRect(KDContext *ctx, KDRect rect) const override
static constexpr KDColor WallScreen
Definition: palette.h:19
Definition: rect.h:26
void fillRect(KDRect rect, KDColor color)
Definition: context_rect.cpp:8
KDCoordinate width() const
Definition: rect.h:39
Definition: button.h:10
static constexpr KDColor GreyBright
Definition: palette.h:13
KDCoordinate height() const
Definition: rect.h:40
KDRect bounds() const
Definition: view.cpp:157
static constexpr KDColor GreyWhite
Definition: palette.h:12