| 10 | } |
| 11 | |
| 12 | std::string KeyboardManager::text(const std::string& suggestion, const std::string& hint, size_t maxLen) |
| 13 | { |
| 14 | SwkbdState swkbd; |
| 15 | const size_t kBufSize = 64; |
| 16 | size_t limit = std::min(maxLen, kBufSize); |
| 17 | if (limit < 2) { |
| 18 | limit = 2; |
| 19 | } |
| 20 | swkbdInit(&swkbd, SWKBD_TYPE_NORMAL, 2, limit - 1); |
| 21 | swkbdSetValidation(&swkbd, SWKBD_NOTBLANK_NOTEMPTY, 0, 0); |
| 22 | swkbdSetInitialText(&swkbd, suggestion.c_str()); |
| 23 | swkbdSetHintText(&swkbd, hint.c_str()); |
| 24 | char buf[kBufSize] = {0}; |
| 25 | SwkbdButton button = swkbdInputText(&swkbd, buf, sizeof(buf)); |
| 26 | buf[sizeof(buf) - 1] = '\0'; |
| 27 | return button == SWKBD_BUTTON_CONFIRM ? std::string(buf) : std::string(); |
| 28 | } |
| 29 | |
| 30 | int KeyboardManager::numericPad(void) |
| 31 | { |
no test coverage detected