mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[escher] Change name clipboard
Change-Id: Ie222b9c7c380346759eaec26626cf76068576a94
This commit is contained in:
@@ -7,7 +7,7 @@ objs += $(addprefix escher/src/,\
|
||||
button.o\
|
||||
button_row_controller.o\
|
||||
chevron_view.o\
|
||||
clipped_board.o\
|
||||
clipboard.o\
|
||||
container.o\
|
||||
dynamic_view_controller.o\
|
||||
editable_text_cell.o\
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <escher/button.h>
|
||||
#include <escher/button_row_controller.h>
|
||||
#include <escher/chevron_view.h>
|
||||
#include <escher/clipped_board.h>
|
||||
#include <escher/clipboard.h>
|
||||
#include <escher/container.h>
|
||||
#include <escher/dynamic_view_controller.h>
|
||||
#include <escher/editable_text_cell.h>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#ifndef ESCHER_CLIPPED_BOARD_H
|
||||
#define ESCHER_CLIPPED_BOARD_H
|
||||
#ifndef ESCHER_CLIPBOARD_H
|
||||
#define ESCHER_CLIPBOARD_H
|
||||
|
||||
#include <escher/text_field.h>
|
||||
|
||||
class ClippedBoard {
|
||||
class Clipboard {
|
||||
public:
|
||||
ClippedBoard();
|
||||
static ClippedBoard * sharedClippedBoard();
|
||||
static Clipboard * sharedClipboard();
|
||||
void store(const char * storedText);
|
||||
const char * storedText();
|
||||
void reset();
|
||||
19
escher/src/clipboard.cpp
Normal file
19
escher/src/clipboard.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <escher/clipboard.h>
|
||||
|
||||
static Clipboard s_clipboard;
|
||||
|
||||
Clipboard * Clipboard::sharedClipboard() {
|
||||
return &s_clipboard;
|
||||
}
|
||||
|
||||
void Clipboard::store(const char * storedText) {
|
||||
strlcpy(m_textBuffer, storedText, TextField::maxBufferSize());
|
||||
}
|
||||
|
||||
const char * Clipboard::storedText() {
|
||||
return m_textBuffer;
|
||||
}
|
||||
|
||||
void Clipboard::reset() {
|
||||
strlcpy(m_textBuffer, "", 1);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <escher/text_field.h>
|
||||
#include <escher/clipped_board.h>
|
||||
#include <escher/clipboard.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* TextField::ContentView */
|
||||
@@ -355,19 +355,19 @@ bool TextField::handleEvent(Ion::Events::Event event) {
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Copy && !isEditing()) {
|
||||
ClippedBoard::sharedClippedBoard()->store(text());
|
||||
Clipboard::sharedClipboard()->store(text());
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Cut && !isEditing()) {
|
||||
ClippedBoard::sharedClippedBoard()->store(text());
|
||||
Clipboard::sharedClipboard()->store(text());
|
||||
setEditing(true, true);
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Paste) {
|
||||
setEditing(true);
|
||||
int nextCursorLocation = textLength();
|
||||
if (insertTextAtLocation(ClippedBoard::sharedClippedBoard()->storedText(), cursorLocation())) {
|
||||
nextCursorLocation = cursorLocation() + strlen(ClippedBoard::sharedClippedBoard()->storedText());
|
||||
if (insertTextAtLocation(Clipboard::sharedClipboard()->storedText(), cursorLocation())) {
|
||||
nextCursorLocation = cursorLocation() + strlen(Clipboard::sharedClipboard()->storedText());
|
||||
}
|
||||
setCursorLocation(nextCursorLocation);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user