[escher] Add a PointerTextView class

This commit is contained in:
Romain Goyet
2018-01-30 13:39:38 +01:00
committed by EmilieNumworks
parent 0682d21a32
commit 314fde955a
4 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <escher/pointer_text_view.h>
#include <assert.h>
PointerTextView::PointerTextView(KDText::FontSize size, const char * text, float horizontalAlignment, float verticalAlignment,
KDColor textColor, KDColor backgroundColor) :
TextView(size, horizontalAlignment, verticalAlignment, textColor, backgroundColor),
m_text(text)
{
}
void PointerTextView::setText(const char * text) {
if (text != m_text) {
m_text = text;
markRectAsDirty(bounds());
}
}
KDSize PointerTextView::minimalSizeForOptimalDisplay() const {
return KDText::stringSize(text(), m_fontSize);
}