[escher] Add TODOs on EditableField, InputEventHandler, LayoutField,

TextInput, TextArea, TextInput
This commit is contained in:
Émilie Feral
2020-02-05 13:57:29 +01:00
committed by Léa Saviot
parent 9c25fdb66e
commit 9dbb1153a1
6 changed files with 18 additions and 1 deletions

View File

@@ -5,6 +5,11 @@
#include <escher/input_event_handler.h>
#include <ion/unicode/code_point.h>
/* TODO: improve classes hierarchy to share selection handling (and some other
* features) between EditableField and TextInput. Refactor the following classes:
* InputEventHandler, TextInput, TextArea, EditableField, LayoutField,
* TextField, and their delegates! */
class EditableField : public InputEventHandler {
public:
using InputEventHandler::InputEventHandler;

View File

@@ -3,6 +3,8 @@
#include <ion/events.h>
// See TODO in EditableField
class InputEventHandlerDelegate;
class InputEventHandler {

View File

@@ -11,6 +11,8 @@
#include <poincare/layout.h>
#include <poincare/layout_cursor.h>
// See TODO in EditableField
class LayoutField : public ScrollableView, public ScrollViewDataSource, public EditableField {
public:
LayoutField(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, LayoutFieldDelegate * delegate = nullptr) :
@@ -41,7 +43,8 @@ public:
/* Responder */
bool handleEventWithText(const char * text, bool indentation = false, bool forceCursorRightOfText = false) override;
bool handleEvent(Ion::Events::Event event) override;
bool shouldFinishEditing(Ion::Events::Event event) override; // TODO REMOVE ?
// TODO: factorize with TextField (see TODO of EditableField)
bool shouldFinishEditing(Ion::Events::Event event) override;
// Selection
bool resetSelection() { return m_contentView.resetSelection(); }

View File

@@ -7,6 +7,8 @@
#include <assert.h>
#include <string.h>
// See TODO in EditableField
class TextArea : public TextInput, public InputEventHandler {
public:
static constexpr int k_indentationSpaces = 2;

View File

@@ -6,6 +6,8 @@
#include <escher/text_field_delegate.h>
#include <string.h>
// See TODO in EditableField
/* TODO: TextField currently uses using 2 buffers:
* - one to keep the displayed text
* - another one to edit the text while keeping the previous text in the first
@@ -36,6 +38,7 @@ public:
return ContentView::k_maxBufferSize;
}
void scrollToCursor() override;
// TODO: factorize with TextField (see TODO of EditableField)
bool shouldFinishEditing(Ion::Events::Event event) override;
const KDFont * font() const { return m_contentView.font(); }
protected:

View File

@@ -6,6 +6,8 @@
#include <assert.h>
#include <string.h>
// See TODO in EditableField
class TextInput : public ScrollableView, public ScrollViewDataSource {
public:
TextInput(Responder * parentResponder, View * contentView) : ScrollableView(parentResponder, contentView, this) {}