diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index a7bcb1213..e2c05c8aa 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -1440,7 +1440,7 @@ void * lv_obj_get_ext_attr(lv_obj_t * obj) return obj->ext_attr; } -#if LV_OBJ_FREE_NUMBER != 0 +#if LV_OBJ_FREE_NUM != 0 /** * Get the free number * @param obj pointer to an object @@ -1452,7 +1452,7 @@ uint8_t lv_obj_get_free_num(lv_obj_t * obj) } #endif -#if LV_OBJ_FREE_POINTER != 0 +#if LV_OBJ_FREE_PTR != 0 /** * Get the free pointer * @param obj pointer to an object diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index 84cda6601..e7015d931 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -478,7 +478,7 @@ void lv_obj_refresh_ext_size(lv_obj_t * obj); * @param obj pointer to an object * @param free_num the new free number */ -void lv_obj_set_free_number(lv_obj_t * obj, uint8_t free_number); +void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_number); #endif #if LV_OBJ_FREE_PTR != 0 @@ -488,7 +488,7 @@ void lv_obj_set_free_number(lv_obj_t * obj, uint8_t free_number); * @param obj pointer to an object * @param free_p the new free pinter */ -void lv_obj_set_free_pointer(lv_obj_t * obj, void * free_pointer); +void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_pointer); #endif /** diff --git a/lv_obj/lv_style.c b/lv_obj/lv_style.c index a00cced88..55c185763 100644 --- a/lv_obj/lv_style.c +++ b/lv_obj/lv_style.c @@ -121,7 +121,7 @@ void lv_style_init (void) lv_style_pretty.body.radius = LV_DPI / 15; lv_style_pretty.body.border.color = COLOR_MAKE(0x40, 0x40, 0x40); lv_style_pretty.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; - lv_style_pretty.body.border.opa = OPA_50; + lv_style_pretty.body.border.opa = OPA_30; /*Pretty color style*/ memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t)); diff --git a/lv_objx/lv_ddlist.h b/lv_objx/lv_ddlist.h index 8a8ae7f4e..0d7c4126a 100644 --- a/lv_objx/lv_ddlist.h +++ b/lv_objx/lv_ddlist.h @@ -188,6 +188,26 @@ uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist); * TRANSPARENT API FUNCTIONS ***************************/ +/** + * Set the scroll bar mode of a drop down list + * @param ta pointer to a drop down list object + * @param sb_mode the new mode from 'lv_page_sb_mode_t' enum + */ +static inline void lv_ddlist_set_sb_mode(lv_obj_t * ta, lv_page_sb_mode_t mode) +{ + lv_page_set_sb_mode(ta, mode); +} + +/** + * Get the scroll bar mode of a drop down list + * @param ddlist pointer to a drop down list object + * @return scrollbar mode from 'lv_page_sb_mode_t' enum + */ +static inline lv_page_sb_mode_t lv_ddlist_get_sb_mode(lv_obj_t * ta) +{ + return lv_page_get_sb_mode(ta); +} + /** * Get the style of the drop down list background * @param ddlist pointer to a text area object @@ -203,7 +223,7 @@ static inline lv_style_t * lv_ddlist_get_style_bg(lv_obj_t * ddlist) * @param ddlist pointer to a text area object * @return pointer to the style of the scrollbars */ -static inline lv_style_t * lv_ddlist_get_style_scrollbar(lv_obj_t * ddlist) +static inline lv_style_t * lv_ddlist_get_style_sb(lv_obj_t * ddlist) { return lv_page_get_style_sb(ddlist); } diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 8b24ac0b5..915f01e21 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -253,7 +253,7 @@ void lv_label_set_text_static(lv_obj_t * label, const char * text) /** * Insert a text to the label. The label current label text can not be static. * @param label pointer to label object - * @param pos character index to insert + * @param pos character index to insert Expressed in character index and not byte index (Different in UTF-8) * 0: before first char. * LV_LABEL_POS_LAST: after last char. * @param txt pointer to the text to insert @@ -462,7 +462,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos) max_w = CORD_MAX; } - index = txt_utf8_get_id(txt, index); + index = txt_utf8_get_byte_id(txt, index); /*Search the line of the index letter */; while (txt[new_line_start] != '\0') { @@ -514,6 +514,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos) * @param label pointer to label object * @param pos pointer to point with coordinates on a the label * @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter) + * Expressed in character index and not byte index (different in UTF-8) */ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos) { @@ -541,7 +542,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos) /*Search the line of the index letter */; while (txt[line_start] != '\0') { new_line_start += txt_get_next_line(&txt[line_start], font, style->text.letter_space, max_w, flag); - if(pos->y <= y + letter_height + style->text.line_space) break; /*The line is found ('line_start')*/ + if(pos->y <= y + letter_height) break; /*The line is found (stored in 'line_start')*/ y += letter_height + style->text.line_space; line_start = new_line_start; } @@ -557,9 +558,10 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos) txt_cmd_state_t cmd_state = TXT_CMD_STATE_WAIT; uint32_t i = line_start; + uint32_t i_current = i; uint32_t letter; while(i < new_line_start - 1) { - letter = txt_utf8_next(txt, &i); + letter = txt_utf8_next(txt, &i); /*Be careful 'i' already points to the next character*/ /*Handle the recolor command*/ if((flag & TXT_FLAG_RECOLOR) != 0) { if(txt_is_cmd(&cmd_state, txt[i]) != false) { @@ -567,11 +569,16 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos) } } - x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->text.letter_space; - if(pos->x < x) break; /*Get the position*/ + x += (font_get_width(font, letter) >> FONT_ANTIALIAS); + if(pos->x < x) { + i = i_current; + break; + } + x += style->text.letter_space; + i_current = i; } - return i; + return txt_utf8_get_char_id(txt, i); } diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 93bb3847b..ba94c10fb 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -45,7 +45,6 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des static void cursor_blink_anim(lv_obj_t * ta, uint8_t show); static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x); static void pwd_char_hider(lv_obj_t * ta); -static void lv_ta_save_valid_cursor_x(lv_obj_t * ta); /********************** * STATIC VARIABLES @@ -82,6 +81,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_func(new_ta); if(scrl_signal == NULL) scrl_signal = lv_obj_get_signal_func(lv_page_get_scrl(new_ta)); if(scrl_design == NULL) scrl_design = lv_obj_get_design_func(lv_page_get_scrl(new_ta)); + /*Allocate the object type specific extended data*/ lv_ta_ext_t * ext = lv_obj_allocate_ext_attr(new_ta, sizeof(lv_ta_ext_t)); dm_assert(ext); @@ -107,7 +107,6 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_design_func(ext->page.scrl, lv_ta_scrollable_design); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); lv_label_set_text(ext->label, "Text area"); - lv_page_glue_obj(ext->label, true); lv_obj_set_click(ext->label, false); lv_obj_set_style(new_ta, &lv_style_pretty); lv_page_set_sb_mode(new_ta, LV_PAGE_SB_MODE_DRAG); @@ -121,7 +120,9 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) ext->label = lv_label_create(new_ta, copy_ext->label); ext->cursor_show = copy_ext->cursor_show; ext->pwd_mode = copy_ext->pwd_mode; - lv_page_glue_obj(ext->label, true); + ext->cursor_style = copy_ext->cursor_style; + ext->cursor_pos = copy_ext->cursor_pos; + ext->cursor_valid_x = copy_ext->cursor_valid_x; if(copy_ext->one_line) lv_ta_set_one_line(new_ta, true); /*Refresh the style with new signal function*/ @@ -250,32 +251,17 @@ bool lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) /** * Insert a character to the current cursor position * @param ta pointer to a text area object - * @param c a character (could but UTF-8 code as well: 'Á' or txt_unicode_to_utf8(0x047C) + * @param c a character */ -void lv_ta_add_char(lv_obj_t * ta, uint32_t c) +void lv_ta_add_char(lv_obj_t * ta, char c) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/ -#if TXT_UTF8 == 0 char letter_buf[2]; letter_buf[0] = c; letter_buf[1] = '\0'; -#else - /*Swap because of UTF-8 is "big-endian-like" */ - if(((c >> 8) & 0b11100000) == 0b11000000) { - c = (c & 0xFF) << 8 | ((c >> 8) & 0xFF); - } - if(((c >> 16) & 0b11110000) == 0b11100000) { - c = (c & 0xFF) << 16 | ((c >> 16) & 0xFF); - } - if(((c >> 24) & 0b11111000) == 0b11110000) { - c = ((c & 0xFF) << 24) | (((c >> 8) & 0xFF) >> 16) | (((c >> 16) & 0xFF) >> 8) | ((c >> 24) & 0xFF); - } - char letter_buf[8] = {0}; - memcpy(letter_buf, &c, txt_utf8_size(c)); -#endif lv_label_ins_text(ext->label, ext->cursor_pos, letter_buf); /*Insert the character*/ if(ext->pwd_mode != 0) { @@ -302,10 +288,6 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c) /*Move the cursor after the new character*/ lv_ta_set_cursor_pos(ta, lv_ta_get_cursor_pos(ta) + 1); - - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); - } /** @@ -316,14 +298,14 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c) void lv_ta_add_text(lv_obj_t * ta, const char * txt) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); - uint16_t txt_len = strlen(txt); + if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/ /*Insert the text*/ lv_label_ins_text(ext->label, ext->cursor_pos, txt); if(ext->pwd_mode != 0) { - ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + txt_len + 1); + ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(txt) + 1); dm_assert(ext->pwd_tmp); txt_ins(ext->pwd_tmp, ext->cursor_pos, txt); @@ -345,10 +327,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt) } /*Move the cursor after the new text*/ - lv_ta_set_cursor_pos(ta, lv_ta_get_cursor_pos(ta) + txt_len); - - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); + lv_ta_set_cursor_pos(ta, lv_ta_get_cursor_pos(ta) + txt_len(txt)); } /** @@ -360,7 +339,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_label_set_text(ext->label, txt); - lv_ta_set_cursor_pos(ta, LV_TA_CUR_LAST); + lv_ta_set_cursor_pos(ta, LV_TA_CURSOR_LAST); /*Don't let 'width == 0' because cursor will not be visible*/ if(lv_obj_get_width(ext->label) == 0) { @@ -368,9 +347,6 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) lv_obj_set_width(ext->label, font_get_width(style->text.font, ' ')); } - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); - if(ext->pwd_mode != 0) { ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(txt) + 1); strcpy(ext->pwd_tmp, txt); @@ -405,12 +381,7 @@ void lv_ta_del(lv_obj_t * ta) char * label_txt = lv_label_get_text(ext->label); /*Delete a character*/ -#if TXT_UTF8 == 0 txt_cut(label_txt, ext->cursor_pos - 1, 1); -#else - uint32_t byte_pos = txt_utf8_get_id(label_txt, ext->cursor_pos - 1); - txt_cut(label_txt, ext->cursor_pos - 1, txt_utf8_size(label_txt[byte_pos])); -#endif /*Refresh the label*/ lv_label_set_text(ext->label, label_txt); @@ -424,7 +395,7 @@ void lv_ta_del(lv_obj_t * ta) #if TXT_UTF8 == 0 txt_cut(ext->pwd_tmp, ext->cursor_pos - 1, 1); #else - uint32_t byte_pos = txt_utf8_get_id(ext->pwd_tmp, ext->cursor_pos - 1); + uint32_t byte_pos = txt_utf8_get_byte_id(ext->pwd_tmp, ext->cursor_pos - 1); txt_cut(ext->pwd_tmp, ext->cursor_pos - 1, txt_utf8_size(label_txt[byte_pos])); #endif ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 1); @@ -433,9 +404,6 @@ void lv_ta_del(lv_obj_t * ta) /*Move the cursor to the place of the deleted character*/ lv_ta_set_cursor_pos(ta, ext->cursor_pos - 1); - - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); } @@ -450,12 +418,11 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_obj_t * scrl = lv_page_get_scrl(ta); - lv_style_t * style_scrl = lv_obj_get_style(scrl); uint16_t len = txt_len(lv_label_get_text(ext->label)); if(pos < 0) pos = len + pos; - if(pos > len || pos == LV_TA_CUR_LAST) pos = len; + if(pos > len || pos == LV_TA_CURSOR_LAST) pos = len; ext->cursor_pos = pos; @@ -471,15 +438,15 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) lv_obj_get_coords(ext->label, &label_cords); /*Check the top*/ + cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS; if(lv_obj_get_y(label_par) + cur_pos.y < 0) { - lv_obj_set_y(label_par, - cur_pos.y); + lv_obj_set_y(label_par, - cur_pos.y + style->body.padding.ver); } /*Check the bottom*/ - cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS; - if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.padding.ver > ta_cords.y2) { + if(label_cords.y1 + cur_pos.y + font_h + style->body.padding.ver > ta_cords.y2) { lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) + - font_h + 2 * style_scrl->body.padding.ver)); + font_h + 2 * style->body.padding.ver)); } /*Check the left (use the font_h as general unit)*/ if(lv_obj_get_x(label_par) + cur_pos.x < font_h) { @@ -487,11 +454,13 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) } /*Check the right (use the font_h as general unit)*/ - if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.padding.hor > ta_cords.x2) { + if(label_cords.x1 + cur_pos.x + font_h + style->body.padding.hor > ta_cords.x2) { lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) + - font_h + 2 * style_scrl->body.padding.hor)); + font_h + 2 * style->body.padding.hor)); } + ext->cursor_valid_x = cur_pos.x; + /*Reset cursor blink animation*/ anim_t a; a.var = ta; @@ -521,9 +490,6 @@ void lv_ta_cursor_right(lv_obj_t * ta) uint16_t cp = lv_ta_get_cursor_pos(ta); cp++; lv_ta_set_cursor_pos(ta, cp); - - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); } /** @@ -536,9 +502,6 @@ void lv_ta_cursor_left(lv_obj_t * ta) if(cp > 0) { cp--; lv_ta_set_cursor_pos(ta, cp); - - /*It is a valid x step so save it*/ - lv_ta_save_valid_cursor_x(ta); } } @@ -561,11 +524,14 @@ void lv_ta_cursor_down(lv_obj_t * ta) pos.y += font_h + label_style->text.line_space + 1; pos.x = ext->cursor_valid_x; - /*Do not go below he last line*/ + /*Do not go below the last line*/ if(pos.y < lv_obj_get_height(ext->label)) { /*Get the letter index on the new cursor position and set it*/ uint16_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos); + + cord_t cur_valid_x_tmp = ext->cursor_valid_x; /*Cursor position set overwrites the valid positon */ lv_ta_set_cursor_pos(ta, new_cur_pos); + ext->cursor_valid_x = cur_valid_x_tmp; } } @@ -588,9 +554,12 @@ void lv_ta_cursor_up(lv_obj_t * ta) pos.y -= font_h + label_style->text.line_space - 1; pos.x = ext->cursor_valid_x; + /*Get the letter index on the new cursor position and set it*/ uint16_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos); - lv_ta_set_cursor_pos(ta, new_cur_pos); + cord_t cur_valid_x_tmp = ext->cursor_valid_x; /*Cursor position set overwrites the valid positon */ + lv_ta_set_cursor_pos(ta, new_cur_pos); + ext->cursor_valid_x = cur_valid_x_tmp; } /** @@ -781,14 +750,25 @@ lv_style_t * lv_ta_get_style_cursor(lv_obj_t * ta) } /** - * Get the password mode + * Get the password mode attribute * @param ta pointer to a text area object * @return true: password mode is enabled, false: disabled */ bool lv_ta_get_pwd_mode(lv_obj_t * ta) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); - return ext->pwd_mode; + return ext->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_ta_get_one_line(lv_obj_t * ta) +{ + lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + return ext->one_line == 0 ? false : true; } /********************** @@ -875,7 +855,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des const char * txt = lv_label_get_text(ta_ext->label); uint32_t byte_pos; #if TXT_UTF8 != 0 - byte_pos = txt_utf8_get_id(txt, cur_pos); + byte_pos = txt_utf8_get_byte_id(txt, cur_pos); #else byte_pos = cur_pos; #endif @@ -891,7 +871,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des } point_t letter_pos; - lv_label_get_letter_pos(ta_ext->label, byte_pos, &letter_pos); + lv_label_get_letter_pos(ta_ext->label, cur_pos, &letter_pos); /*If the cursor is out of the text (most right) draw it to the next line*/ if(letter_pos.x + ta_ext->label->coords.x1 + letter_w > ta_ext->label->coords.x2 && ta_ext->one_line == 0) { @@ -943,7 +923,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.hor; cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver; cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w; - cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver+ letter_h; + cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver+ letter_h; cur_style.body.empty = 1; if(cur_style.body.border.width == 0) cur_style.body.border.width = 1 << LV_ANTIALIAS; /*Be sure the border will be drawn*/ @@ -1010,16 +990,4 @@ static void pwd_char_hider(lv_obj_t * ta) } } -/** - * Save the cursor x position as valid. It is important when jumping up/down to a shorter line - * @param ta pointer to a text area object - */ -static void lv_ta_save_valid_cursor_x(lv_obj_t * ta) -{ - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); - point_t cur_pos; - lv_label_get_letter_pos(ext->label, ext->cursor_pos, &cur_pos); - ext->cursor_valid_x = cur_pos.x; -} - #endif diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index adf341b7a..dca35943e 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -32,7 +32,7 @@ extern "C" { /********************* * DEFINES *********************/ -#define LV_TA_CUR_LAST (0x7FFF) /*Put the cursor after the last character*/ +#define LV_TA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/ /********************** * TYPEDEFS @@ -97,7 +97,7 @@ bool lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); * @param ta pointer to a text area object * @param c a character */ -void lv_ta_add_char(lv_obj_t * ta, uint32_t c); +void lv_ta_add_char(lv_obj_t * ta, char c); /** * Insert a text to the current cursor position @@ -167,11 +167,13 @@ void lv_ta_set_cursor_show(lv_obj_t * ta, bool show); void lv_ta_set_cursor_type(lv_obj_t * ta, lv_ta_cursor_type_t cur_type); /** - * Set the style of the cursor (NULL to use label's style) + * Set the style of the text area * @param ta pointer to a text area object - * @param style pointer to the new cursor style + * @param bg pointer to the new background style (NULL to leave unchanged) + * @param sb pointer to the new scrollbar style (NULL to leave unchanged) + * @param cur pointer to the new cursor style (NULL to use the label's style) */ -void lv_ta_set_cursor_style(lv_obj_t * ta, lv_style_t * style); +void lv_ta_set_style(lv_obj_t * ta, lv_style_t *bg, lv_style_t *sb, lv_style_t *cur); /** * Enable/Disable password mode @@ -236,10 +238,37 @@ lv_style_t * lv_ta_get_style_cursor(lv_obj_t * ta); */ bool lv_ta_get_pwd_mode(lv_obj_t * ta); +/** + * 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_ta_get_one_line(lv_obj_t * ta); + /**************************** * TRANSPARENT API FUNCTIONS ***************************/ +/** + * Set the scroll bar mode of a text area + * @param ta pointer to a text area object + * @param sb_mode the new mode from 'lv_page_sb_mode_t' enum + */ +static inline void lv_ta_set_sb_mode(lv_obj_t * ta, lv_page_sb_mode_t mode) +{ + lv_page_set_sb_mode(ta, mode); +} + +/** + * 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 + */ +static inline lv_page_sb_mode_t lv_ta_get_sb_mode(lv_obj_t * ta) +{ + return lv_page_get_sb_mode(ta); +} + /** * Get the style of the text area background * @param ta pointer to a text area object @@ -255,11 +284,12 @@ static inline lv_style_t * lv_ta_get_style_bg(lv_obj_t * ta) * @param ta pointer to a text area object * @return pointer to the style of the scrollbars */ -static inline lv_style_t * lv_ta_get_style_scrollbar(lv_obj_t * ta) +static inline lv_style_t * lv_ta_get_style_sb(lv_obj_t * ta) { return lv_page_get_style_sb(ta); } + /********************** * MACROS **********************/