[apps/code/varbox] Subtitles and basic items are displayed properly

This commit is contained in:
Léa Saviot
2020-04-03 17:52:15 +02:00
committed by Émilie Feral
parent 34a1a8e35f
commit 96d68d6b44
9 changed files with 39 additions and 18 deletions

View File

@@ -13,8 +13,12 @@ public:
void setMessage(I18n::Message message);
virtual void setTextColor(KDColor color);
void setMessageFont(const KDFont * font);
void setBackgroundColor(KDColor color);
protected:
KDColor backgroundColor() const override { return m_backgroundColor; }
private:
MessageTextView m_messageTextView;
KDColor m_backgroundColor;
};
#endif

View File

@@ -23,6 +23,7 @@ public:
virtual View * subAccessoryView() const;
void drawRect(KDContext * ctx, KDRect rect) const override;
protected:
virtual KDColor backgroundColor() const { return KDColorWhite; }
virtual KDCoordinate labelMargin() const { return Metric::TableCellHorizontalMargin; }
virtual KDCoordinate accessoryMargin() const { return Metric::TableCellHorizontalMargin; }
int numberOfSubviews() const override;

View File

@@ -4,7 +4,8 @@
MessageTableCell::MessageTableCell(I18n::Message label, const KDFont * font, Layout layout) :
TableCell(layout),
m_messageTextView(font, label, 0, 0.5, KDColorBlack, KDColorWhite)
m_messageTextView(font, label, 0, 0.5, KDColorBlack, KDColorWhite),
m_backgroundColor(KDColorWhite)
{
}
@@ -14,7 +15,7 @@ View * MessageTableCell::labelView() const {
void MessageTableCell::setHighlighted(bool highlight) {
HighlightCell::setHighlighted(highlight);
KDColor backgroundColor = highlight? Palette::Select : KDColorWhite;
KDColor backgroundColor = highlight? Palette::Select : m_backgroundColor;
m_messageTextView.setBackgroundColor(backgroundColor);
}
@@ -31,3 +32,8 @@ void MessageTableCell::setMessageFont(const KDFont * font) {
m_messageTextView.setFont(font);
layoutSubviews();
}
void MessageTableCell::setBackgroundColor(KDColor color) {
m_backgroundColor = color;
m_messageTextView.setBackgroundColor(color);
}

View File

@@ -164,7 +164,7 @@ void TableCell::layoutSubviews(bool force) {
}
void TableCell::drawRect(KDContext * ctx, KDRect rect) const {
KDColor backgroundColor = isHighlighted() ? Palette::Select : KDColorWhite;
drawInnerRect(ctx, bounds(), backgroundColor);
KDColor backColor = isHighlighted() ? Palette::Select : backgroundColor();
drawInnerRect(ctx, bounds(), backColor);
drawBorderOfRect(ctx, bounds(), Palette::GreyBright);
}