mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
#include "controller.h"
|
|
|
|
namespace ExpressionEditor {
|
|
|
|
Controller::Controller(Responder * parentResponder, Poincare::ExpressionLayout * expressionLayout) :
|
|
ViewController(parentResponder),
|
|
m_view(parentResponder, expressionLayout, &m_cursor)
|
|
{
|
|
m_cursor.setPointedExpressionLayout(expressionLayout);
|
|
}
|
|
|
|
void Controller::didBecomeFirstResponder() {
|
|
m_view.layoutSubviews();
|
|
/* TODO We need the layout to be done in order to scroll to the cursor. We
|
|
* thus made ExpressionViewWithCursor's layoutSubviews() public, which is the
|
|
* solution used in ModalViewController for instance. A cleaner solution would
|
|
* be to split viewWillAppear into loadViewIfNeeded() and viewWillAppear(), in
|
|
* order to change App::didBecomeActive to:
|
|
* m_modalViewController.loadViewIfNeeded();
|
|
* window->setContentView(view);
|
|
* m_modalViewController.viewWillAppear();
|
|
* The scrolling could then be done in viewWillAppear(), without calling
|
|
* layoutSubviews() manually. */
|
|
m_view.scrollableExpressionViewWithCursor()->scrollToCursor();
|
|
}
|
|
|
|
bool Controller::handleEvent(Ion::Events::Event event) {
|
|
return false;
|
|
}
|
|
|
|
}
|