add table and btnmatrix

This commit is contained in:
Gabor Kiss-Vamosi
2021-01-05 13:01:07 +01:00
parent 9c55d77617
commit a42d3942c6
19 changed files with 931 additions and 1204 deletions
+2 -2
View File
@@ -221,7 +221,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
return lv_obj_create_from_class(&lv_obj, parent, copy);
}
lv_obj_t * lv_obj_create_from_class(lv_obj_class_t * class, lv_obj_t * parent, const lv_obj_t * copy)
lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class, lv_obj_t * parent, const lv_obj_t * copy)
{
lv_obj_t * obj = lv_mem_alloc(sizeof(lv_obj_t));
_lv_memset_00(obj, sizeof(lv_obj_t));
@@ -1301,7 +1301,7 @@ lv_obj_t * _lv_obj_get_focused_obj(const lv_obj_t * obj)
* @param obj pointer to an object which type should be get
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
*/
bool lv_obj_check_type(const lv_obj_t * obj, void * class_p)
bool lv_obj_check_type(const lv_obj_t * obj, const void * class_p)
{
return obj->class_p == class_p ? true : false;
}
+41 -11
View File
@@ -162,6 +162,7 @@ enum {
LV_STATE_PRESSED = 0x10,
LV_STATE_SCROLLED = 0x20,
LV_STATE_DISABLED = 0x40,
LV_STATE_USER = 0x80, /** Free to use by the user */
};
typedef uint8_t lv_state_t;
@@ -176,15 +177,27 @@ enum {
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1 << 6),
LV_OBJ_FLAG_SCROLL_STOP = (1 << 7),
LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /** Allow propagating the scroll to a parent */
LV_OBJ_FLAG_SNAPABLE = (1 << 9),
LV_OBJ_FLAG_PRESS_LOCK = (1 << 10),
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 11),
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 12),
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 13),
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1 << 14), /** Automatically scroll the focused object's ancestors to make the focused object visible*/
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1 << 9), /** Automatically scroll the focused object's ancestors to make the focused object visible*/
LV_OBJ_FLAG_SNAPABLE = (1 << 10),
LV_OBJ_FLAG_PRESS_LOCK = (1 << 11),
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12),
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13),
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14),
LV_OBJ_FLAG_ADV_HITTEST = (1 << 15),
LV_OBJ_FLAG_LAYOUT_1 = (1 << 16), /** Custom flag, free to use by layouts*/
LV_OBJ_FLAG_LAYOUT_2 = (1 << 17), /** Custom flag, free to use by layouts*/
LV_OBJ_FLAG_LAYOUT_3 = (1 << 18), /** Custom flag, free to use by layouts*/
LV_OBJ_FLAG_LAYOUT_4 = (1 << 19), /** Custom flag, free to use by layouts*/
LV_OBJ_FLAG_WIDGET_1 = (1 << 20), /** Custom flag, free to use by widget*/
LV_OBJ_FLAG_WIDGET_2 = (1 << 21), /** Custom flag, free to use by widget*/
LV_OBJ_FLAG_WIDGET_3 = (1 << 22), /** Custom flag, free to use by widget*/
LV_OBJ_FLAG_WIDGET_4 = (1 << 23), /** Custom flag, free to use by widget*/
LV_OBJ_FLAG_USER_1 = (1 << 24), /** Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_2 = (1 << 25), /** Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_3 = (1 << 26), /** Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_4 = (1 << 27), /** Custom flag, free to use by user*/
};
typedef uint16_t lv_obj_flag_t;
typedef uint32_t lv_obj_flag_t;
#include "lv_obj_pos.h"
@@ -253,10 +266,27 @@ enum {
LV_PART_CONTENT,
LV_PART_INDICATOR,
LV_PART_KNOB,
LV_PART_HIGHLIGHT,
LV_PART_PLACEHOLDER,
LV_PART_CURSOR,
LV_PART_HIGHLIGHT,
LV_PART_MARKER,
LV_PART_ITEM,
LV_PART_CUSTOM_1,
LV_PART_CUSTOM_2,
LV_PART_CUSTOM_3,
LV_PART_CUSTOM_4,
LV_PART_CUSTOM_5,
LV_PART_CUSTOM_6,
LV_PART_CUSTOM_7,
LV_PART_CUSTOM_8,
LV_PART_CUSTOM_9,
LV_PART_CUSTOM_10,
LV_PART_CUSTOM_11,
LV_PART_CUSTOM_12,
LV_PART_CUSTOM_13,
LV_PART_CUSTOM_14,
LV_PART_CUSTOM_15,
LV_PART_CUSTOM_16,
};
typedef uint8_t lv_part_t;
@@ -301,7 +331,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
void lv_obj_create_finish(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy);
lv_obj_t * lv_obj_create_from_class(lv_obj_class_t * class, lv_obj_t * parent, const lv_obj_t * copy);
lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class, lv_obj_t * parent, const lv_obj_t * copy);
/**
* Delete 'obj' and all of its children
@@ -683,7 +713,7 @@ bool lv_obj_hit_test(lv_obj_t * obj, lv_point_t * point);
*/
void * lv_obj_get_ext_attr(const lv_obj_t * obj);
bool lv_obj_check_type(const lv_obj_t * obj, void * class_p);
bool lv_obj_check_type(const lv_obj_t * obj, const void * class_p);
#if LV_USE_USER_DATA
/**
+3
View File
@@ -124,6 +124,9 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
if(obj->w_set == LV_SIZE_LAYOUT) w = lv_obj_get_width(obj);
if(obj->h_set == LV_SIZE_LAYOUT) h = lv_obj_get_height(obj);
obj->w_set = w;
obj->h_set = h;
/*Calculate the required auto sizes*/
bool x_auto = obj->w_set == LV_SIZE_AUTO ? true : false;
bool y_auto = obj->h_set == LV_SIZE_AUTO ? true : false;
+7 -7
View File
@@ -646,7 +646,7 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
lv_style_set_pad_right(style, value);
}
//static inline void lv_style_set_pad_ver(lv_style_t * style, lv_style_int_t value)
//static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value)
//{
// lv_style_set_pad_top(style, state, value);
// lv_style_set_pad_bottom(style, state, value);
@@ -654,7 +654,7 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
//
//static inline void lv_obj_set_style_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
// lv_style_int_t value)
// lv_coord_t value)
//{
// lv_obj_set_style_local_margin_top(obj, part, state, value);
// lv_obj_set_style_local_margin_bottom(obj, part, state, value);
@@ -663,7 +663,7 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
//}
//
//
//static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
//static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_coord_t value)
//{
// lv_style_set_margin_top(style, state, value);
// lv_style_set_margin_bottom(style, state, value);
@@ -673,14 +673,14 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
//
//
//static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
// lv_style_int_t value)
// lv_coord_t value)
//{
// lv_obj_set_style_local_margin_left(obj, part, state, value);
// lv_obj_set_style_local_margin_right(obj, part, state, value);
//}
//
//
//static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
//static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_coord_t value)
//{
// lv_style_set_margin_left(style, state, value);
// lv_style_set_margin_right(style, state, value);
@@ -688,14 +688,14 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
//
//
//static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
// lv_style_int_t value)
// lv_coord_t value)
//{
// lv_obj_set_style_local_margin_top(obj, part, state, value);
// lv_obj_set_style_local_margin_bottom(obj, part, state, value);
//}
//
//
//static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
//static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_coord_t value)
//{
// lv_style_set_margin_top(style, state, value);
// lv_style_set_margin_bottom(style, state, value);
+67 -76
View File
@@ -61,7 +61,7 @@
#define COLOR_BG_TEXT_DIS (IS_LIGHT ? lv_color_hex3(0xaaa) : lv_color_hex3(0x999))
/*SECONDARY BACKGROUND*/
#define COLOR_GRAY (IS_LIGHT ? lv_color_hex(0xd4d7d9) : lv_color_hex(0x45494d))
#define COLOR_GRAY (IS_LIGHT ? lv_color_hex(0xd4d7d9) : lv_color_hex(0x45494d))
#define COLOR_BG_SEC_BORDER (IS_LIGHT ? lv_color_hex(0xdfe7ed) : lv_color_hex(0x404040))
#define COLOR_BG_SEC_TEXT (IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex(0xa5a8ad))
#define COLOR_BG_SEC_TEXT_DIS (IS_LIGHT ? lv_color_hex(0xaaaaaa) : lv_color_hex(0xa5a8ad))
@@ -82,18 +82,17 @@ typedef struct {
lv_style_t scrollbar_scrolled;
lv_style_t card;
lv_style_t btn;
lv_style_t btn_disabled;
lv_style_t btn_color;
lv_style_t btn_color_checked;
/*Utility*/
lv_style_t bg_color_primary;
lv_style_t bg_color_secondary;
lv_style_t bg_color_gray;
lv_style_t bg_color_white;
lv_style_t pressed;
lv_style_t disabled;
lv_style_t pad_zero;
lv_style_t pad_small;
lv_style_t pad_gap;
lv_style_t pad_small_negative;
lv_style_t focus_border;
lv_style_t focus_outline;
@@ -253,22 +252,12 @@ static void basic_init(void)
style_init_reset(&styles->btn);
lv_style_set_radius(&styles->btn, RADIUS_DEFAULT);
lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER);
lv_style_set_bg_color(&styles->btn, CARD_COLOR);
lv_style_set_border_color(&styles->btn, CARD_BORDER_COLOR);
lv_style_set_border_width(&styles->btn, BORDER_WIDTH);
lv_style_set_bg_color(&styles->btn, COLOR_GRAY);
lv_style_set_text_color(&styles->btn, CARD_TEXT_COLOR);
lv_style_set_pad_hor(&styles->btn, LV_DPX(40));
lv_style_set_pad_ver(&styles->btn, LV_DPX(15));
style_init_reset(&styles->btn_color);
lv_style_set_border_width(&styles->btn_color, 0);
lv_style_set_bg_color(&styles->btn_color, BTN_COLOR);
lv_style_set_text_color(&styles->btn_color, LV_COLOR_WHITE);
style_init_reset(&styles->btn_color_checked);
lv_style_set_bg_color(&styles->btn_color_checked, BTN_CHK_PR_COLOR);
style_init_reset(&styles->pressed);
lv_style_set_color_filter_cb(&styles->pressed, lv_color_darken);
lv_style_set_color_filter_opa(&styles->pressed, LV_OPA_20);
@@ -281,8 +270,11 @@ static void basic_init(void)
lv_style_set_clip_corner(&styles->clip_corner, true);
style_init_reset(&styles->pad_small);
lv_coord_t pad_small_value = LV_DPX(10);
lv_style_set_pad_all(&styles->pad_small, pad_small_value);
lv_style_set_pad_all(&styles->pad_small, LV_DPX(10));
style_init_reset(&styles->pad_gap);
lv_style_set_pad_row(&styles->pad_gap, LV_DPX(10));
lv_style_set_pad_column(&styles->pad_gap, LV_DPX(10));
style_init_reset(&styles->pad_small_negative);
lv_style_set_pad_all(&styles->pad_small_negative, - LV_DPX(4));
@@ -295,6 +287,11 @@ static void basic_init(void)
lv_style_set_text_color(&styles->bg_color_primary, LV_COLOR_WHITE);
lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER);
style_init_reset(&styles->bg_color_secondary);
lv_style_set_bg_color(&styles->bg_color_primary, theme.color_secondary);
lv_style_set_text_color(&styles->bg_color_primary, LV_COLOR_WHITE);
lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER);
style_init_reset(&styles->bg_color_gray);
lv_style_set_bg_color(&styles->bg_color_gray, COLOR_GRAY);
lv_style_set_bg_opa(&styles->bg_color_gray, LV_OPA_COVER);
@@ -350,14 +347,6 @@ static void basic_init(void)
}
static void btnmatrix_init(void)
{
#if LV_USE_BTNMATRIX != 0
style_init_reset(&styles->btnmatrix_btn);
lv_style_set_margin_all(&styles->btnmatrix_btn, LV_STATE_DEFAULT, LV_DPX(10));
#endif
}
static void line_init(void)
@@ -501,20 +490,20 @@ static void textarea_init(void)
//}
static void table_init(void)
{
#if LV_USE_TABLE != 0
style_init_reset(&styles->table_cell);
lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, CARD_BORDER_COLOR);
lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
#endif
}
//static void table_init(void)
//{
//#if LV_USE_TABLE != 0
// style_init_reset(&styles->table_cell);
// lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, CARD_BORDER_COLOR);
// lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
// lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
// lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
// lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
// lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
// lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
//
//#endif
//}
/**********************
@@ -554,7 +543,6 @@ lv_theme_t * lv_theme_default_init(lv_color_t color_primary, lv_color_t color_se
theme.flags = flags;
basic_init();
btnmatrix_init();
line_init();
linemeter_init();
gauge_init();
@@ -562,7 +550,6 @@ lv_theme_t * lv_theme_default_init(lv_color_t color_primary, lv_color_t color_se
spinner_init();
chart_init();
textarea_init();
table_init();
theme.apply_cb = theme_apply;
@@ -593,15 +580,26 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
#if LV_USE_BTN
else if(lv_obj_check_type(obj, &lv_btn)) {
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn_color);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_primary);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->btn_color_checked);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->bg_color_secondary);
}
#endif
#if LV_USE_BTNMATRIX
else if(lv_obj_check_type(obj, &lv_btnmatrix)) {
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card);
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_gap);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_DEFAULT, &styles->btn);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_PRESSED, &styles->grow);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_PRESSED, &styles->transition_normal);
}
#endif
#if LV_USE_BAR
else if(lv_obj_check_type(obj, &lv_bar)) {
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray);
@@ -626,6 +624,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
}
#endif
#if LV_USE_TABLE
else if(lv_obj_check_type(obj, &lv_table)) {
lv_obj_add_style_no_refresh(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card);
lv_obj_add_style_no_refresh(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar);
lv_obj_add_style_no_refresh(obj, LV_PART_SCROLLBAR, LV_STATE_SCROLLED, &styles->scrollbar_scrolled);
lv_obj_add_style_no_refresh(obj, LV_PART_ITEM, LV_STATE_DEFAULT, &styles->card);
}
#endif
#if LV_USE_CHECKBOX
else if(lv_obj_check_type(obj, &lv_checkbox)) {
lv_obj_add_style_no_refresh(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->cb_marker);
@@ -682,23 +689,23 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
}
#endif
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_MAIN);
_lv_style_list_add_style(list, &styles->card);
_lv_style_list_add_style(list, &styles->pad_small);
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
_lv_style_list_add_style(list, &styles->card);
_lv_style_list_add_style(list, &styles->bg_click);
_lv_style_list_add_style(list, &styles->btnmatrix_btn);
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN_2);
_lv_style_list_add_style(list, &styles->card);
_lv_style_list_add_style(list, &styles->bg_click);
_lv_style_list_add_style(list, &styles->btnmatrix_btn);
break;
#endif
//#if LV_USE_BTNMATRIX
//case LV_THEME_BTNMATRIX:
// list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_MAIN);
// _lv_style_list_add_style(list, &styles->card);
// _lv_style_list_add_style(list, &styles->pad_small);
//
// list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
// _lv_style_list_add_style(list, &styles->card);
// _lv_style_list_add_style(list, &styles->bg_click);
// _lv_style_list_add_style(list, &styles->btnmatrix_btn);
//
// list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN_2);
// _lv_style_list_add_style(list, &styles->card);
// _lv_style_list_add_style(list, &styles->bg_click);
// _lv_style_list_add_style(list, &styles->btnmatrix_btn);
// break;
//#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
@@ -773,22 +780,6 @@ case LV_THEME_OBJMASK:
// _lv_style_list_add_style(list, &styles->chart_series);
// break;
//#endif
#if LV_USE_TABLE
case LV_THEME_TABLE: {
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->card);
int idx = 1; /* start value should be 1, not zero, since cell styles
start at 1 due to presence of LV_TABLE_PART_BG=0
in the enum (lv_table.h) */
/* declaring idx outside loop to work with older compilers */
for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
list = _lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->table_cell);
}
break;
}
#endif
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
+2 -2
View File
@@ -817,8 +817,8 @@ static void inv_arc_area(lv_obj_t * obj, uint16_t start_angle, uint16_t end_angl
lv_coord_t rout = (LV_MATH_MIN(lv_obj_get_width(obj) - left - right, lv_obj_get_height(obj) - top - bottom)) / 2;
lv_coord_t x = arc->coords.x1 + rout + left;
lv_coord_t y = arc->coords.y1 + rout + top;
lv_style_int_t w = lv_obj_get_style_line_width(obj, part);
lv_style_int_t rounded = lv_obj_get_style_line_rounded(obj, part);
lv_coord_t w = lv_obj_get_style_line_width(obj, part);
lv_coord_t rounded = lv_obj_get_style_line_rounded(obj, part);
lv_coord_t rin = rout - w;
lv_coord_t extra_area = 0;
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -42,10 +42,11 @@ enum {
LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040, /**< Button *can* be toggled. */
LV_BTNMATRIX_CTRL_CHECKED = 0x0080, /**< Button is currently toggled (e.g. checked). */
LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/
LV_BTNMATRIX_CTRL_TYPE_2 = 0x0200, /**< Render the button with `LV_BTNMATRIX_PART_BTN2` style*/
};
typedef uint16_t lv_btnmatrix_ctrl_t;
typedef bool (*lv_btnmatrix_btn_drawer_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area, const lv_area_t * clip_area);
/*Data of button matrix*/
typedef struct {
/*No inherited ext.*/ /*Ext. of ancestor*/
@@ -53,6 +54,7 @@ typedef struct {
const char ** map_p; /*Pointer to the current map*/
lv_area_t * button_areas; /*Array of areas of buttons*/
lv_btnmatrix_ctrl_t * ctrl_bits; /*Array of control bytes*/
lv_btnmatrix_btn_drawer_cb_t custom_drawer_cb;
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNMATRIX_BTN_NONE*/
uint16_t btn_id_focused; /*Index of the currently focused button or LV_BTNMATRIX_BTN_NONE*/
@@ -62,12 +64,8 @@ typedef struct {
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/
} lv_btnmatrix_ext_t;
enum {
LV_BTNMATRIX_PART_MAIN,
LV_BTNMATRIX_PART_BTN,
LV_BTNMATRIX_PART_BTN_2,
};
typedef uint8_t lv_btnmatrix_part_t;
extern const lv_obj_class_t lv_btnmatrix;
/**********************
* GLOBAL PROTOTYPES
+14 -14
View File
@@ -199,10 +199,10 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
// lv_obj_invalidate(gauge);
lv_style_int_t pad = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_NEEDLE);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t pad = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_NEEDLE);
lv_coord_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
@@ -509,11 +509,11 @@ static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part)
static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_int_t scale_width = lv_obj_get_style_scale_width(gauge, LV_GAUGE_PART_MAJOR);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t txt_pad = left;
lv_coord_t scale_width = lv_obj_get_style_scale_width(gauge, LV_GAUGE_PART_MAJOR);
lv_coord_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t txt_pad = left;
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - scale_width - txt_pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + scale_width + txt_pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + scale_width + txt_pad;
@@ -569,10 +569,10 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_int_t pad = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_NEEDLE);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t pad = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_NEEDLE);
lv_coord_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
@@ -638,7 +638,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
lv_draw_rect_dsc_t mid_dsc;
lv_draw_rect_dsc_init(&mid_dsc);
lv_obj_init_draw_rect_dsc(gauge, LV_GAUGE_PART_NEEDLE, &mid_dsc);
lv_style_int_t size = lv_obj_get_style_size(gauge, LV_GAUGE_PART_NEEDLE) / 2;
lv_coord_t size = lv_obj_get_style_size(gauge, LV_GAUGE_PART_NEEDLE) / 2;
lv_area_t nm_cord;
nm_cord.x1 = x_ofs - size;
nm_cord.y1 = y_ofs - size;
+16 -16
View File
@@ -202,8 +202,8 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
if(src_type == LV_IMG_SRC_SYMBOL) {
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
const lv_font_t * font = lv_obj_get_style_text_font(img, LV_IMG_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(img, LV_IMG_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(img, LV_IMG_PART_MAIN);
lv_coord_t letter_space = lv_obj_get_style_text_letter_space(img, LV_IMG_PART_MAIN);
lv_coord_t line_space = lv_obj_get_style_text_line_space(img, LV_IMG_PART_MAIN);
lv_point_t size;
_lv_txt_get_size(&size, src_img, font, letter_space, line_space,
LV_COORD_MAX, LV_TXT_FLAG_NONE);
@@ -274,10 +274,10 @@ void lv_img_set_pivot(lv_obj_t * img, lv_coord_t x, lv_coord_t y)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(ext->pivot.x == x && ext->pivot.y == y) return;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_coord_t w = lv_obj_get_width(img);
@@ -315,10 +315,10 @@ void lv_img_set_angle(lv_obj_t * img, int16_t angle)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(angle == ext->angle) return;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t w = lv_obj_get_width(img);
lv_coord_t h = lv_obj_get_height(img);
@@ -358,9 +358,9 @@ void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
if(zoom == 0) zoom = 1;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_coord_t w = lv_obj_get_width(img);
@@ -755,10 +755,10 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_coord_t * s = param;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
/*If the image has angle provide enough room for the rotated corners */
@@ -775,10 +775,10 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
}
/*Handle the padding of the background*/
lv_style_int_t left = lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN);
lv_coord_t left = lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN);
*s = LV_MATH_MAX(*s, left);
*s = LV_MATH_MAX(*s, right);
@@ -787,10 +787,10 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t * info = param;
lv_style_int_t zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_coord_t zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
zoom = (zoom * ext->zoom) >> 8;
lv_style_int_t angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_coord_t angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
angle += ext->angle;
/* If the object is exactly image sized (not cropped, not mosaic) and transformed
+4 -4
View File
@@ -460,10 +460,10 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*Handle the padding of the background*/
lv_style_int_t left = lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(imgbtn, LV_IMGBTN_PART_MAIN);
lv_coord_t left = lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(imgbtn, LV_IMGBTN_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(imgbtn, LV_IMGBTN_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(imgbtn, LV_IMGBTN_PART_MAIN);
lv_coord_t * s = param;
*s = LV_MATH_MAX(*s, left);
+221 -229
View File
File diff suppressed because it is too large Load Diff
+19 -36
View File
@@ -60,54 +60,37 @@ enum {
typedef uint8_t lv_label_align_t;
LV_CLASS_DECLARE_START(lv_label, lv_obj);
#define _lv_label_constructor void (*constructor)(struct _lv_obj_t * obj, struct _lv_obj_t * parent, const struct _lv_obj_t * copy)
typedef struct {
char * text;
union {
char * tmp_ptr; /* Pointer to the allocated memory containing the character replaced by dots*/
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */
} dot;
uint32_t dot_end; /*The real text length, used in dot mode*/
#if LV_USE_ANIMATION
#define LV_LABEL_ANIM_DATA uint32_t anim_speed;
#else
#define LV_LABEL_ANIM_DATA
uint32_t anim_speed;
#endif
#if LV_LABEL_LONG_TXT_HINT
#define LV_LABEL_HINT_DATA lv_draw_label_hint_t hint;
#else
#define LV_LABEL_HINT_DATA
lv_draw_label_hint_t hint;
#endif
#if LV_LABEL_TEXT_SEL
#define LV_LABEL_TEXT_SEL_DATA uint32_t sel_start; uint32_t sel_end;
#else
#define LV_LABEL_TEXT_SEL_DATA
uint32_t sel_start; uint32_t sel_end;
#endif
lv_point_t offset; /*Text draw position offset*/
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/
uint8_t static_txt : 1; /*Flag to indicate the text is static*/
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/
uint8_t recolor : 1; /*Enable in-line letter re-coloring*/
uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SROLL)*/
uint8_t dot_tmp_alloc : 1; /*1: dot_tmp has been allocated;.0: dot_tmp directly holds up to 4 bytes of characters */
}lv_label_ext_t;
#define _lv_label_data \
_lv_obj_data \
char * text; \
union { \
char * tmp_ptr; /* Pointer to the allocated memory containing the character replaced by dots*/ \
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */ \
} dot; \
uint32_t dot_end; /*The real text length, used in dot mode*/ \
LV_LABEL_ANIM_DATA /*Speed of scroll and roll animation in px/sec unit*/ \
LV_LABEL_HINT_DATA /*Used to buffer info about large text*/ \
LV_LABEL_TEXT_SEL_DATA \
lv_point_t offset; /*Text draw position offset*/ \
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/ \
uint8_t static_txt : 1; /*Flag to indicate the text is static*/ \
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/ \
uint8_t recolor : 1; /*Enable in-line letter re-coloring*/ \
uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SROLL)*/ \
uint8_t dot_tmp_alloc : 1; /*1: dot_tmp has been allocated;.0: dot_tmp directly holds up to 4 bytes of characters */ \
#define _lv_label_class_dsc \
_lv_obj_class_dsc
LV_CLASS_DECLARE_END(lv_label, lv_obj);
extern lv_label_class_t lv_label;
extern const lv_obj_class_t lv_label;
/**********************
* GLOBAL PROTOTYPES
+2 -2
View File
@@ -236,7 +236,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*The corner of the skew lines is out of the intended area*/
lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
lv_coord_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
lv_coord_t * s = param;
if(*s < line_width) *s = line_width;
}
@@ -253,7 +253,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
h = LV_MATH_MAX(ext->point_array[i].y, h);
}
lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
lv_coord_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
w += line_width;
h += line_width;
p->x = w;
+6 -6
View File
@@ -308,9 +308,9 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
lv_style_int_t left = lv_obj_get_style_pad_left(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t left = lv_obj_get_style_pad_left(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t r_out = (lv_obj_get_width(lmeter) - left - right) / 2 ;
lv_coord_t r_in = r_out - lv_obj_get_style_scale_width(lmeter, part);
@@ -335,7 +335,7 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
line_dsc.raw_end = 1;
#endif
lv_style_int_t end_line_width = lv_obj_get_style_scale_end_line_width(lmeter, part);
lv_coord_t end_line_width = lv_obj_get_style_scale_end_line_width(lmeter, part);
#if LV_LINEMETER_PRECISE > 0
lv_area_t mask_area;
@@ -467,8 +467,8 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
#endif
if(part == LV_LINEMETER_PART_MAIN && level < ext->line_cnt - 1) {
lv_style_int_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
lv_style_int_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
lv_coord_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
lv_coord_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
if(border_width || end_border_width) {
int16_t end_angle = ((level) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
+180 -330
View File
File diff suppressed because it is too large Load Diff
+6 -36
View File
@@ -28,26 +28,13 @@ extern "C" {
/*********************
* DEFINES
*********************/
#ifndef LV_TABLE_COL_MAX
#define LV_TABLE_COL_MAX 12
#endif
/*
Maximum allowable value of LV_TABLE_CELL_STYLE_CNT is 16
because of restriction of lv_table_cell_format_t.type to no more than
4 bits so that lv_table_cell_format_t.s will not exceed 8 bits
*/
#ifndef LV_TABLE_CELL_STYLE_CNT
# define LV_TABLE_CELL_STYLE_CNT 4
#endif
#if (LV_TABLE_CELL_STYLE_CNT > 16)
# error "LV_TABLE_CELL_STYLE_CNT cannot exceed 16"
#endif
/**********************
* TYPEDEFS
**********************/
typedef bool (*lv_table_cell_drawer_cb_t)(lv_obj_t * table, uint32_t row, uint32_t cell, lv_draw_rect_dsc_t * rect_draw_dsc, lv_draw_label_dsc_t * label_draw_dsc, const lv_area_t * draw_area, const lv_area_t * clip_area);
/**
* Internal table cell format structure.
*
@@ -57,7 +44,6 @@ typedef union {
struct {
uint8_t align : 2;
uint8_t right_merge : 1;
uint8_t type : 4; // upto 16 values
uint8_t crop : 1;
} s;
uint8_t format_byte;
@@ -70,20 +56,11 @@ typedef struct {
uint16_t row_cnt;
char ** cell_data;
lv_coord_t * row_h;
lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT];
lv_coord_t * col_w;
uint16_t cell_types : LV_TABLE_CELL_STYLE_CNT; /*Keep track which cell types exists to avoid dealing with unused ones*/
lv_table_cell_drawer_cb_t drawer_cb;
} lv_table_ext_t;
/*Parts of the table*/
enum {
LV_TABLE_PART_BG, /* Because of this member, LV_PART.*CELL1 has enum value of 1, */
LV_TABLE_PART_CELL1, /* LV_PART.*CELL2 has an enum value of 2 and so on upto the maximum */
LV_TABLE_PART_CELL2, /* number of styles specified by LV_TABLE_CELL_STYLE_CNT */
LV_TABLE_PART_CELL3,
LV_TABLE_PART_CELL4, /* CELL 5-16 are not needed to be defined, the values in this enum
are there for backward compatibility */
};
extern const lv_obj_class_t lv_table;
/**********************
* GLOBAL PROTOTYPES
@@ -151,15 +128,6 @@ void lv_table_set_col_width(lv_obj_t * table, uint16_t col_id, lv_coord_t w);
*/
void lv_table_set_cell_align(lv_obj_t * table, uint16_t row, uint16_t col, lv_label_align_t align);
/**
* Set the type of a cell.
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param type 1,2,3 or 4. The cell style will be chosen accordingly.
*/
void lv_table_set_cell_type(lv_obj_t * table, uint16_t row, uint16_t col, uint8_t type);
/**
* Set the cell crop. (Don't adjust the height of the cell according to its content)
* @param table pointer to a Table object
@@ -178,6 +146,8 @@ void lv_table_set_cell_crop(lv_obj_t * table, uint16_t row, uint16_t col, bool c
*/
void lv_table_set_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col, bool en);
void lv_table_set_cell_drawer(lv_obj_t * obj, lv_table_cell_drawer_cb_t drawer_cb);
/*=====================
* Getter functions
*====================*/
+11 -11
View File
@@ -1160,7 +1160,7 @@ void lv_textarea_cursor_down(lv_obj_t * ta)
/*Increment the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font);
pos.y += font_h + line_space + 1;
@@ -1192,7 +1192,7 @@ void lv_textarea_cursor_up(lv_obj_t * ta)
lv_label_get_letter_pos(ext->label, lv_textarea_get_cursor_pos(ta), &pos);
/*Decrement the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font);
pos.y -= font_h + line_space - 1;
@@ -1277,8 +1277,8 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
else if(sign == LV_SIGNAL_STYLE_CHG) {
if(ext->label) {
if(ext->one_line) {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_MAIN);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_MAIN);
/*In one line mode refresh the Text Area height because 'vpad' can modify it*/
@@ -1501,7 +1501,7 @@ static void refr_cursor_area(lv_obj_t * ta)
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
lv_coord_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_MAIN);
uint32_t cur_pos = lv_textarea_get_cursor_pos(ta);
const char * txt = lv_label_get_text(ext->label);
@@ -1549,10 +1549,10 @@ static void refr_cursor_area(lv_obj_t * ta)
ext->cursor.txt_byte_pos = byte_pos;
/*Calculate the cursor according to its type*/
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t right = lv_obj_get_style_pad_right(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t right = lv_obj_get_style_pad_right(ta, LV_TEXTAREA_PART_CURSOR);
lv_area_t cur_area;
cur_area.x1 = letter_pos.x - left;
@@ -1774,8 +1774,8 @@ static void draw_cursor(lv_obj_t * ta, const lv_area_t * clip_area)
_lv_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_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_coord_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
cur_area.x1 += left;
cur_area.y1 += top;
+5 -5
View File
@@ -72,7 +72,7 @@ static void empty_style(void)
lv_style_list_init(&style_list);
lv_res_t found;
lv_style_int_t value;
lv_coord_t value;
lv_opa_t opa;
const void * ptr;
lv_color_t color;
@@ -107,7 +107,7 @@ static void add_remove_read_prop(void)
_lv_style_list_add_style(&style_list, &style);
lv_res_t found;
lv_style_int_t value;
lv_coord_t value;
lv_opa_t opa;
const void * ptr;
lv_color_t color;
@@ -185,7 +185,7 @@ static void cascade(void)
_lv_style_list_add_style(&style_list, &style_second);
lv_res_t found;
lv_style_int_t value;
lv_coord_t value;
lv_opa_t opa;
const void * ptr;
lv_color_t color;
@@ -281,7 +281,7 @@ static void copy(void)
lv_style_copy(&style_dest, &style_src);
int16_t weight;
lv_style_int_t value;
lv_coord_t value;
weight = _lv_style_get_int(&style_dest, LV_STYLE_TEXT_LINE_SPACE, &value);
lv_test_assert_int_eq(0, weight, "Get a copied property from a style");
@@ -336,7 +336,7 @@ static void states(void)
_lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, 7);
lv_res_t found;
lv_style_int_t value;
lv_coord_t value;
found = _lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value);
lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in normal state");