message_table_cell_with_message.cpp
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <escher/message_table_cell_with_message.h>
#include <escher/palette.h>
#include <string.h>
MessageTableCellWithMessage::MessageTableCellWithMessage(I18n::Message message, Layout layout) :
MessageTableCell(message, KDText::FontSize::Small, layout),
m_accessoryView(KDText::FontSize::Small, (I18n::Message)0, 0.0f, 0.5f)
{
if (layout != Layout::Vertical) {
m_accessoryView.setAlignment(1.0f, 0.5f);
}
}
void MessageTableCellWithMessage::setAccessoryMessage(I18n::Message textBody) {
m_accessoryView.setMessage(textBody);
reloadCell();
}
View * MessageTableCellWithMessage::accessoryView() const {
if (strlen(m_accessoryView.text()) == 0) {
return nullptr;
}
return (View *)&m_accessoryView;
}
void MessageTableCellWithMessage::setHighlighted(bool highlight) {
MessageTableCell::setHighlighted(highlight);
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
m_accessoryView.setBackgroundColor(backgroundColor);
}
void MessageTableCellWithMessage::setTextColor(KDColor color) {
m_accessoryView.setTextColor(color);
MessageTableCell::setTextColor(color);
}
void MessageTableCellWithMessage::setAccessoryTextColor(KDColor color) {
m_accessoryView.setTextColor(color);
}