mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
remove TA cursor type. Use cursor style instead.
This commit is contained in:
parent
46bf92cd93
commit
54e11bb835
@ -37,7 +37,7 @@
|
||||
#define LV_OBJX_NAME "lv_obj"
|
||||
#define LV_OBJ_DEF_WIDTH (LV_DPI)
|
||||
#define LV_OBJ_DEF_HEIGHT (2 * LV_DPI / 3)
|
||||
#define LV_DRAW_RECT_CACHE_SIZE 10
|
||||
#define LV_DRAW_RECT_CACHE_SIZE 8
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -2213,23 +2213,6 @@ void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_propert
|
||||
}
|
||||
|
||||
|
||||
void lv_obj_update_style_cache(lv_obj_t * obj)
|
||||
{
|
||||
uint8_t part_sub;
|
||||
|
||||
for(part_sub = 0; part_sub != _LV_OBJ_PART_REAL_LAST; part_sub++) {
|
||||
lv_res_t res;
|
||||
res = lv_style_cache_update(lv_obj_get_style(obj, part_sub));
|
||||
if(res == LV_RES_INV) break;
|
||||
}
|
||||
|
||||
for(part_sub = _LV_OBJ_PART_REAL_LAST; part_sub != _LV_OBJ_PART_ALL; part_sub++) {
|
||||
lv_res_t res;
|
||||
res = lv_style_cache_update(lv_obj_get_style(obj, part_sub));
|
||||
if(res == LV_RES_INV) break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------
|
||||
* Attribute get
|
||||
*----------------*/
|
||||
|
@ -146,8 +146,6 @@ void lv_style_dsc_remove_class(lv_style_dsc_t * dsc, lv_style_t * class)
|
||||
dsc->class_cnt--;
|
||||
dsc->classes = new_classes;
|
||||
}
|
||||
|
||||
lv_style_cache_update(dsc);
|
||||
}
|
||||
|
||||
void lv_style_dsc_reset(lv_style_dsc_t * style_dsc)
|
||||
@ -616,13 +614,13 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
|
||||
stat[id_to_find]++;
|
||||
|
||||
cnt++;
|
||||
if(cnt > 1000) {
|
||||
if(cnt > 100000) {
|
||||
cnt = 0;
|
||||
uint32_t i;
|
||||
|
||||
// printf("\nQuerry:\n");
|
||||
printf("\nQuerry:\n");
|
||||
for(i = 0; i < 256; i++) {
|
||||
// if(stat[i]) printf("%02x: %d\n", i, stat[i]);
|
||||
if(stat[i]) printf("%02x: %d\n", i, stat[i]);
|
||||
}
|
||||
memset(stat, 0x00, sizeof(stat));
|
||||
|
||||
|
@ -199,7 +199,7 @@ void lv_sqrt(uint32_t x, lv_sqrt_res_t * q)
|
||||
240, 244, 248, 252, 0,
|
||||
|
||||
};
|
||||
if(x <= 64) {
|
||||
if(x <= 1024) {
|
||||
x--;
|
||||
q->i = ci[x];
|
||||
q->f = cf[x];
|
||||
|
@ -187,20 +187,17 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
|
||||
if(ta) LV_ASSERT_OBJ(ta, "lv_ta");
|
||||
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
lv_cursor_type_t cur_type;
|
||||
|
||||
/*Hide the cursor of the old Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
lv_ta_set_cursor_hidden(ext->ta, true);
|
||||
}
|
||||
|
||||
ext->ta = ta;
|
||||
|
||||
/*Show the cursor of the new Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
lv_ta_set_cursor_hidden(ext->ta, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,13 +233,11 @@ void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en)
|
||||
ext->cursor_mng = en == false ? 0 : 1;
|
||||
|
||||
if(ext->ta) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
|
||||
if(ext->cursor_mng) {
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
lv_ta_set_cursor_hidden(ext->ta, false);
|
||||
} else {
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
lv_ta_set_cursor_hidden(ext->ta, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -438,17 +433,15 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
/*Show the cursor of the new Text area if cursor management is enabled*/
|
||||
/*Show the cursor of the Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
lv_cursor_type_t cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
lv_ta_set_cursor_hidden(ext->ta, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
/*Show the cursor of the new Text area if cursor management is enabled*/
|
||||
/*Show the cursor of the Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
lv_cursor_type_t cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
lv_ta_set_cursor_hidden(ext->ta, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,9 +79,8 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->range_max = 99999;
|
||||
ext->range_min = -99999;
|
||||
|
||||
lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK);
|
||||
lv_ta_set_one_line(new_spinbox, true);
|
||||
lv_ta_set_cursor_click_pos(new_spinbox, false);
|
||||
lv_ta_set_cursor_click_pos(new_spinbox, true);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(new_spinbox, lv_spinbox_signal);
|
||||
|
@ -112,7 +112,6 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->cursor.blink_time = LV_TA_DEF_CURSOR_BLINK_TIME;
|
||||
ext->cursor.pos = 0;
|
||||
ext->cursor.click_pos = 1;
|
||||
ext->cursor.type = LV_CURSOR_LINE;
|
||||
ext->cursor.valid_x = 0;
|
||||
ext->one_line = 0;
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
@ -164,7 +163,6 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->cursor.style = copy_ext->cursor.style;
|
||||
ext->cursor.pos = copy_ext->cursor.pos;
|
||||
ext->cursor.valid_x = copy_ext->cursor.valid_x;
|
||||
ext->cursor.type = copy_ext->cursor.type;
|
||||
|
||||
if(ext->pwd_mode != 0) pwd_char_hider( new_ta);
|
||||
|
||||
@ -647,18 +645,17 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cursor type.
|
||||
* Hide/Unhide the cursor.
|
||||
* @param ta pointer to a text area object
|
||||
* @param cur_type: element of 'lv_ta_cursor_type_t'
|
||||
* @param hide: true: hide the cursor
|
||||
*/
|
||||
void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type)
|
||||
void lv_ta_set_cursor_hidden(lv_obj_t * ta, bool hide)
|
||||
{
|
||||
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->cursor.type == cur_type) return;
|
||||
|
||||
ext->cursor.type = cur_type;
|
||||
ext->cursor.hidden = hide ? 1 : 0;
|
||||
|
||||
refr_cursor_area(ta);
|
||||
}
|
||||
@ -995,16 +992,16 @@ uint16_t lv_ta_get_cursor_pos(const lv_obj_t * ta)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current cursor type.
|
||||
* Get whether the cursor is hidden or not
|
||||
* @param ta pointer to a text area object
|
||||
* @return element of 'lv_ta_cursor_type_t'
|
||||
* @return true: the cursor is hidden
|
||||
*/
|
||||
lv_cursor_type_t lv_ta_get_cursor_type(const lv_obj_t * ta)
|
||||
bool lv_ta_get_cursor_hidden(const lv_obj_t * ta)
|
||||
{
|
||||
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
return ext->cursor.type;
|
||||
return ext->cursor.hidden ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1310,8 +1307,8 @@ static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t
|
||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
if(ext->cursor.type == LV_CURSOR_NONE || (ext->cursor.type & LV_CURSOR_HIDDEN) || ext->cursor.state == 0) {
|
||||
return true; /*The cursor is not visible now*/
|
||||
if(ext->cursor.hidden|| ext->cursor.state == 0) {
|
||||
return LV_DESIGN_RES_OK; /*The cursor is not visible now*/
|
||||
}
|
||||
|
||||
lv_draw_rect_dsc_t cur_dsc;
|
||||
@ -1329,20 +1326,12 @@ static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t
|
||||
cur_area.x2 += ext->label->coords.x1;
|
||||
cur_area.y2 += ext->label->coords.y1;
|
||||
|
||||
if(ext->cursor.type == LV_CURSOR_LINE) {
|
||||
lv_draw_line_dsc_t cur_line_dsc;
|
||||
lv_draw_line_dsc_init(&cur_line_dsc);
|
||||
lv_obj_init_draw_line_dsc(ta, LV_TA_PART_CURSOR, &cur_line_dsc);
|
||||
cur_dsc.bg_color = cur_line_dsc.color;
|
||||
cur_dsc.bg_opa = cur_line_dsc.opa;
|
||||
cur_dsc.bg_blend_mode = cur_line_dsc.blend_mode;
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
|
||||
} else if(ext->cursor.type == LV_CURSOR_BLOCK) {
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
|
||||
|
||||
char letter_buf[8] = {0};
|
||||
memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos]));
|
||||
char letter_buf[8] = {0};
|
||||
memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos]));
|
||||
|
||||
if(cur_dsc.bg_opa == LV_OPA_COVER) {
|
||||
lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_LEFT);
|
||||
lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_TOP);
|
||||
cur_area.x1 += left;
|
||||
@ -1352,13 +1341,6 @@ static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t
|
||||
lv_draw_label_dsc_init(&cur_label_dsc);
|
||||
lv_obj_init_draw_label_dsc(ta, LV_TA_PART_CURSOR, &cur_label_dsc);
|
||||
lv_draw_label(&cur_area, clip_area, &cur_label_dsc, letter_buf, NULL);
|
||||
|
||||
} else if(ext->cursor.type == LV_CURSOR_OUTLINE) {
|
||||
cur_dsc.bg_opa = LV_OPA_TRANSP;
|
||||
if(cur_dsc.border_width == 0) cur_dsc.border_width = 1; /*Be sure the border will be drawn*/
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
|
||||
} else if(ext->cursor.type == LV_CURSOR_UNDERLINE) {
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1470,9 +1452,11 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ta);
|
||||
lv_ta_set_cursor_type(ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
#if LV_USE_GROUP
|
||||
if(lv_obj_get_group(ta)) {
|
||||
lv_ta_set_cursor_hidden(ta, true);
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if LV_USE_GROUP
|
||||
lv_cursor_type_t cur_type;
|
||||
@ -1594,7 +1578,7 @@ static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show)
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(show != ext->cursor.state) {
|
||||
ext->cursor.state = show == 0 ? 0 : 1;
|
||||
if(ext->cursor.type != LV_CURSOR_NONE && (ext->cursor.type & LV_CURSOR_HIDDEN) == 0) {
|
||||
if(ext->cursor.hidden == 0) {
|
||||
lv_disp_t * disp = lv_obj_get_disp(ta);
|
||||
lv_area_t area_tmp;
|
||||
lv_area_copy(&area_tmp, &ext->cursor.area);
|
||||
@ -1746,46 +1730,10 @@ static void refr_cursor_area(lv_obj_t * ta)
|
||||
lv_style_int_t right = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_RIGHT);
|
||||
|
||||
lv_area_t cur_area;
|
||||
|
||||
if(ext->cursor.type == LV_CURSOR_LINE) {
|
||||
|
||||
lv_draw_line_dsc_t cur_dsc;
|
||||
lv_draw_line_dsc_init(&cur_dsc);
|
||||
lv_obj_init_draw_line_dsc(ta, LV_TA_PART_CURSOR, &cur_dsc);
|
||||
|
||||
cur_area.x1 =
|
||||
letter_pos.x + left - (cur_dsc.width >> 1) - (cur_dsc.width & 0x1);
|
||||
cur_area.y1 = letter_pos.y + top;
|
||||
cur_area.x2 = letter_pos.x + right + (cur_dsc.width >> 1);
|
||||
cur_area.y2 = letter_pos.y + bottom + letter_h;
|
||||
} else if(ext->cursor.type == LV_CURSOR_BLOCK) {
|
||||
cur_area.x1 = letter_pos.x - left;
|
||||
cur_area.y1 = letter_pos.y - top;
|
||||
cur_area.x2 = letter_pos.x + right + letter_w;
|
||||
cur_area.y2 = letter_pos.y + bottom + letter_h;
|
||||
|
||||
} else if(ext->cursor.type == LV_CURSOR_OUTLINE) {
|
||||
cur_area.x1 = letter_pos.x - left;
|
||||
cur_area.y1 = letter_pos.y - top;
|
||||
cur_area.x2 = letter_pos.x + right + letter_w;
|
||||
cur_area.y2 = letter_pos.y + bottom + letter_h;
|
||||
} else if(ext->cursor.type == LV_CURSOR_UNDERLINE) {
|
||||
lv_draw_line_dsc_t cur_dsc;
|
||||
lv_draw_line_dsc_init(&cur_dsc);
|
||||
lv_obj_init_draw_line_dsc(ta, LV_TA_PART_CURSOR, &cur_dsc);
|
||||
|
||||
|
||||
cur_area.x1 = letter_pos.x + left;
|
||||
cur_area.y1 = letter_pos.y + top + letter_h - (cur_dsc.width >> 1);
|
||||
cur_area.x2 = letter_pos.x + right + letter_w;
|
||||
cur_area.y2 = letter_pos.y + bottom + letter_h + (cur_dsc.width >> 1) +
|
||||
(cur_dsc.width & 0x1);
|
||||
} else if(ext->cursor.type == LV_CURSOR_NONE) {
|
||||
cur_area.x1 = letter_pos.x;
|
||||
cur_area.y1 = letter_pos.y;
|
||||
lv_area_set_width(&cur_area, 0);
|
||||
lv_area_set_height(&cur_area, 0);
|
||||
}
|
||||
cur_area.x1 = letter_pos.x - left;
|
||||
cur_area.y1 = letter_pos.y - top;
|
||||
cur_area.x2 = letter_pos.x + right + letter_w;
|
||||
cur_area.y2 = letter_pos.y + bottom + letter_h;
|
||||
|
||||
/*Save the new area*/
|
||||
lv_disp_t * disp = lv_obj_get_disp(ta);
|
||||
@ -1835,7 +1783,7 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->cursor.click_pos == 0) return;
|
||||
if(ext->cursor.type == LV_CURSOR_NONE) return;
|
||||
if(ext->cursor.hidden) return;
|
||||
|
||||
if(lv_indev_get_type(click_source) == LV_INDEV_TYPE_KEYPAD ||
|
||||
lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) {
|
||||
|
@ -41,17 +41,6 @@ LV_EXPORT_CONST_INT(LV_TA_CURSOR_LAST);
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/** Style of text area's cursor. */
|
||||
enum {
|
||||
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 */
|
||||
};
|
||||
typedef uint8_t lv_cursor_type_t;
|
||||
|
||||
/*Data of text area*/
|
||||
typedef struct
|
||||
{
|
||||
@ -73,8 +62,8 @@ typedef struct
|
||||
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)*/
|
||||
uint8_t hidden : 1; /*Cursor is hidden by he user */
|
||||
uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/
|
||||
} cursor;
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
@ -171,11 +160,11 @@ void lv_ta_set_placeholder_text(lv_obj_t * ta, const char * txt);
|
||||
void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos);
|
||||
|
||||
/**
|
||||
* Set the cursor type.
|
||||
* Hide/Unhide the cursor.
|
||||
* @param ta pointer to a text area object
|
||||
* @param cur_type: element of 'lv_cursor_type_t'
|
||||
* @param hide: true: hide the cursor
|
||||
*/
|
||||
void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type);
|
||||
void lv_ta_set_cursor_hidden(lv_obj_t * ta, bool hide);
|
||||
|
||||
/**
|
||||
* Enable/Disable the positioning of the the cursor by clicking the text on the text area.
|
||||
@ -316,11 +305,11 @@ lv_obj_t * lv_ta_get_label(const lv_obj_t * ta);
|
||||
uint16_t lv_ta_get_cursor_pos(const lv_obj_t * ta);
|
||||
|
||||
/**
|
||||
* Get the current cursor type.
|
||||
* Get whether the cursor is hidden or not
|
||||
* @param ta pointer to a text area object
|
||||
* @return element of 'lv_cursor_type_t'
|
||||
* @return true: the cursor is hidden
|
||||
*/
|
||||
lv_cursor_type_t lv_ta_get_cursor_type(const lv_obj_t * ta);
|
||||
bool lv_ta_get_cursor_hidden(const lv_obj_t * ta);
|
||||
|
||||
/**
|
||||
* Get whether the cursor click positioning is enabled or not.
|
||||
|
@ -107,29 +107,29 @@ static void basic_init(void)
|
||||
lv_style_set_int(&btn, LV_STYLE_PAD_TOP, LV_DPI / 20);
|
||||
lv_style_set_int(&btn, LV_STYLE_PAD_BOTTOM, LV_DPI / 20);
|
||||
lv_style_set_int(&btn, LV_STYLE_PAD_INNER, LV_DPI / 16);
|
||||
// lv_style_set_int(&btn, LV_STYLE_RADIUS, 5);
|
||||
// lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH, 2);//LV_DPI / 50 > 0 ? LV_DPI / 50 : 1);
|
||||
// lv_style_set_int(&btn, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER);
|
||||
lv_style_set_int(&btn, LV_STYLE_RADIUS, 5);
|
||||
lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH, 2);//LV_DPI / 50 > 0 ? LV_DPI / 50 : 1);
|
||||
lv_style_set_int(&btn, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER);
|
||||
lv_style_set_color(&btn, LV_STYLE_BG_COLOR, LV_COLOR_RED);
|
||||
// lv_style_set_color(&btn, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_MAROON);
|
||||
// lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR, LV_COLOR_NAVY);
|
||||
// lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR | LV_STYLE_STATE_FOCUS, LV_COLOR_AQUA);
|
||||
// lv_style_set_color(&btn, LV_STYLE_BG_GRAD_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_LIME);
|
||||
// lv_style_set_color(&btn, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED, LV_COLOR_BLUE);
|
||||
lv_style_set_color(&btn, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_MAROON);
|
||||
lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR, LV_COLOR_NAVY);
|
||||
lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR | LV_STYLE_STATE_FOCUS, LV_COLOR_AQUA);
|
||||
lv_style_set_color(&btn, LV_STYLE_BG_GRAD_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_LIME);
|
||||
lv_style_set_color(&btn, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED, LV_COLOR_BLUE);
|
||||
lv_style_set_color(&btn, LV_STYLE_TEXT_COLOR, LV_COLOR_LIME);
|
||||
// lv_style_set_color(&btn, LV_STYLE_IMAGE_RECOLOR, LV_COLOR_LIME);
|
||||
// lv_style_set_color(&btn, LV_STYLE_TEXT_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLUE);
|
||||
// lv_style_set_color(&btn, LV_STYLE_IMAGE_RECOLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLUE);
|
||||
// lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_PRESSED, &lv_font_roboto_28);
|
||||
// lv_style_set_opa(&btn, LV_STYLE_BG_OPA, LV_OPA_50);
|
||||
// lv_style_set_opa(&btn, LV_STYLE_BORDER_OPA, LV_OPA_70);
|
||||
// lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50);
|
||||
// lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6);
|
||||
// lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK);
|
||||
// lv_style_set_int(&btn, LV_STYLE_PATTERN_REPEATE | LV_STYLE_STATE_CHECKED, 1);
|
||||
// lv_style_set_int(&btn, LV_STYLE_SHADOW_WIDTH, 5);
|
||||
// lv_style_set_int(&btn, LV_STYLE_SHADOW_OFFSET_Y, 3);
|
||||
// lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_CHECKED, &lv_font_roboto_12);
|
||||
lv_style_set_color(&btn, LV_STYLE_IMAGE_RECOLOR, LV_COLOR_LIME);
|
||||
lv_style_set_color(&btn, LV_STYLE_TEXT_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLUE);
|
||||
lv_style_set_color(&btn, LV_STYLE_IMAGE_RECOLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLUE);
|
||||
lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_PRESSED, &lv_font_roboto_28);
|
||||
lv_style_set_opa(&btn, LV_STYLE_BG_OPA, LV_OPA_50);
|
||||
lv_style_set_opa(&btn, LV_STYLE_BORDER_OPA, LV_OPA_70);
|
||||
lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50);
|
||||
lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6);
|
||||
lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK);
|
||||
lv_style_set_int(&btn, LV_STYLE_PATTERN_REPEATE | LV_STYLE_STATE_CHECKED, 1);
|
||||
lv_style_set_int(&btn, LV_STYLE_SHADOW_WIDTH, 5);
|
||||
lv_style_set_int(&btn, LV_STYLE_SHADOW_OFFSET_Y, 3);
|
||||
lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_CHECKED, &lv_font_roboto_12);
|
||||
|
||||
lv_style_init(&transp_tight);
|
||||
lv_style_set_opa(&transp_tight, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
|
||||
@ -442,10 +442,13 @@ static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TA
|
||||
lv_style_init(&ta_cursor);
|
||||
lv_style_set_color(&ta_cursor, LV_STYLE_LINE_COLOR, LV_COLOR_LIME);
|
||||
lv_style_set_color(&ta_cursor, LV_STYLE_BG_COLOR, LV_COLOR_RED);
|
||||
lv_style_set_int(&ta_cursor, LV_STYLE_LINE_WIDTH, 3);
|
||||
// lv_style_set_color(&ta_cursor, LV_STYLE_LINE_COLOR, LV_COLOR_RED);
|
||||
lv_style_set_color(&ta_cursor, LV_STYLE_BORDER_COLOR, LV_COLOR_YELLOW);
|
||||
lv_style_set_color(&ta_cursor, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
lv_style_set_int(&ta_cursor, LV_STYLE_BORDER_WIDTH, 2);
|
||||
lv_style_set_int(&ta_cursor, LV_STYLE_BORDER_WIDTH, 2);
|
||||
lv_style_set_int(&ta_cursor, LV_STYLE_PAD_RIGHT, 2);
|
||||
lv_style_set_int(&ta_cursor, LV_STYLE_BORDER_PART, LV_BORDER_SIDE_LEFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user