2 #include "../apps_container.h" 13 m_textField(parentResponder, m_textBody,
TextField::maxBufferSize(), textFieldDelegate)
18 int EditExpressionController::ContentView::numberOfSubviews()
const {
22 View * EditExpressionController::ContentView::subviewAtIndex(
int index) {
23 View * views[2] = {m_mainView, &m_textField};
27 void EditExpressionController::ContentView::layoutSubviews() {
28 KDRect mainViewFrame(0, 0, bounds().width(), bounds().height() - k_textFieldHeight-k_separatorThickness);
29 m_mainView->setFrame(mainViewFrame);
30 KDRect inputViewFrame(k_textMargin, bounds().height() - k_textFieldHeight, bounds().width()-k_textMargin, k_textFieldHeight);
31 m_textField.setFrame(inputViewFrame);
34 void EditExpressionController::ContentView::drawRect(
KDContext * ctx,
KDRect rect)
const {
38 ctx->
fillRect(
KDRect(0, bounds().height() -k_textFieldHeight, k_textMargin, k_textFieldHeight), m_textField.backgroundColor());
41 TextField * EditExpressionController::ContentView::textField() {
45 TableView * EditExpressionController::ContentView::mainView() {
51 m_historyController(historyController),
52 m_calculationStore(calculationStore)
58 return ((ContentView *)
view())->textField()->text();
71 ((ContentView *)
view())->textField()->setEditing(
false,
false);
82 ((ContentView *)
view())->textField()->setEditing(
true,
false);
95 m_historyController->
reload();
96 ((ContentView *)
view())->mainView()->scrollToCell(0, m_historyController->
numberOfRows()-1);
106 m_historyController->
reload();
107 ((ContentView *)
view())->mainView()->scrollToCell(0, m_historyController->
numberOfRows()-1);
115 ((ContentView *)
view())->textField()->
setText(text);
123 View * EditExpressionController::loadView() {
124 return new ContentView(
this, (
TableView *)m_historyController->
view(),
this);
127 void EditExpressionController::unloadView(
View * view) {
void didBecomeFirstResponder() override
Calculation * push(const char *text, Poincare::Context *context)
bool textFieldDidFinishEditing(::TextField *textField, const char *text, Ion::Events::Event event) override
static constexpr int maxBufferSize()
void setText(const char *text)
size_t strlcpy(char *dst, const char *src, size_t len)
void scrollToCell(int i, int j)
bool textFieldShouldFinishEditing(Ion::Events::Event event)
virtual void setEditing(bool isEditing, bool reinitDraftBuffer=true)
virtual Poincare::Context * localContext()
bool handleEvent(Ion::Events::Event event) override
int numberOfRows() override
int numberOfCalculations()
static constexpr KDColor GreyMiddle
void insertTextBody(const char *text)
virtual bool textFieldDidReceiveEvent(TextField *textField, Ion::Events::Event event) override
void fillRect(KDRect rect, KDColor color)
bool handleEventWithText(const char *text, bool indenting=false) override
size_t draftTextLength() const
void viewDidDisappear() override
void setFirstResponder(Responder *responder)
bool textFieldDidAbortEditing(::TextField *textField, const char *text) override
bool textFieldDidReceiveEvent(::TextField *textField, Ion::Events::Event event) override
bool textInputIsCorrect(const char *text)
EditExpressionController(Responder *parentResponder, HistoryController *historyController, CalculationStore *calculationStore)
void viewDidDisappear() override