2016-09-30 15:29:00 +02:00
|
|
|
/**
|
|
|
|
* @file lv_ta.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
2016-09-30 15:29:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_TA_H
|
|
|
|
#define LV_TA_H
|
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-09-30 15:29:00 +02:00
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2018-07-07 12:21:36 +02:00
|
|
|
#ifdef LV_CONF_INCLUDE_SIMPLE
|
2018-07-07 11:53:22 +02:00
|
|
|
#include "lv_conf.h"
|
|
|
|
#else
|
2019-03-17 08:33:03 +01:00
|
|
|
#include "../../../lv_conf.h"
|
2018-07-07 11:53:22 +02:00
|
|
|
#endif
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TA != 0
|
2016-09-30 15:29:00 +02:00
|
|
|
|
2017-01-02 10:48:21 +01:00
|
|
|
/*Testing of dependencies*/
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_PAGE == 0
|
|
|
|
#error "lv_ta: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
|
2017-01-02 10:48:21 +01:00
|
|
|
#endif
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LABEL == 0
|
|
|
|
#error "lv_ta: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
|
2017-01-02 10:48:21 +01:00
|
|
|
#endif
|
|
|
|
|
2017-11-30 11:35:33 +01:00
|
|
|
#include "../lv_core/lv_obj.h"
|
2016-09-30 15:29:00 +02:00
|
|
|
#include "lv_page.h"
|
|
|
|
#include "lv_label.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
2017-11-05 14:12:50 +01:00
|
|
|
#define LV_TA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/
|
2016-09-30 15:29:00 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Style of text area's cursor. */
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_CURSOR_NONE, /**< No cursor */
|
|
|
|
LV_CURSOR_LINE, /**< Vertical line */
|
|
|
|
LV_CURSOR_BLOCK, /**< Rectangle */
|
|
|
|
LV_CURSOR_OUTLINE, /**< Outline around character */
|
|
|
|
LV_CURSOR_UNDERLINE, /**< Horizontal line under character */
|
|
|
|
LV_CURSOR_HIDDEN = 0x08, /**< This flag can be ORed to any of the other values to temporarily hide the cursor */
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
2018-09-18 14:30:48 +02:00
|
|
|
typedef uint8_t lv_cursor_type_t;
|
2017-09-15 10:22:12 +02:00
|
|
|
|
2017-01-14 23:54:16 +01:00
|
|
|
/*Data of text area*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
lv_page_ext_t page; /*Ext. of ancestor*/
|
|
|
|
/*New data for this type */
|
2019-06-06 06:05:40 +02:00
|
|
|
lv_obj_t * label; /*Label of the text area*/
|
|
|
|
lv_obj_t * placeholder; /*Place holder label. only visible if text is an empty string*/
|
|
|
|
char * pwd_tmp; /*Used to store the original text in password mode*/
|
2019-04-04 07:15:40 +02:00
|
|
|
const char * accapted_chars; /*Only these characters will be accepted. NULL: accept all*/
|
|
|
|
uint16_t max_length; /*The max. number of characters. 0: no limit*/
|
2019-05-25 16:27:36 +02:00
|
|
|
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
|
2019-04-04 07:15:40 +02:00
|
|
|
struct
|
|
|
|
{
|
2019-06-06 06:05:40 +02:00
|
|
|
const lv_style_t * style; /* Style of the cursor (NULL to use label's style)*/
|
|
|
|
lv_coord_t valid_x; /* Used when stepping up/down to a shorter line.
|
|
|
|
* (Used by the library)*/
|
|
|
|
uint16_t pos; /* The current cursor position
|
|
|
|
* (0: before 1st letter; 1: before 2nd letter ...)*/
|
|
|
|
uint16_t blink_time; /*Blink period*/
|
|
|
|
lv_area_t area; /* Cursor area relative to the Text Area*/
|
|
|
|
uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/
|
|
|
|
lv_cursor_type_t type : 4; /* Shape of the cursor*/
|
|
|
|
uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/
|
2019-06-27 07:16:15 +02:00
|
|
|
uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/
|
2018-06-19 09:49:58 +02:00
|
|
|
} cursor;
|
2019-04-18 07:11:43 +02:00
|
|
|
#if LV_LABEL_TEXT_SEL
|
2019-06-06 06:05:40 +02:00
|
|
|
uint16_t tmp_sel_start; /*Temporary value*/
|
|
|
|
uint16_t tmp_sel_end; /*Temporary value*/
|
2019-04-18 06:45:45 +02:00
|
|
|
uint8_t text_sel_in_prog : 1; /*User is in process of selecting */
|
2019-06-06 06:05:40 +02:00
|
|
|
uint8_t text_sel_en : 1; /*Text can be selected on this text area*/
|
2019-04-18 07:11:43 +02:00
|
|
|
#endif
|
2019-06-06 06:05:40 +02:00
|
|
|
uint8_t pwd_mode : 1; /*Replace characters with '*' */
|
|
|
|
uint8_t one_line : 1; /*One line mode (ignore line breaks)*/
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_ta_ext_t;
|
2017-01-14 23:54:16 +01:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Possible text areas tyles. */
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_TA_STYLE_BG, /**< Text area background style */
|
|
|
|
LV_TA_STYLE_SB, /**< Scrollbar style */
|
|
|
|
LV_TA_STYLE_CURSOR, /**< Cursor style */
|
|
|
|
LV_TA_STYLE_EDGE_FLASH, /**< Edge flash style */
|
|
|
|
LV_TA_STYLE_PLACEHOLDER, /**< Placeholder style */
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
2018-09-18 14:30:48 +02:00
|
|
|
typedef uint8_t lv_ta_style_t;
|
2017-11-15 15:50:33 +01:00
|
|
|
|
2016-09-30 15:29:00 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a text area objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new text area
|
|
|
|
* @param copy pointer to a text area object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created text area
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/*======================
|
|
|
|
* Add/remove functions
|
|
|
|
*=====================*/
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2018-08-09 23:37:00 +02:00
|
|
|
* Insert a character to the current cursor position.
|
|
|
|
* To add a wide char, e.g. 'Á' use `lv_txt_encoded_conv_wc('Á')`
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param ta pointer to a text area object
|
2018-08-09 23:37:00 +02:00
|
|
|
* @param c a character (e.g. 'a')
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-08-09 23:37:00 +02:00
|
|
|
void lv_ta_add_char(lv_obj_t * ta, uint32_t c);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a text to the current cursor position
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @param txt a '\0' terminated string to insert
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_ta_add_text(lv_obj_t * ta, const char * txt);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/**
|
|
|
|
* Delete a the left character from the current cursor position
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_del_char(lv_obj_t * ta);
|
|
|
|
|
2019-02-01 23:53:09 +01:00
|
|
|
/**
|
|
|
|
* Delete the right character from the current cursor position
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_del_char_forward(lv_obj_t * ta);
|
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Set the text of a text area
|
|
|
|
* @param ta pointer to a text area
|
|
|
|
* @param txt pointer to the text
|
|
|
|
*/
|
2016-12-15 10:31:30 +01:00
|
|
|
void lv_ta_set_text(lv_obj_t * ta, const char * txt);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-02-02 01:26:52 +01:00
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Set the placeholder text of a text area
|
|
|
|
* @param ta pointer to a text area
|
|
|
|
* @param txt pointer to the text
|
|
|
|
*/
|
2019-02-02 01:26:52 +01:00
|
|
|
void lv_ta_set_placeholder_text(lv_obj_t * ta, const char * txt);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Set the cursor position
|
|
|
|
* @param obj pointer to a text area object
|
|
|
|
* @param pos the new cursor position in character index
|
|
|
|
* < 0 : index from the end of the text
|
2017-11-15 15:50:33 +01:00
|
|
|
* LV_TA_CURSOR_LAST: go after the last character
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2016-12-15 10:31:30 +01:00
|
|
|
void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-09-15 10:22:12 +02:00
|
|
|
/**
|
|
|
|
* Set the cursor type.
|
|
|
|
* @param ta pointer to a text area object
|
2017-11-17 15:43:08 +01:00
|
|
|
* @param cur_type: element of 'lv_cursor_type_t'
|
2017-09-15 10:22:12 +02:00
|
|
|
*/
|
2017-11-17 15:43:08 +01:00
|
|
|
void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type);
|
2018-08-13 19:09:27 +02:00
|
|
|
|
2019-06-14 16:04:15 +02:00
|
|
|
/**
|
|
|
|
* Enable/Disable the positioning of the the cursor by clicking the text on the text area.
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @param en true: enable click positions; false: disable
|
|
|
|
*/
|
|
|
|
void lv_ta_set_cursor_click_pos(lv_obj_t * ta, bool en);
|
|
|
|
|
2017-09-15 10:22:12 +02:00
|
|
|
/**
|
2017-11-10 15:01:40 +01:00
|
|
|
* Enable/Disable password mode
|
2017-09-15 10:22:12 +02:00
|
|
|
* @param ta pointer to a text area object
|
2018-12-22 19:45:55 +01:00
|
|
|
* @param en true: enable, false: disable
|
2017-09-15 10:22:12 +02:00
|
|
|
*/
|
2018-12-22 19:45:55 +01:00
|
|
|
void lv_ta_set_pwd_mode(lv_obj_t * ta, bool en);
|
2017-09-15 10:22:12 +02:00
|
|
|
|
2017-07-07 16:22:24 +02:00
|
|
|
/**
|
2017-11-10 15:01:40 +01:00
|
|
|
* Configure the text area to one line or back to normal
|
|
|
|
* @param ta pointer to a Text area object
|
|
|
|
* @param en true: one line, false: normal
|
2017-07-07 16:22:24 +02:00
|
|
|
*/
|
2017-11-10 15:01:40 +01:00
|
|
|
void lv_ta_set_one_line(lv_obj_t * ta, bool en);
|
2017-07-07 16:22:24 +02:00
|
|
|
|
2018-09-25 16:21:31 +02:00
|
|
|
/**
|
|
|
|
* Set the alignment of the text area.
|
|
|
|
* In one line mode the text can be scrolled only with `LV_LABEL_ALIGN_LEFT`.
|
|
|
|
* This function should be called if the size of text area changes.
|
|
|
|
* @param ta pointer to a text are object
|
|
|
|
* @param align the desired alignment from `lv_label_align_t`. (LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)
|
|
|
|
*/
|
|
|
|
void lv_ta_set_text_align(lv_obj_t * ta, lv_label_align_t align);
|
|
|
|
|
2018-08-04 08:46:44 +02:00
|
|
|
/**
|
|
|
|
* Set a list of characters. Only these characters will be accepted by the text area
|
|
|
|
* @param ta pointer to Text Area
|
|
|
|
* @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
|
|
|
|
*/
|
|
|
|
void lv_ta_set_accepted_chars(lv_obj_t * ta, const char * list);
|
2018-08-13 19:09:27 +02:00
|
|
|
|
2018-08-04 08:46:44 +02:00
|
|
|
/**
|
|
|
|
* Set max length of a Text Area.
|
|
|
|
* @param ta pointer to Text Area
|
|
|
|
* @param num the maximal number of characters can be added (`lv_ta_set_text` ignores it)
|
|
|
|
*/
|
|
|
|
void lv_ta_set_max_length(lv_obj_t * ta, uint16_t num);
|
|
|
|
|
2019-03-20 05:46:21 +01:00
|
|
|
/**
|
|
|
|
* In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by an other text.
|
|
|
|
* It can be used to add automatic formatting to the text area.
|
|
|
|
* @param ta pointer to a text area.
|
|
|
|
* @param txt pointer to a new string to insert. If `""` no text will be added.
|
2019-04-04 07:15:40 +02:00
|
|
|
* The variable must be live after the `event_cb` exists. (Should be `global` or
|
|
|
|
* `static`)
|
2019-03-20 05:46:21 +01:00
|
|
|
*/
|
|
|
|
void lv_ta_set_insert_replace(lv_obj_t * ta, const char * txt);
|
|
|
|
|
2017-08-16 11:28:04 +02:00
|
|
|
/**
|
2017-11-10 15:01:40 +01:00
|
|
|
* Set the scroll bar mode of a text area
|
2017-08-16 11:28:04 +02:00
|
|
|
* @param ta pointer to a text area object
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
|
2017-08-16 11:28:04 +02:00
|
|
|
*/
|
2017-11-18 00:18:19 +01:00
|
|
|
static inline void lv_ta_set_sb_mode(lv_obj_t * ta, lv_sb_mode_t mode)
|
2017-11-10 15:01:40 +01:00
|
|
|
{
|
|
|
|
lv_page_set_sb_mode(ta, mode);
|
|
|
|
}
|
|
|
|
|
2018-11-07 20:41:52 +01:00
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Enable the scroll propagation feature. If enabled then the Text area will move its parent if
|
|
|
|
* there is no more space to scroll.
|
2018-11-07 20:41:52 +01:00
|
|
|
* @param ta pointer to a Text area
|
|
|
|
* @param en true or false to enable/disable scroll propagation
|
|
|
|
*/
|
|
|
|
static inline void lv_ta_set_scroll_propagation(lv_obj_t * ta, bool en)
|
|
|
|
{
|
|
|
|
lv_page_set_scroll_propagation(ta, en);
|
|
|
|
}
|
|
|
|
|
2018-11-24 20:31:06 +01:00
|
|
|
/**
|
|
|
|
* Enable the edge flash effect. (Show an arc when the an edge is reached)
|
|
|
|
* @param page pointer to a Text Area
|
|
|
|
* @param en true or false to enable/disable end flash
|
|
|
|
*/
|
|
|
|
static inline void lv_ta_set_edge_flash(lv_obj_t * ta, bool en)
|
|
|
|
{
|
|
|
|
lv_page_set_edge_flash(ta, en);
|
|
|
|
}
|
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Set a style of a text area
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param ta pointer to a text area object
|
2017-11-15 15:50:33 +01:00
|
|
|
* @param type which style should be set
|
|
|
|
* @param style pointer to a style
|
2017-11-10 15:01:40 +01:00
|
|
|
*/
|
2019-04-11 19:59:55 +08:00
|
|
|
void lv_ta_set_style(lv_obj_t * ta, lv_ta_style_t type, const lv_style_t * style);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2019-03-27 19:17:48 -04:00
|
|
|
/**
|
|
|
|
* Enable/disable selection mode.
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @param en true or false to enable/disable selection mode
|
|
|
|
*/
|
2019-04-18 06:45:45 +02:00
|
|
|
void lv_ta_set_text_sel(lv_obj_t * ta, bool en);
|
2019-03-27 19:17:48 -04:00
|
|
|
|
2019-05-25 16:27:36 +02:00
|
|
|
/**
|
|
|
|
* Set how long show the password before changing it to '*'
|
|
|
|
* @param ta pointer to Text area
|
|
|
|
* @param time show time in milliseconds. 0: hide immediately.
|
|
|
|
*/
|
|
|
|
void lv_ta_set_pwd_show_time(lv_obj_t * ta, uint16_t time);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set cursor blink animation time
|
|
|
|
* @param ta pointer to Text area
|
|
|
|
* @param time blink period. 0: disable blinking
|
|
|
|
*/
|
|
|
|
void lv_ta_set_cursor_blink_time(lv_obj_t * ta, uint16_t time);
|
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
2017-08-16 11:28:04 +02:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2018-08-04 08:46:44 +02:00
|
|
|
* Get the text of a text area. In password mode it gives the real text (not '*'s).
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param ta pointer to a text area object
|
2017-01-13 23:27:49 +01:00
|
|
|
* @return pointer to the text
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
const char * lv_ta_get_text(const lv_obj_t * ta);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-02-02 01:26:52 +01:00
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Get the placeholder text of a text area
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return pointer to the text
|
|
|
|
*/
|
2019-02-02 01:26:52 +01:00
|
|
|
const char * lv_ta_get_placeholder_text(lv_obj_t * ta);
|
|
|
|
|
2017-06-13 14:49:41 +02:00
|
|
|
/**
|
|
|
|
* Get the label of a text area
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return pointer to the label object
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_ta_get_label(const lv_obj_t * ta);
|
2017-06-13 14:49:41 +02:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the current cursor position in character index
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return the cursor position
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
uint16_t lv_ta_get_cursor_pos(const lv_obj_t * ta);
|
2016-09-30 15:29:00 +02:00
|
|
|
|
2017-09-15 10:22:12 +02:00
|
|
|
/**
|
|
|
|
* Get the current cursor type.
|
|
|
|
* @param ta pointer to a text area object
|
2017-11-17 15:43:08 +01:00
|
|
|
* @return element of 'lv_cursor_type_t'
|
2017-09-15 10:22:12 +02:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_cursor_type_t lv_ta_get_cursor_type(const lv_obj_t * ta);
|
2017-09-15 10:22:12 +02:00
|
|
|
|
2019-06-14 16:04:15 +02:00
|
|
|
/**
|
|
|
|
* Get whether the cursor click positioning is enabled or not.
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return true: enable click positions; false: disable
|
|
|
|
*/
|
|
|
|
bool lv_ta_get_cursor_click_pos(lv_obj_t * ta);
|
|
|
|
|
2017-09-15 10:22:12 +02:00
|
|
|
/**
|
2017-11-10 15:01:40 +01:00
|
|
|
* Get the password mode attribute
|
2017-07-07 16:22:24 +02:00
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return true: password mode is enabled, false: disabled
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_ta_get_pwd_mode(const lv_obj_t * ta);
|
2016-09-30 15:29:00 +02:00
|
|
|
|
2017-11-05 14:12:50 +01:00
|
|
|
/**
|
|
|
|
* Get the one line configuration attribute
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return true: one line configuration is enabled, false: disabled
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_ta_get_one_line(const lv_obj_t * ta);
|
2017-11-05 14:12:50 +01:00
|
|
|
|
2018-08-04 08:46:44 +02:00
|
|
|
/**
|
|
|
|
* Get a list of accepted characters.
|
|
|
|
* @param ta pointer to Text Area
|
|
|
|
* @return list of accented characters.
|
|
|
|
*/
|
|
|
|
const char * lv_ta_get_accepted_chars(lv_obj_t * ta);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set max length of a Text Area.
|
|
|
|
* @param ta pointer to Text Area
|
|
|
|
* @return the maximal number of characters to be add
|
|
|
|
*/
|
|
|
|
uint16_t lv_ta_get_max_length(lv_obj_t * ta);
|
|
|
|
|
2017-11-05 14:12:50 +01:00
|
|
|
/**
|
|
|
|
* Get the scroll bar mode of a text area
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
static inline lv_sb_mode_t lv_ta_get_sb_mode(const lv_obj_t * ta)
|
2017-11-05 14:12:50 +01:00
|
|
|
{
|
|
|
|
return lv_page_get_sb_mode(ta);
|
|
|
|
}
|
|
|
|
|
2018-11-07 20:41:52 +01:00
|
|
|
/**
|
|
|
|
* Get the scroll propagation property
|
|
|
|
* @param ta pointer to a Text area
|
|
|
|
* @return true or false
|
|
|
|
*/
|
|
|
|
static inline bool lv_ta_get_scroll_propagation(lv_obj_t * ta)
|
|
|
|
{
|
|
|
|
return lv_page_get_scroll_propagation(ta);
|
|
|
|
}
|
|
|
|
|
2018-11-24 20:31:06 +01:00
|
|
|
/**
|
|
|
|
* Get the scroll propagation property
|
|
|
|
* @param ta pointer to a Text area
|
|
|
|
* @return true or false
|
|
|
|
*/
|
|
|
|
static inline bool lv_ta_get_edge_flash(lv_obj_t * ta)
|
|
|
|
{
|
|
|
|
return lv_page_get_edge_flash(ta);
|
|
|
|
}
|
|
|
|
|
2017-11-05 00:48:57 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Get a style of a text area
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @param type which style should be get
|
|
|
|
* @return style pointer to a style
|
|
|
|
*/
|
2019-04-11 19:59:55 +08:00
|
|
|
const lv_style_t * lv_ta_get_style(const lv_obj_t * ta, lv_ta_style_t type);
|
2017-11-15 15:50:33 +01:00
|
|
|
|
2019-03-27 18:36:57 -04:00
|
|
|
/**
|
|
|
|
* Find whether text is selected or not.
|
|
|
|
* @param ta Text area object
|
|
|
|
* @return whether text is selected or not
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
bool lv_ta_text_is_selected(const lv_obj_t * ta);
|
2019-03-27 18:36:57 -04:00
|
|
|
|
2019-03-27 19:17:48 -04:00
|
|
|
/**
|
|
|
|
* Find whether selection mode is enabled.
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
* @return true: selection mode is enabled, false: disabled
|
|
|
|
*/
|
2019-04-18 07:11:43 +02:00
|
|
|
bool lv_ta_get_text_sel_en(lv_obj_t * ta);
|
2019-03-27 19:17:48 -04:00
|
|
|
|
2019-05-25 16:27:36 +02:00
|
|
|
/**
|
|
|
|
* Set how long show the password before changing it to '*'
|
|
|
|
* @param ta pointer to Text area
|
|
|
|
* @return show time in milliseconds. 0: hide immediately.
|
|
|
|
*/
|
|
|
|
uint16_t lv_ta_get_pwd_show_time(lv_obj_t * ta);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set cursor blink animation time
|
|
|
|
* @param ta pointer to Text area
|
|
|
|
* @return time blink period. 0: disable blinking
|
|
|
|
*/
|
|
|
|
uint16_t lv_ta_get_cursor_blink_time(lv_obj_t * ta);
|
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/*=====================
|
|
|
|
* Other functions
|
|
|
|
*====================*/
|
2017-11-05 00:48:57 +01:00
|
|
|
|
2019-03-27 17:22:44 -04:00
|
|
|
/**
|
|
|
|
* Clear the selection on the text area.
|
|
|
|
* @param ta Text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_clear_selection(lv_obj_t * ta);
|
|
|
|
|
2017-11-05 00:48:57 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Move the cursor one character right
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_cursor_right(lv_obj_t * ta);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the cursor one character left
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_cursor_left(lv_obj_t * ta);
|
2017-11-05 00:48:57 +01:00
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Move the cursor one line down
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
2017-11-15 15:50:33 +01:00
|
|
|
void lv_ta_cursor_down(lv_obj_t * ta);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the cursor one line up
|
|
|
|
* @param ta pointer to a text area object
|
|
|
|
*/
|
|
|
|
void lv_ta_cursor_up(lv_obj_t * ta);
|
2017-11-05 14:12:50 +01:00
|
|
|
|
2016-09-30 15:29:00 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_USE_TA_H*/
|
2016-09-30 15:29:00 +02:00
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
2016-09-30 15:29:00 +02:00
|
|
|
#endif
|
2017-07-09 15:32:49 +02:00
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_TA_H*/
|