77 #if defined(ANDROID) || defined(__SWITCH__)
91 #include "utils/timer.h"
94 #include "render/graphics.h"
113 const std::string &
restrict eventId,
114 const bool sendAlwaysEvents) :
130 mLoseFocusOnTab(loseFocusOnTab),
131 mAllowSpecialActions(true),
132 mSendAlwaysEvents(sendAlwaysEvents),
148 if (
theme !=
nullptr)
152 "textfield_background.xml",
160 if (
mSkin !=
nullptr)
167 if (!eventId.empty())
185 if (
theme !=
nullptr)
202 for (
int a = 0; a < 9; a++)
234 if (image !=
nullptr)
275 const char *
const text =
mText.c_str();
276 for (
const char *textPtr = text; *textPtr != 0; ++textPtr)
278 if (*textPtr < '0' || *textPtr >
'9')
291 const int value = atoi(
mText.c_str());
303 const int val =
event.getKey().getValue();
308 std::string str =
event.getText();
318 bool consumed(
false);
325 if ((val >=
'0' && val <=
'9') ||
347 else if (val < 0x800)
349 else if (val < 0x10000)
355 for (
int i = 0; i < len; ++ i)
357 buf[i] =
CAST_8(val >> (6 * (len - i - 1)));
359 buf[i] =
CAST_8((buf[i] & 63) | 128);
363 buf[0] |=
CAST_8(255U << (8 - len));
383 bool consumed(
false);
412 PRAGMA45(GCC diagnostic ignored
"-Wswitch-enum")
499 PRAGMA45(GCC diagnostic ignored
"-Wswitch-enum")
738 if (caretX -
mXScroll >= width - pad)
770 #if defined(ANDROID) || defined(__SWITCH__)
793 #if defined(ANDROID) || defined(__SWITCH__)
805 const unsigned int sz =
CAST_U32(text.size());
832 if ((widget ==
nullptr) && (
mWindow !=
nullptr))
void generate(TextChunk &chunk)
int getStringIndexAt(const std::string &text, const int x) const
int getWidth(const std::string &text) const
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
virtual void setColor(const Color &color)
virtual void drawLine(int x1, int y1, int x2, int y2)=0
ClipRect & getTopClip() const
virtual void drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
void removeDragged(const Widget *const widget)
MouseButtonT getButton() const
int getOption(const std::string &name) const
void safeDraw(Graphics *const graphics)
void drawFrame(Graphics *const graphics)
void mousePressed(MouseEvent &event)
void setNumeric(const bool numeric)
void handleCtrlKeys(const InputActionT action, bool &consumed)
const Color * mCaretColor
void keyPressed(KeyEvent &event)
void widgetHidden(const Event &event)
void drawCaret(Graphics *graphics, int x)
const std::string & getText() const
bool handleNormalKeys(const InputActionT action, bool &consumed)
LoseFocusOnTab mLoseFocusOnTab
TextField(const Widget2 *const widget, const std::string &text, const LoseFocusOnTab loseFocusOnTab, ActionListener *const listener, const std::string &eventId, const bool sendAlwaysEvents)
void draw(Graphics *const graphics)
void safeDrawFrame(Graphics *const graphics)
void setText(const std::string &text)
unsigned int mCaretPosition
void setParent(Widget *widget)
void setWindow(Widget *const widget)
unsigned int getCaretPosition() const
bool mAllowSpecialActions
void setCaretPosition(unsigned int position)
void moveCaretWordForward()
void focusGained(const Event &event)
void mouseDragged(MouseEvent &event)
void caretDeleteToStart()
void focusLost(const Event &event)
void unload(Skin *const skin)
static void unloadRect(const ImageRect &rect, const int start, const int end)
float getMinimumOpacity() const
Skin * loadSkinRect(ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end)
bool sendBuffer(const std::string &text)
bool retrieveBuffer(std::string &text, size_t &pos)
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wredundant-decls") PRAGMA45(GCC diagnostic pop) class TestMain
const bool LoseFocusOnTab_true
#define BLOCK_START(name)
void deleteCharLeft(std::string &str, unsigned *const pos)
bool isWordSeparator(const signed char chr) A_CONST