#include #include #include #include template MessageTableCell::MessageTableCell(I18n::Message label, const KDFont * font, Layout layout) : TableCell(layout), m_messageTextView(font, label, 0, 0.5, Palette::PrimaryText, Palette::ListCellBackground), m_backgroundColor(KDColorWhite) { } template View * MessageTableCell::labelView() const { return (View *)&m_messageTextView; } template<> void MessageTableCell::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; m_messageTextView.setBackgroundColor(backgroundColor); static AnimationTimer s_animationTimer = AnimationTimer(); if (highlight) { m_messageTextView.willStartAnimation(); s_animationTimer.setAnimated(&m_messageTextView); } else { s_animationTimer.removeAnimated(&m_messageTextView); m_messageTextView.didStopAnimation(); } } template<> void MessageTableCell::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; m_messageTextView.setBackgroundColor(backgroundColor); } template void MessageTableCell::setMessage(I18n::Message text) { m_messageTextView.setMessage(text); layoutSubviews(); } template void MessageTableCell::setTextColor(KDColor color) { m_messageTextView.setTextColor(color); } template void MessageTableCell::setMessageFont(const KDFont * font) { m_messageTextView.setFont(font); layoutSubviews(); } template void MessageTableCell::setBackgroundColor(KDColor color) { m_backgroundColor = color; m_messageTextView.setBackgroundColor(color); } template class MessageTableCell; template class MessageTableCell;