text-input-vm.cpp 698 B

123456789101112131415161718192021222324252627282930
  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);
  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. text_input_set_result_callback(text_input, callback, callback_context, text, max_text_length);
  21. }
  22. void TextInputVM::set_header_text(const char* text) {
  23. text_input_set_header_text(text_input, text);
  24. }