2021-10-03 13:36:05 +03:00
|
|
|
/**
|
|
|
|
* @file text_box.h
|
|
|
|
* GUI: TextBox view module API
|
|
|
|
*/
|
|
|
|
|
2021-07-08 23:41:34 +03:00
|
|
|
#pragma once
|
2021-10-03 13:36:05 +03:00
|
|
|
|
2021-07-08 23:41:34 +03:00
|
|
|
#include <gui/view.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** TextBox anonymous structure */
|
2021-07-08 23:41:34 +03:00
|
|
|
typedef struct TextBox TextBox;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
TextBoxFontText,
|
|
|
|
TextBoxFontHex,
|
|
|
|
} TextBoxFont;
|
|
|
|
|
2022-02-02 22:59:28 +03:00
|
|
|
typedef enum {
|
|
|
|
TextBoxFocusStart,
|
|
|
|
TextBoxFocusEnd,
|
|
|
|
} TextBoxFocus;
|
|
|
|
|
2021-07-08 23:41:34 +03:00
|
|
|
/** Allocate and initialize text_box
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @return TextBox instance
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
|
|
|
TextBox* text_box_alloc();
|
|
|
|
|
|
|
|
/** Deinitialize and free text_box
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box text_box instance
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
|
|
|
void text_box_free(TextBox* text_box);
|
|
|
|
|
|
|
|
/** Get text_box view
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
*
|
|
|
|
* @return View instance that can be used for embedding
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
|
|
|
View* text_box_get_view(TextBox* text_box);
|
|
|
|
|
|
|
|
/** Clean text_box
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
2022-01-21 20:32:03 +03:00
|
|
|
void text_box_reset(TextBox* text_box);
|
2021-07-08 23:41:34 +03:00
|
|
|
|
|
|
|
/** Set text for text_box
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param text text to set
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
|
|
|
void text_box_set_text(TextBox* text_box, const char* text);
|
|
|
|
|
|
|
|
/** Set TextBox font
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
|
|
|
* @param font TextBoxFont instance
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
|
|
|
void text_box_set_font(TextBox* text_box, TextBoxFont font);
|
|
|
|
|
2022-02-02 22:59:28 +03:00
|
|
|
/** Set TextBox focus
|
|
|
|
* @note Use to display from start or from end
|
2021-10-03 13:36:05 +03:00
|
|
|
*
|
|
|
|
* @param text_box TextBox instance
|
2022-02-02 22:59:28 +03:00
|
|
|
* @param focus TextBoxFocus instance
|
2021-07-08 23:41:34 +03:00
|
|
|
*/
|
2022-02-02 22:59:28 +03:00
|
|
|
void text_box_set_focus(TextBox* text_box, TextBoxFocus focus);
|
2021-07-08 23:41:34 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|