Files
Upsilon/apps/shared/scrollable_exact_approximate_expressions_cell.cpp
Émilie Feral 56319ef275 [apps/shared] AbstractScrollableExactApproximateExpressionsView can hold up to
three expressions but no more BurgerMenuView.
ScrollableExactApproximateExpressionsView and
ScrollableInputExactApproximateExpressionsView inherit from it.
2020-02-12 15:13:22 +01:00

51 lines
1.5 KiB
C++

#include "scrollable_exact_approximate_expressions_cell.h"
#include <assert.h>
using namespace Poincare;
namespace Shared {
ScrollableExactApproximateExpressionsCell::ScrollableExactApproximateExpressionsCell(Responder * parentResponder) :
Responder(parentResponder),
m_view(this)
{
}
void ScrollableExactApproximateExpressionsCell::setLayouts(Poincare::Layout exactLayout, Poincare::Layout approximateLayout) {
m_view.setLayouts(Layout(), exactLayout, approximateLayout);
m_view.setSelectedSubviewPosition(ScrollableExactApproximateExpressionsView::SubviewPosition::Center);
}
void ScrollableExactApproximateExpressionsCell::setHighlighted(bool highlight) {
m_view.evenOddCell()->setHighlighted(highlight);
reloadScroll();
}
void ScrollableExactApproximateExpressionsCell::setEven(bool even) {
EvenOddCell::setEven(even);
m_view.setBackgroundColor(backgroundColor());
m_view.evenOddCell()->setEven(even);
}
void ScrollableExactApproximateExpressionsCell::reloadScroll() {
m_view.reloadScroll();
}
void ScrollableExactApproximateExpressionsCell::didBecomeFirstResponder() {
m_view.setSelectedSubviewPosition(ScrollableExactApproximateExpressionsView::SubviewPosition::Center);
Container::activeApp()->setFirstResponder(&m_view);
}
int ScrollableExactApproximateExpressionsCell::numberOfSubviews() const {
return 1;
}
View * ScrollableExactApproximateExpressionsCell::subviewAtIndex(int index) {
return &m_view;
}
void ScrollableExactApproximateExpressionsCell::layoutSubviews(bool force) {
m_view.setFrame(bounds(), force);
}
}