Blame view

build3/escher/src/message_text_view.cpp 774 Bytes
6663b6c9   adorian   projet complet av...
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
  #include <escher/message_text_view.h>
  #include <assert.h>
  
  MessageTextView::MessageTextView(KDText::FontSize size, I18n::Message message, float horizontalAlignment, float verticalAlignment,
      KDColor textColor, KDColor backgroundColor) :
    TextView(size, horizontalAlignment, verticalAlignment, textColor, backgroundColor),
    m_message(message)
  {
  }
  
  const char * MessageTextView::text() const {
    return I18n::translate(m_message);
  }
  
  void MessageTextView::setText(const char * text) {
    assert(false);
  }
  
  void MessageTextView::setMessage(I18n::Message message) {
    if (message != m_message) {
      m_message = message;
      markRectAsDirty(bounds());
    }
  }
  
  KDSize MessageTextView::minimalSizeForOptimalDisplay() const  {
    return KDText::stringSize(text(), m_fontSize);
  }