2021-10-03 10:36:05 +00:00
|
|
|
/**
|
|
|
|
* @file text_box.h
|
|
|
|
* GUI: TextBox view module API
|
|
|
|
*/
|
|
|
|
|
2021-07-08 20:41:34 +00:00
|
|
|
#pragma once
|
2021-10-03 10:36:05 +00:00
|
|
|
|
2021-07-08 20:41:34 +00:00
|
|
|
#include <gui/view.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** TextBox anonymous structure */
|
2021-07-08 20:41:34 +00:00
|
|
|
typedef struct TextBox TextBox;
|
|
|
|
typedef void (*TextBoxExitCallback)(void* context);
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
TextBoxFontText,
|
|
|
|
TextBoxFontHex,
|
|
|
|
} TextBoxFont;
|
|
|
|
|
|
|
|
/** Allocate and initialize text_box
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @return TextBox instance
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
TextBox* text_box_alloc();
|
|
|
|
|
|
|
|
/** Deinitialize and free text_box
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box text_box instance
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
void text_box_free(TextBox* text_box);
|
|
|
|
|
|
|
|
/** Get text_box view
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
*
|
|
|
|
* @return View instance that can be used for embedding
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
View* text_box_get_view(TextBox* text_box);
|
|
|
|
|
|
|
|
/** Clean text_box
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
2022-01-21 17:32:03 +00:00
|
|
|
void text_box_reset(TextBox* text_box);
|
2021-07-08 20:41:34 +00:00
|
|
|
|
|
|
|
/** Set text for text_box
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param text text to set
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
void text_box_set_text(TextBox* text_box, const char* text);
|
|
|
|
|
|
|
|
/** Set TextBox font
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param font TextBoxFont instance
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
void text_box_set_font(TextBox* text_box, TextBoxFont font);
|
|
|
|
|
|
|
|
/** Set text_box context
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param context context pointer
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
void text_box_set_context(TextBox* text_box, void* context);
|
|
|
|
|
|
|
|
/** Set exit callback
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param callback TextBoxExitCallback callback pointer
|
2021-07-08 20:41:34 +00:00
|
|
|
*/
|
|
|
|
void text_box_set_exit_callback(TextBox* text_box, TextBoxExitCallback callback);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|