[escher] Create a clipped board

Change-Id: I994175d902bce2c326149e1b08ebb7c1a60581a2
This commit is contained in:
Émilie Feral
2017-04-25 11:58:24 +02:00
parent cde8969b3e
commit 4d08504bf2
4 changed files with 42 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ objs += $(addprefix escher/src/,\
button.o\
button_row_controller.o\
chevron_view.o\
clipped_board.o\
container.o\
dynamic_view_controller.o\
editable_text_cell.o\

View File

@@ -8,6 +8,7 @@
#include <escher/button.h>
#include <escher/button_row_controller.h>
#include <escher/chevron_view.h>
#include <escher/clipped_board.h>
#include <escher/container.h>
#include <escher/dynamic_view_controller.h>
#include <escher/editable_text_cell.h>

View File

@@ -0,0 +1,17 @@
#ifndef ESCHER_CLIPPED_BOARD_H
#define ESCHER_CLIPPED_BOARD_H
#include <escher/text_field.h>
class ClippedBoard {
public:
ClippedBoard();
static ClippedBoard * sharedClippedBoard();
void store(const char * storedText);
const char * storedText();
void reset();
private:
char m_textBuffer[TextField::maxBufferSize()];
};
#endif

View File

@@ -0,0 +1,23 @@
#include <escher/clipped_board.h>
static ClippedBoard s_clippedBoard;
ClippedBoard::ClippedBoard()
{
}
ClippedBoard * ClippedBoard::sharedClippedBoard() {
return &s_clippedBoard;
}
void ClippedBoard::store(const char * storedText) {
strlcpy(m_textBuffer, storedText, TextField::maxBufferSize());
}
const char * ClippedBoard::storedText() {
return m_textBuffer;
}
void ClippedBoard::reset() {
strlcpy(m_textBuffer, "", 1);
}