2021-06-15 11:01:56 +00:00
|
|
|
#pragma once
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "generic_view_module.h"
|
2021-06-15 11:01:56 +00:00
|
|
|
#include <gui/modules/text_input.h>
|
|
|
|
|
|
|
|
class TextInputVM : public GenericViewModule {
|
|
|
|
public:
|
|
|
|
TextInputVM();
|
|
|
|
~TextInputVM() final;
|
|
|
|
View* get_view() final;
|
|
|
|
void clean() final;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set text input result callback
|
|
|
|
*
|
|
|
|
* @param callback - callback fn
|
|
|
|
* @param callback_context - callback context
|
|
|
|
* @param text - text buffer to use
|
|
|
|
* @param max_text_length - text buffer length
|
2021-07-25 11:34:54 +00:00
|
|
|
* @param clear_default_text - clears given buffer on OK event
|
2021-06-15 11:01:56 +00:00
|
|
|
*/
|
|
|
|
void set_result_callback(
|
|
|
|
TextInputCallback callback,
|
|
|
|
void* callback_context,
|
|
|
|
char* text,
|
2021-07-25 11:34:54 +00:00
|
|
|
uint8_t max_text_length,
|
|
|
|
bool clear_default_text);
|
2021-06-15 11:01:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set text input header text
|
|
|
|
*
|
|
|
|
* @param text - text to be shown
|
|
|
|
*/
|
|
|
|
void set_header_text(const char* text);
|
|
|
|
|
2022-01-29 09:39:10 +00:00
|
|
|
void set_validator(TextInputValidatorCallback callback, void* callback_context);
|
|
|
|
|
|
|
|
void* get_validator_callback_context();
|
|
|
|
|
2021-06-15 11:01:56 +00:00
|
|
|
private:
|
|
|
|
TextInput* text_input;
|
|
|
|
};
|