chore(textarea) clean up comemnts

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-31 13:22:35 +02:00
parent d86c0e3e55
commit 0527874f8d
2 changed files with 93 additions and 265 deletions

View File

@@ -81,11 +81,6 @@ static const char * ta_insert_replace;
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
/**
* Create a text area objects
* @param par pointer to an object, it will be the parent of the new text area
* @return pointer to the created text area
*/
lv_obj_t * lv_textarea_create(lv_obj_t * parent) lv_obj_t * lv_textarea_create(lv_obj_t * parent)
{ {
LV_LOG_INFO("begin") LV_LOG_INFO("begin")
@@ -96,12 +91,6 @@ lv_obj_t * lv_textarea_create(lv_obj_t * parent)
* Add/remove functions * Add/remove functions
*=====================*/ *=====================*/
/**
* Insert a character to the current cursor position.
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
* @param ta pointer to a text area object
* @param c a character (e.g. 'a')
*/
void lv_textarea_add_char(lv_obj_t * obj, uint32_t c) void lv_textarea_add_char(lv_obj_t * obj, uint32_t c)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -180,11 +169,6 @@ void lv_textarea_add_char(lv_obj_t * obj, uint32_t c)
lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
} }
/**
* Insert a text to the current cursor position
* @param ta pointer to a text area object
* @param txt a '\0' terminated string to insert
*/
void lv_textarea_add_text(lv_obj_t * obj, const char * txt) void lv_textarea_add_text(lv_obj_t * obj, const char * txt)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -251,10 +235,6 @@ void lv_textarea_add_text(lv_obj_t * obj, const char * txt)
lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
} }
/**
* Delete a the left character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char(lv_obj_t * obj) void lv_textarea_del_char(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -299,10 +279,6 @@ void lv_textarea_del_char(lv_obj_t * obj)
} }
/**
* Delete the right character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char_forward(lv_obj_t * obj) void lv_textarea_del_char_forward(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -316,11 +292,6 @@ void lv_textarea_del_char_forward(lv_obj_t * obj)
* Setter functions * Setter functions
*====================*/ *====================*/
/**
* Set the text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_text(lv_obj_t * obj, const char * txt) void lv_textarea_set_text(lv_obj_t * obj, const char * txt)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -385,11 +356,6 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt)
lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
} }
/**
* Set the placeholder_txt text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt) void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -426,13 +392,6 @@ void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt)
lv_obj_invalidate(obj); lv_obj_invalidate(obj);
} }
/**
* 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
* LV_TEXTAREA_CURSOR_LAST: go after the last character
*/
void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -475,11 +434,6 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos)
refr_cursor_area(obj); refr_cursor_area(obj);
} }
/**
* Enable/Disable the positioning of 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_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en) void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -488,11 +442,6 @@ void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en)
ta->cursor.click_pos = en ? 1 : 0; ta->cursor.click_pos = en ? 1 : 0;
} }
/**
* Enable/Disable password mode
* @param ta pointer to a text area object
* @param en true: enable, false: disable
*/
void lv_textarea_set_password_mode(lv_obj_t * obj, bool en) void lv_textarea_set_password_mode(lv_obj_t * obj, bool en)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -526,11 +475,6 @@ void lv_textarea_set_password_mode(lv_obj_t * obj, bool en)
refr_cursor_area(obj); refr_cursor_area(obj);
} }
/**
* 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
*/
void lv_textarea_set_one_line(lv_obj_t * obj, bool en) void lv_textarea_set_one_line(lv_obj_t * obj, bool en)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -556,11 +500,6 @@ void lv_textarea_set_one_line(lv_obj_t * obj, bool en)
} }
} }
/**
* 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_textarea_set_accepted_chars(lv_obj_t * obj, const char * list) void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -570,11 +509,6 @@ void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list)
ta->accepted_chars = list; ta->accepted_chars = list;
} }
/**
* Set max length of a Text Area.
* @param ta pointer to Text Area
* @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it)
*/
void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num) void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -584,14 +518,6 @@ void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num)
ta->max_length = num; ta->max_length = num;
} }
/**
* 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.
* The variable must be live after the `event_cb` exists. (Should be `global` or
* `static`)
*/
void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt) void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -600,11 +526,6 @@ void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt)
ta_insert_replace = txt; ta_insert_replace = txt;
} }
/**
* Enable/disable selection mode.
* @param ta pointer to a text area object
* @param en true or false to enable/disable selection mode
*/
void lv_textarea_set_text_sel(lv_obj_t * obj, bool en) void lv_textarea_set_text_sel(lv_obj_t * obj, bool en)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -621,11 +542,6 @@ void lv_textarea_set_text_sel(lv_obj_t * obj, bool en)
#endif #endif
} }
/**
* 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_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time) void lv_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -634,13 +550,6 @@ void lv_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time)
ta->pwd_show_time = time; ta->pwd_show_time = time;
} }
/**
* Set the label's alignment.
* It sets where the label is aligned (in one line mode it can be smaller than the text area)
* and how the lines of the area align in case of multiline text area
* @param obj pointer to a textarea obejct
* @param align the align mode from ::lv_text_align_t
*/
void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align) void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align)
{ {
lv_obj_set_style_text_align(obj, LV_PART_MAIN, LV_STATE_DEFAULT, align); lv_obj_set_style_text_align(obj, LV_PART_MAIN, LV_STATE_DEFAULT, align);
@@ -663,11 +572,6 @@ void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align)
* Getter functions * Getter functions
*====================*/ *====================*/
/**
* Get the text of a text area. In password mode it gives the real text (not '*'s).
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_text(const lv_obj_t * obj) const char * lv_textarea_get_text(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -685,11 +589,6 @@ const char * lv_textarea_get_text(const lv_obj_t * obj)
return txt; return txt;
} }
/**
* Get the placeholder_txt text of a text area
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_placeholder_text(lv_obj_t * obj) const char * lv_textarea_get_placeholder_text(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -699,11 +598,6 @@ const char * lv_textarea_get_placeholder_text(lv_obj_t * obj)
else return ""; else return "";
} }
/**
* Get the label of a text area
* @param ta pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj) lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -712,11 +606,6 @@ lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj)
return ta->label; return ta->label;
} }
/**
* Get the current cursor position in character index
* @param ta pointer to a text area object
* @return the cursor position
*/
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj) uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -725,11 +614,6 @@ uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj)
return ta->cursor.pos; return ta->cursor.pos;
} }
/**
* 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_textarea_get_cursor_click_pos(lv_obj_t * obj) bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -738,11 +622,6 @@ bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj)
return ta->cursor.click_pos ? true : false; return ta->cursor.click_pos ? true : false;
} }
/**
* Get the password mode attribute
* @param ta pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_textarea_get_password_mode(const lv_obj_t * obj) bool lv_textarea_get_password_mode(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -751,11 +630,6 @@ bool lv_textarea_get_password_mode(const lv_obj_t * obj)
return ta->pwd_mode == 0 ? false : true; return ta->pwd_mode == 0 ? false : true;
} }
/**
* Get the one line configuration attribute
* @param ta pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_textarea_get_one_line(const lv_obj_t * obj) bool lv_textarea_get_one_line(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -764,11 +638,6 @@ bool lv_textarea_get_one_line(const lv_obj_t * obj)
return ta->one_line == 0 ? false : true; return ta->one_line == 0 ? false : true;
} }
/**
* Get a list of accepted characters.
* @param ta pointer to Text Area
* @return list of accented characters.
*/
const char * lv_textarea_get_accepted_chars(lv_obj_t * obj) const char * lv_textarea_get_accepted_chars(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -778,11 +647,6 @@ const char * lv_textarea_get_accepted_chars(lv_obj_t * obj)
return ta->accepted_chars; return ta->accepted_chars;
} }
/**
* Set max length of a Text Area.
* @param ta pointer to Text Area
* @return the maximal number of characters to be add
*/
uint32_t lv_textarea_get_max_length(lv_obj_t * obj) uint32_t lv_textarea_get_max_length(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -791,11 +655,6 @@ uint32_t lv_textarea_get_max_length(lv_obj_t * obj)
return ta->max_length; return ta->max_length;
} }
/**
* Find whether text is selected or not.
* @param ta Text area object
* @return whether text is selected or not
*/
bool lv_textarea_text_is_selected(const lv_obj_t * obj) bool lv_textarea_text_is_selected(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -816,11 +675,6 @@ bool lv_textarea_text_is_selected(const lv_obj_t * obj)
#endif #endif
} }
/**
* Find whether selection mode is enabled.
* @param ta pointer to a text area object
* @return true: selection mode is enabled, false: disabled
*/
bool lv_textarea_get_text_sel_en(lv_obj_t * obj) bool lv_textarea_get_text_sel_en(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -834,11 +688,6 @@ bool lv_textarea_get_text_sel_en(lv_obj_t * obj)
#endif #endif
} }
/**
* 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_textarea_get_password_show_time(lv_obj_t * obj) uint16_t lv_textarea_get_password_show_time(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -852,10 +701,6 @@ uint16_t lv_textarea_get_password_show_time(lv_obj_t * obj)
* Other functions * Other functions
*====================*/ *====================*/
/**
* Clear the selection on the text area.
* @param ta Text area object
*/
void lv_textarea_clear_selection(lv_obj_t * obj) void lv_textarea_clear_selection(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -873,10 +718,6 @@ void lv_textarea_clear_selection(lv_obj_t * obj)
#endif #endif
} }
/**
* Move the cursor one character right
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_right(lv_obj_t * obj) void lv_textarea_cursor_right(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -886,10 +727,6 @@ void lv_textarea_cursor_right(lv_obj_t * obj)
lv_textarea_set_cursor_pos(obj, cp); lv_textarea_set_cursor_pos(obj, cp);
} }
/**
* Move the cursor one character left
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_left(lv_obj_t * obj) void lv_textarea_cursor_left(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -901,10 +738,6 @@ void lv_textarea_cursor_left(lv_obj_t * obj)
} }
} }
/**
* Move the cursor one line down
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_down(lv_obj_t * obj) void lv_textarea_cursor_down(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -934,10 +767,6 @@ void lv_textarea_cursor_down(lv_obj_t * obj)
} }
} }
/**
* Move the cursor one line up
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_up(lv_obj_t * obj) void lv_textarea_cursor_up(lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);

View File

@@ -89,29 +89,29 @@ lv_obj_t * lv_textarea_create(lv_obj_t * parent);
/** /**
* Insert a character to the current cursor position. * Insert a character to the current cursor position.
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')` * To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @param c a character (e.g. 'a') * @param c a character (e.g. 'a')
*/ */
void lv_textarea_add_char(lv_obj_t * ta, uint32_t c); void lv_textarea_add_char(lv_obj_t * obj, uint32_t c);
/** /**
* Insert a text to the current cursor position * Insert a text to the current cursor position
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @param txt a '\0' terminated string to insert * @param txt a '\0' terminated string to insert
*/ */
void lv_textarea_add_text(lv_obj_t * ta, const char * txt); void lv_textarea_add_text(lv_obj_t * obj, const char * txt);
/** /**
* Delete a the left character from the current cursor position * Delete a the left character from the current cursor position
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_del_char(lv_obj_t * ta); void lv_textarea_del_char(lv_obj_t * obj);
/** /**
* Delete the right character from the current cursor position * Delete the right character from the current cursor position
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_del_char_forward(lv_obj_t * ta); void lv_textarea_del_char_forward(lv_obj_t * obj);
/*===================== /*=====================
* Setter functions * Setter functions
@@ -119,17 +119,17 @@ void lv_textarea_del_char_forward(lv_obj_t * ta);
/** /**
* Set the text of a text area * Set the text of a text area
* @param ta pointer to a text area * @param obj pointer to a text area object
* @param txt pointer to the text * @param txt pointer to the text
*/ */
void lv_textarea_set_text(lv_obj_t * ta, const char * txt); void lv_textarea_set_text(lv_obj_t * obj, const char * txt);
/** /**
* Set the placeholder text of a text area * Set the placeholder text of a text area
* @param ta pointer to a text area * @param obj pointer to a text area object
* @param txt pointer to the text * @param txt pointer to the text
*/ */
void lv_textarea_set_placeholder_text(lv_obj_t * ta, const char * txt); void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt);
/** /**
* Set the cursor position * Set the cursor position
@@ -138,72 +138,71 @@ void lv_textarea_set_placeholder_text(lv_obj_t * ta, const char * txt);
* < 0 : index from the end of the text * < 0 : index from the end of the text
* LV_TEXTAREA_CURSOR_LAST: go after the last character * LV_TEXTAREA_CURSOR_LAST: go after the last character
*/ */
void lv_textarea_set_cursor_pos(lv_obj_t * ta, int32_t pos); void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos);
/** /**
* Enable/Disable the positioning of the cursor by clicking the text on the text area. * Enable/Disable the positioning of the cursor by clicking the text on the text area.
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @param en true: enable click positions; false: disable * @param en true: enable click positions; false: disable
*/ */
void lv_textarea_set_cursor_click_pos(lv_obj_t * ta, bool en); void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en);
/** /**
* Enable/Disable password mode * Enable/Disable password mode
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @param en true: enable, false: disable * @param en true: enable, false: disable
*/ */
void lv_textarea_set_password_mode(lv_obj_t * ta, bool en); void lv_textarea_set_password_mode(lv_obj_t * obj, bool en);
/** /**
* Configure the text area to one line or back to normal * Configure the text area to one line or back to normal
* @param ta pointer to a Text area object * @param obj pointer to a text area object
* @param en true: one line, false: normal * @param en true: one line, false: normal
*/ */
void lv_textarea_set_one_line(lv_obj_t * ta, bool en); void lv_textarea_set_one_line(lv_obj_t * obj, bool en);
/** /**
* Set a list of characters. Only these characters will be accepted by the text area * Set a list of characters. Only these characters will be accepted by the text area
* @param ta pointer to Text Area * @param obj pointer to a text area object
* @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789" * @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
*/ */
void lv_textarea_set_accepted_chars(lv_obj_t * ta, const char * list); void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list);
/** /**
* Set max length of a Text Area. * Set max length of a Text Area.
* @param ta pointer to Text Area * @param obj pointer to a text area object
* @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it) * @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it)
*/ */
void lv_textarea_set_max_length(lv_obj_t * ta, uint32_t num); void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num);
/** /**
* In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by an other text. * 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. * It can be used to add automatic formatting to the text area.
* @param ta pointer to a text area. * @param obj pointer to a text area object
* @param txt pointer to a new string to insert. If `""` no text will be added. * @param txt pointer to a new string to insert. If `""` no text will be added.
* The variable must be live after the `event_cb` exists. (Should be `global` or * The variable must be live after the `event_cb` exists. (Should be `global` or `static`)
* `static`)
*/ */
void lv_textarea_set_insert_replace(lv_obj_t * ta, const char * txt); void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt);
/** /**
* Enable/disable selection mode. * Enable/disable selection mode.
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @param en true or false to enable/disable selection mode * @param en true or false to enable/disable selection mode
*/ */
void lv_textarea_set_text_sel(lv_obj_t * ta, bool en); void lv_textarea_set_text_sel(lv_obj_t * obj, bool en);
/** /**
* Set how long show the password before changing it to '*' * Set how long show the password before changing it to '*'
* @param ta pointer to Text area * @param obj pointer to a text area object
* @param time show time in milliseconds. 0: hide immediately. * @param time show time in milliseconds. 0: hide immediately.
*/ */
void lv_textarea_set_password_show_time(lv_obj_t * ta, uint16_t time); void lv_textarea_set_password_show_time(lv_obj_t * obj, uint16_t time);
/** /**
* Set the label's alignment. * Set the label's alignment.
* It sets where the label is aligned (in one line mode it can be smaller than the text area) * It sets where the label is aligned (in one line mode it can be smaller than the text area)
* and how the lines of the area align in case of multiline text area * and how the lines of the area align in case of multiline text area
* @param obj pointer to a textarea obejct * @param obj pointer to a text area object
* @param align the align mode from ::lv_text_align_t * @param align the align mode from ::lv_text_align_t
*/ */
void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align); void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align);
@@ -214,87 +213,87 @@ void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align);
/** /**
* Get the text of a text area. In password mode it gives the real text (not '*'s). * Get the text of a text area. In password mode it gives the real text (not '*'s).
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return pointer to the text * @return pointer to the text
*/ */
const char * lv_textarea_get_text(const lv_obj_t * ta); const char * lv_textarea_get_text(const lv_obj_t * obj);
/** /**
* Get the placeholder text of a text area * Get the placeholder text of a text area
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return pointer to the text * @return pointer to the text
*/ */
const char * lv_textarea_get_placeholder_text(lv_obj_t * ta); const char * lv_textarea_get_placeholder_text(lv_obj_t * obj);
/** /**
* Get the label of a text area * Get the label of a text area
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return pointer to the label object * @return pointer to the label object
*/ */
lv_obj_t * lv_textarea_get_label(const lv_obj_t * ta); lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj);
/** /**
* Get the current cursor position in character index * Get the current cursor position in character index
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return the cursor position * @return the cursor position
*/ */
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * ta); uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj);
/** /**
* Get whether the cursor click positioning is enabled or not. * Get whether the cursor click positioning is enabled or not.
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return true: enable click positions; false: disable * @return true: enable click positions; false: disable
*/ */
bool lv_textarea_get_cursor_click_pos(lv_obj_t * ta); bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj);
/** /**
* Get the password mode attribute * Get the password mode attribute
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return true: password mode is enabled, false: disabled * @return true: password mode is enabled, false: disabled
*/ */
bool lv_textarea_get_password_mode(const lv_obj_t * ta); bool lv_textarea_get_password_mode(const lv_obj_t * obj);
/** /**
* Get the one line configuration attribute * Get the one line configuration attribute
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return true: one line configuration is enabled, false: disabled * @return true: one line configuration is enabled, false: disabled
*/ */
bool lv_textarea_get_one_line(const lv_obj_t * ta); bool lv_textarea_get_one_line(const lv_obj_t * obj);
/** /**
* Get a list of accepted characters. * Get a list of accepted characters.
* @param ta pointer to Text Area * @param obj pointer to a text area object
* @return list of accented characters. * @return list of accented characters.
*/ */
const char * lv_textarea_get_accepted_chars(lv_obj_t * ta); const char * lv_textarea_get_accepted_chars(lv_obj_t * obj);
/** /**
* Get max length of a Text Area. * Get max length of a Text Area.
* @param ta pointer to Text Area * @param obj pointer to a text area object
* @return the maximal number of characters to be add * @return the maximal number of characters to be add
*/ */
uint32_t lv_textarea_get_max_length(lv_obj_t * ta); uint32_t lv_textarea_get_max_length(lv_obj_t * obj);
/** /**
* Find whether text is selected or not. * Find whether text is selected or not.
* @param ta Text area object * @param obj pointer to a text area object
* @return whether text is selected or not * @return whether text is selected or not
*/ */
bool lv_textarea_text_is_selected(const lv_obj_t * ta); bool lv_textarea_text_is_selected(const lv_obj_t * obj);
/** /**
* Find whether selection mode is enabled. * Find whether selection mode is enabled.
* @param ta pointer to a text area object * @param obj pointer to a text area object
* @return true: selection mode is enabled, false: disabled * @return true: selection mode is enabled, false: disabled
*/ */
bool lv_textarea_get_text_sel_en(lv_obj_t * ta); bool lv_textarea_get_text_sel_en(lv_obj_t * obj);
/** /**
* Set how long show the password before changing it to '*' * Set how long show the password before changing it to '*'
* @param ta pointer to Text area * @param obj pointer to a text area object
* @return show time in milliseconds. 0: hide immediately. * @return show time in milliseconds. 0: hide immediately.
*/ */
uint16_t lv_textarea_get_password_show_time(lv_obj_t * ta); uint16_t lv_textarea_get_password_show_time(lv_obj_t * obj);
/*===================== /*=====================
* Other functions * Other functions
@@ -302,33 +301,33 @@ uint16_t lv_textarea_get_password_show_time(lv_obj_t * ta);
/** /**
* Clear the selection on the text area. * Clear the selection on the text area.
* @param ta Text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_clear_selection(lv_obj_t * ta); void lv_textarea_clear_selection(lv_obj_t * obj);
/** /**
* Move the cursor one character right * Move the cursor one character right
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_cursor_right(lv_obj_t * ta); void lv_textarea_cursor_right(lv_obj_t * obj);
/** /**
* Move the cursor one character left * Move the cursor one character left
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_cursor_left(lv_obj_t * ta); void lv_textarea_cursor_left(lv_obj_t * obj);
/** /**
* Move the cursor one line down * Move the cursor one line down
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_cursor_down(lv_obj_t * ta); void lv_textarea_cursor_down(lv_obj_t * obj);
/** /**
* Move the cursor one line up * Move the cursor one line up
* @param ta pointer to a text area object * @param obj pointer to a text area object
*/ */
void lv_textarea_cursor_up(lv_obj_t * ta); void lv_textarea_cursor_up(lv_obj_t * obj);
/********************** /**********************
* MACROS * MACROS