text-input-vm.cpp 754 B

12345678910111213141516171819202122232425262728293031
  1. #include "text-input-vm.h"
  2. TextInputVM::TextInputVM() {
  3. text_input = text_input_alloc();
  4. }
  5. TextInputVM::~TextInputVM() {
  6. text_input_free(text_input);
  7. }
  8. View* TextInputVM::get_view() {
  9. return text_input_get_view(text_input);
  10. }
  11. void TextInputVM::clean() {
  12. set_result_callback(NULL, NULL, NULL, 0, false);
  13. set_header_text("");
  14. }
  15. void TextInputVM::set_result_callback(
  16. TextInputCallback callback,
  17. void* callback_context,
  18. char* text,
  19. uint8_t max_text_length,
  20. bool clear_default_text) {
  21. text_input_set_result_callback(text_input, callback, callback_context, text, max_text_length, clear_default_text);
  22. }
  23. void TextInputVM::set_header_text(const char* text) {
  24. text_input_set_header_text(text_input, text);
  25. }