Files
Upsilon/escher/src/even_odd_expression_cell.cpp
Émilie Feral 8f1d37c28c [escher] Add a cursor to text fields
Change-Id: Ib4a80a3c6d4b5d76cb56645275e8ecc6d69528ca
2017-03-08 15:42:14 +01:00

50 lines
1.4 KiB
C++

#include <escher/even_odd_expression_cell.h>
#include <assert.h>
using namespace Poincare;
EvenOddExpressionCell::EvenOddExpressionCell(float horizontalAlignment, float verticalAlignment,
KDColor textColor, KDColor backgroundColor) :
EvenOddCell(),
m_expressionView(ExpressionView(horizontalAlignment, verticalAlignment, textColor, backgroundColor))
{
}
void EvenOddExpressionCell::setHighlighted(bool highlight) {
EvenOddCell::setHighlighted(highlight);
m_expressionView.setBackgroundColor(backgroundColor());
}
void EvenOddExpressionCell::setEven(bool even) {
EvenOddCell::setEven(even);
m_expressionView.setBackgroundColor(backgroundColor());
}
void EvenOddExpressionCell::setExpression(ExpressionLayout * expressionLayout) {
m_expressionView.setExpression(expressionLayout);
}
void EvenOddExpressionCell::setBackgroundColor(KDColor backgroundColor) {
m_expressionView.setBackgroundColor(backgroundColor);
}
void EvenOddExpressionCell::setTextColor(KDColor textColor) {
m_expressionView.setTextColor(textColor);
}
KDSize EvenOddExpressionCell::minimalSizeForOptimalDisplay() const {
return m_expressionView.minimalSizeForOptimalDisplay();
}
int EvenOddExpressionCell::numberOfSubviews() const {
return 1;
}
View * EvenOddExpressionCell::subviewAtIndex(int index) {
assert(index == 0);
return &m_expressionView;
}
void EvenOddExpressionCell::layoutSubviews() {
m_expressionView.setFrame(bounds());
}