text_input_vm.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "generic_view_module.h"
  3. #include <gui/modules/text_input.h>
  4. class TextInputVM : public GenericViewModule {
  5. public:
  6. TextInputVM();
  7. ~TextInputVM() final;
  8. View* get_view() final;
  9. void clean() final;
  10. /**
  11. * @brief Set text input result callback
  12. *
  13. * @param callback - callback fn
  14. * @param callback_context - callback context
  15. * @param text - text buffer to use
  16. * @param max_text_length - text buffer length
  17. * @param clear_default_text - clears given buffer on OK event
  18. */
  19. void set_result_callback(
  20. TextInputCallback callback,
  21. void* callback_context,
  22. char* text,
  23. uint8_t max_text_length,
  24. bool clear_default_text);
  25. /**
  26. * @brief Set text input header text
  27. *
  28. * @param text - text to be shown
  29. */
  30. void set_header_text(const char* text);
  31. void set_validator(TextInputValidatorCallback callback, void* callback_context);
  32. void* get_validator_callback_context();
  33. private:
  34. TextInput* text_input;
  35. };