5 #ifndef __rag__TextInput__
6 #define __rag__TextInput__
9 #include <rag/TextEvent.h>
10 #include <rag/DisplayObject.h>
12 #include <rag/TextField.h>
17 static const std::string TEXTINPUT_START_EDITION =
"TextInputStartEdition";
20 static const std::string TEXTINPUT_FINISH_EDITION =
"TextInputFinishEdition";
23 static const std::string TEXTINPUT_ENTER_TEXT =
"TextInputEnterText";
50 TextInput(std::string defaultText =
"",
int maxLines = 0,
int maxCharacters = 0,
bool useCaptureLayer =
true, Keyboard::KeyboardType keyboardType = Keyboard::KeyboardTypeDefault);
55 std::string getText();
58 void setText(
const std::string& text);
69 CaptureLayer(
int width = 0,
int height = 0)
73 if (width == 0 || height == 0)
77 this->width = (float)width;
78 this->height = (float)height;
82 addEventListener(events::TOUCH_BEGIN,
this);
83 addEventListener(events::TOUCH_END,
this);
84 addEventListener(events::TOUCH_MOVE,
this);
85 addEventListener(events::TOUCH_OUT,
this);
86 addEventListener(events::TOUCH_OVER,
this);
87 addEventListener(events::TOUCH_TAP,
this);
91 virtual void onEvent(
const std::string & type,
events::Event & event)
override {}
95 virtual void onEvent(
const std::string& type,
events::Event& event);
96 virtual void logicUpdate();
101 std::string getString();
103 void updateTextField();
109 std::vector<std::string> text;
111 CaptureLayer* captureLayer;
115 std::string defaultText;
123 bool useCaptureLayer;
129 Keyboard::KeyboardType keyboardType;
131 bool openKeyboardRequested;
Provides time-related functionality.
Definition: Timer.h:10
Base class for event system.
Definition: Event.h:24
bool checkHitPoint
When captureInput, checkHitPoint makes capture input only when hitTest is true. Defaults to false...
Definition: DisplayObject.h:199
bool captureInput
When true, input events are captured and propagation stops.
Definition: DisplayObject.h:198
Interface that allows to listen events.
Definition: EventListener.h:10
Helper object to add input to a TextField.
Definition: TextInput.h:46
Multiplatform keyboard abstraction.
Definition: Keyboard.h:14
Core object used to display things in screen.
Definition: DisplayObject.h:23
High level abstraction to render texts in display list.
Definition: TextField.h:22
Represents RGBA color.
Definition: Color.h:11