mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher] Add TODOs on EditableField, InputEventHandler, LayoutField,
TextInput, TextArea, TextInput
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <ion/events.h>
|
||||
|
||||
// See TODO in EditableField
|
||||
|
||||
class InputEventHandlerDelegate;
|
||||
|
||||
class InputEventHandler {
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user