mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
AbstractScrollableExactApproximateExpressionsView children classes reload scroll after reloading the subview selection when entering the responder chain and when cell becomes first responder. We don't reload scroll when setting content of cells as this is done every time we relayout - when scrolling in the table for instance.
55 lines
1.7 KiB
C++
55 lines
1.7 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);
|
|
}
|
|
|
|
void ScrollableExactApproximateExpressionsCell::setHighlighted(bool highlight) {
|
|
m_view.evenOddCell()->setHighlighted(highlight);
|
|
}
|
|
|
|
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() {
|
|
reinitSelection();
|
|
Container::activeApp()->setFirstResponder(&m_view);
|
|
}
|
|
|
|
void ScrollableExactApproximateExpressionsCell::reinitSelection() {
|
|
ScrollableExactApproximateExpressionsView::SubviewPosition selectedSubview = m_view.displayCenter() ? ScrollableExactApproximateExpressionsView::SubviewPosition::Center : ScrollableExactApproximateExpressionsView::SubviewPosition::Right;
|
|
m_view.setSelectedSubviewPosition(selectedSubview);
|
|
reloadScroll();
|
|
}
|
|
|
|
int ScrollableExactApproximateExpressionsCell::numberOfSubviews() const {
|
|
return 1;
|
|
}
|
|
|
|
View * ScrollableExactApproximateExpressionsCell::subviewAtIndex(int index) {
|
|
return &m_view;
|
|
}
|
|
|
|
void ScrollableExactApproximateExpressionsCell::layoutSubviews(bool force) {
|
|
m_view.setFrame(bounds(), force);
|
|
}
|
|
|
|
}
|