2021-06-15 14:01:56 +03:00
|
|
|
#pragma once
|
2022-01-05 19:10:18 +03:00
|
|
|
#include "generic_view_module.h"
|
2021-06-15 14:01:56 +03: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 14:34:54 +03:00
|
|
|
* @param clear_default_text - clears given buffer on OK event
|
2021-06-15 14:01:56 +03:00
|
|
|
*/
|
|
|
|
void set_result_callback(
|
|
|
|
TextInputCallback callback,
|
|
|
|
void* callback_context,
|
|
|
|
char* text,
|
2021-07-25 14:34:54 +03:00
|
|
|
uint8_t max_text_length,
|
|
|
|
bool clear_default_text);
|
2021-06-15 14:01:56 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set text input header text
|
|
|
|
*
|
|
|
|
* @param text - text to be shown
|
|
|
|
*/
|
|
|
|
void set_header_text(const char* text);
|
|
|
|
|
2022-01-29 12:39:10 +03:00
|
|
|
void set_validator(TextInputValidatorCallback callback, void* callback_context);
|
|
|
|
|
|
|
|
void* get_validator_callback_context();
|
|
|
|
|
2021-06-15 14:01:56 +03:00
|
|
|
private:
|
|
|
|
TextInput* text_input;
|
|
|
|
};
|