[apps/variable_box_empty_controller] Draw the background

This was not necessary when it was only used for the expressions
variable box, because the background was already of the right color
thanks to the previous displayed menu. We need to draw it for the python
variable box.
This commit is contained in:
Léa Saviot
2020-04-27 15:59:58 +02:00
committed by Émilie Feral
parent 3fe6af281f
commit 2eed894599
2 changed files with 5 additions and 1 deletions

View File

@@ -3,13 +3,15 @@
#include <apps/i18n.h>
#include <assert.h>
const KDColor VariableBoxEmptyController::VariableBoxEmptyView::k_backgroundColor;
// VariableBoxEmptyController::VariableBoxEmptyView
void VariableBoxEmptyController::VariableBoxEmptyView::initMessageViews() {
const int numberOfMessageViews = numberOfMessageTextViews();
for (int i = 0; i < numberOfMessageViews; i++) {
MessageTextView * message = messageTextViewAtIndex(i);
message->setFont(k_font);
message->setBackgroundColor(Palette::WallScreen);
message->setBackgroundColor(k_backgroundColor);
float verticalAlignment = 0.5f;
if (i == 0) {
verticalAlignment = 1.0f;
@@ -28,6 +30,7 @@ void VariableBoxEmptyController::VariableBoxEmptyView::setMessages(I18n::Message
}
void VariableBoxEmptyController::VariableBoxEmptyView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), k_backgroundColor);
drawBorderOfRect(ctx, bounds(), Palette::GreyBright);
}

View File

@@ -22,6 +22,7 @@ protected:
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
constexpr static int k_expressionViewRowIndex = 2;
constexpr static KDColor k_backgroundColor = Palette::WallScreen;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;