refactor: replace lv_coord_t with int32_t

This commit is contained in:
Gabor Kiss-Vamosi
2023-10-31 19:25:01 +01:00
parent d456b1cb4d
commit a5a58e39d2
194 changed files with 2431 additions and 2434 deletions
+4 -4
View File
@@ -36,8 +36,8 @@ static void next_scene_timer_cb(lv_timer_t * timer);
static void rnd_reset(void);
static int32_t rnd_next(int32_t min, int32_t max);
static void shake_anim_y_cb(void * var, int32_t v);
static void shake_anim(lv_obj_t * obj, lv_coord_t y_max);
static void scroll_anim(lv_obj_t * obj, lv_coord_t y_max);
static void shake_anim(lv_obj_t * obj, int32_t y_max);
static void scroll_anim(lv_obj_t * obj, int32_t y_max);
static void scroll_anim_y_cb(void * var, int32_t v);
static void color_anim_cb(void * var, int32_t v);
static void color_anim(lv_obj_t * obj);
@@ -522,7 +522,7 @@ static void scroll_anim_y_cb(void * var, int32_t v)
lv_obj_scroll_to_y(var, v, LV_ANIM_OFF);
}
static void scroll_anim(lv_obj_t * obj, lv_coord_t y_max)
static void scroll_anim(lv_obj_t * obj, int32_t y_max)
{
uint32_t t = lv_anim_speed_to_time(lv_display_get_dpi(NULL), 0, y_max);
@@ -542,7 +542,7 @@ static void shake_anim_y_cb(void * var, int32_t v)
lv_obj_set_style_translate_y(var, v, 0);
}
static void shake_anim(lv_obj_t * obj, lv_coord_t y_max)
static void shake_anim(lv_obj_t * obj, int32_t y_max)
{
uint32_t t1 = rnd_next(300, 3000);
uint32_t t2 = rnd_next(300, 3000);
@@ -18,7 +18,7 @@
#define SPINBOX_UPDATE_STYLE_VALUE(item) \
do { \
lv_obj_t* sbox = ui->ctrl_pad.tab.layout.spinbox_##item; \
lv_coord_t val = lv_obj_get_style_##item(obj, LV_PART_MAIN); \
int32_t val = lv_obj_get_style_##item(obj, LV_PART_MAIN); \
lv_spinbox_set_value(sbox, val); \
} while(0)
@@ -94,7 +94,7 @@ static void ctrl_pad_btn_remove_event_handler(lv_event_t * e)
void ctrl_pad_obj_update(lv_obj_t * obj, view_t * ui)
{
lv_obj_t * spinbox = ui->ctrl_pad.tab.layout.spinbox_width;
lv_coord_t value = lv_obj_get_width(obj);
int32_t value = lv_obj_get_width(obj);
lv_spinbox_set_value(spinbox, value);
spinbox = ui->ctrl_pad.tab.layout.spinbox_height;
+5 -5
View File
@@ -101,7 +101,7 @@ static card_info_t card_info[] = {
static const void * get_imgfont_path(const lv_font_t * font,
uint32_t unicode, uint32_t unicode_next,
lv_coord_t * offset_y, void * user_data)
int32_t * offset_y, void * user_data)
{
LV_UNUSED(user_data);
LV_UNUSED(unicode_next);
@@ -164,8 +164,8 @@ void lv_demo_multilang(void)
lv_obj_set_style_bg_grad_color(lv_screen_active(), lv_color_hex(0xf9f9f9), 0);
lv_obj_set_style_bg_grad_dir(lv_screen_active(), LV_GRAD_DIR_HOR, 0);
static const lv_coord_t grid_cols[] = {LV_GRID_CONTENT, 4, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {LV_GRID_CONTENT, -10, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_cols[] = {LV_GRID_CONTENT, 4, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {LV_GRID_CONTENT, -10, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_style_init(&style_card_cont);
lv_style_set_width(&style_card_cont, lv_pct(100));
@@ -270,8 +270,8 @@ static void scroll_event_cb(lv_event_t * e)
lv_obj_t * cont = lv_event_get_target(e);
if(lv_indev_get_scroll_obj(indev) != cont) return;
lv_coord_t w = lv_obj_get_width(cont);
lv_coord_t scroll_x = lv_obj_get_scroll_x(cont) - lv_indev_scroll_throw_predict(indev, LV_DIR_HOR);
int32_t w = lv_obj_get_width(cont);
int32_t scroll_x = lv_obj_get_scroll_x(cont) - lv_indev_scroll_throw_predict(indev, LV_DIR_HOR);
if(scroll_x < w / 2) {
lv_obj_set_scroll_snap_x(cont, LV_SCROLL_SNAP_NONE);
+3 -3
View File
@@ -86,11 +86,11 @@ lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent)
lv_style_set_radius(&style_scrollbar, LV_RADIUS_CIRCLE);
lv_style_set_pad_right(&style_scrollbar, 4);
static const lv_coord_t grid_cols[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_cols[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
#if LV_DEMO_MUSIC_LARGE
static const lv_coord_t grid_rows[] = {35, 30, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {35, 30, LV_GRID_TEMPLATE_LAST};
#else
static const lv_coord_t grid_rows[] = {22, 17, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {22, 17, LV_GRID_TEMPLATE_LAST};
#endif
lv_style_init(&style_btn);
lv_style_set_bg_opa(&style_btn, LV_OPA_TRANSP);
+52 -52
View File
@@ -91,7 +91,7 @@ static const lv_font_t * font_large;
static uint32_t track_id;
static bool playing;
static bool start_anim;
static lv_coord_t start_anim_values[40];
static int32_t start_anim_values[40];
static lv_obj_t * play_obj;
static const uint16_t (* spectrum)[4];
static uint32_t spectrum_len;
@@ -120,7 +120,7 @@ static void _image_set_zoom_anim_cb(void * obj, int32_t zoom)
*/
static void _obj_set_x_anim_cb(void * obj, int32_t x)
{
lv_obj_set_x((lv_obj_t *)obj, (lv_coord_t)x);
lv_obj_set_x((lv_obj_t *)obj, (int32_t)x);
}
lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
@@ -168,19 +168,19 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
/*Arrange the content into a grid*/
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
static const lv_coord_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
0, /*Spectrum obj, set later*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
static const int32_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
0, /*Spectrum obj, set later*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
grid_rows[1] = LV_VER_RES;
@@ -192,26 +192,26 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_obj_set_grid_cell(ctrl_box, LV_GRID_ALIGN_STRETCH, 0, 1, LV_ALIGN_CENTER, 6, 1);
lv_obj_set_grid_cell(handle_box, LV_GRID_ALIGN_STRETCH, 0, 1, LV_ALIGN_CENTER, 8, 1);
#elif LV_DEMO_MUSIC_LANDSCAPE == 0
static const lv_coord_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
static const int32_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
# if LV_DEMO_MUSIC_LARGE == 0
250, /*Spectrum obj*/
250, /*Spectrum obj*/
# else
480, /*Spectrum obj*/
480, /*Spectrum obj*/
# endif
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_GRID_FR(1), /*Spacer*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_GRID_FR(1), /*Spacer*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
@@ -222,20 +222,20 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_obj_set_grid_cell(handle_box, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 10, 1);
#else
/*Arrange the content into a grid*/
static const lv_coord_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_GRID_FR(1), /*Spacer*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
static const int32_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Title box*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Icon box*/
LV_GRID_FR(3), /*Spacer*/
LV_GRID_CONTENT, /*Control box*/
LV_GRID_FR(1), /*Spacer*/
LV_GRID_CONTENT, /*Handle box*/
LV_GRID_FR(1), /*Spacer*/
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
LV_GRID_TEMPLATE_LAST
};
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
@@ -563,8 +563,8 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent)
#else
lv_obj_set_style_pad_bottom(cont, 8, 0);
#endif
static const lv_coord_t grid_col[] = {LV_GRID_FR(2), LV_GRID_FR(3), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_row[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_col[] = {LV_GRID_FR(2), LV_GRID_FR(3), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static const int32_t grid_row[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(cont, grid_col, grid_row);
LV_IMAGE_DECLARE(img_lv_demo_music_btn_loop);
@@ -803,11 +803,11 @@ static void spectrum_draw_event_cb(lv_event_t * e)
uint16_t r[64];
uint32_t i;
lv_coord_t min_a = 5;
int32_t min_a = 5;
#if LV_DEMO_MUSIC_LARGE == 0
lv_coord_t r_in = 1;
int32_t r_in = 1;
#else
lv_coord_t r_in = 160;
int32_t r_in = 160;
#endif
r_in = (r_in * lv_image_get_zoom(album_image_obj)) >> 8;
for(i = 0; i < BAR_CNT; i++) r[i] = r_in + min_a + 77;
@@ -929,7 +929,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
static void start_anim_cb(void * a, int32_t v)
{
lv_coord_t * av = a;
int32_t * av = a;
*av = v;
lv_obj_invalidate(spectrum_obj);
}
+18 -18
View File
@@ -33,9 +33,9 @@ typedef struct {
* STATIC PROTOTYPES
**********************/
static lv_opa_t opa_saved;
static void add_to_cell(lv_obj_t * obj, lv_coord_t col, lv_coord_t row);
static void add_to_cell(lv_obj_t * obj, int32_t col, int32_t row);
static lv_obj_t * fill_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row)
static lv_obj_t * fill_obj_create(lv_obj_t * parent, int32_t col, int32_t row)
{
lv_color_t colors[] = {lv_color_hex3(0x000),
lv_color_hex3(0xfff),
@@ -113,7 +113,7 @@ static void fill_cb(lv_obj_t * parent)
}
}
static lv_obj_t * border_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row)
static lv_obj_t * border_obj_create(lv_obj_t * parent, int32_t col, int32_t row)
{
lv_obj_t * obj = lv_obj_create(parent);
@@ -209,7 +209,7 @@ static void border_cb(lv_obj_t * parent)
}
}
static lv_obj_t * box_shadow_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row)
static lv_obj_t * box_shadow_obj_create(lv_obj_t * parent, int32_t col, int32_t row)
{
lv_obj_t * obj = lv_obj_create(parent);
lv_obj_remove_style_all(obj);
@@ -225,8 +225,8 @@ static lv_obj_t * box_shadow_obj_create(lv_obj_t * parent, lv_coord_t col, lv_co
static void box_shadow_cb(lv_obj_t * parent)
{
static const lv_coord_t grid_rows[] = {45, 45, 45, 45, 45, 45, LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_cols[] = {68, 68, 68, 68, 68, 68, 68, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {45, 45, 45, 45, 45, 45, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_cols[] = {68, 68, 68, 68, 68, 68, 68, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(parent, grid_cols, grid_rows);
lv_point_t ofs[] = {
@@ -275,7 +275,7 @@ static void box_shadow_cb(lv_obj_t * parent)
}
static lv_obj_t * text_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row)
static lv_obj_t * text_obj_create(lv_obj_t * parent, int32_t col, int32_t row)
{
lv_obj_t * obj = lv_label_create(parent);
@@ -314,7 +314,7 @@ static void text_cb(lv_obj_t * parent)
}
static lv_obj_t * image_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row, bool recolor)
static lv_obj_t * image_obj_create(lv_obj_t * parent, int32_t col, int32_t row, bool recolor)
{
lv_obj_t * obj = lv_image_create(parent);
lv_obj_remove_style_all(obj);
@@ -407,7 +407,7 @@ static void image_recolored_cb(lv_obj_t * parent)
}
static lv_obj_t * line_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row, lv_point_precise_t p[])
static lv_obj_t * line_obj_create(lv_obj_t * parent, int32_t col, int32_t row, lv_point_precise_t p[])
{
lv_obj_t * obj = lv_line_create(parent);
lv_obj_remove_style_all(obj);
@@ -434,7 +434,7 @@ static void line_cb(lv_obj_t * parent)
{{DEF_WIDTH - 5, 5}, {5, DEF_HEIGHT - 5}}, /* / */
};
lv_coord_t widths[] = {1, 3, 5, 10};
int32_t widths[] = {1, 3, 5, 10};
uint32_t r;
for(r = 0; r < 2; r++) {
@@ -450,7 +450,7 @@ static void line_cb(lv_obj_t * parent)
}
}
static lv_obj_t * arc_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row, lv_coord_t w,
static lv_obj_t * arc_obj_create(lv_obj_t * parent, int32_t col, int32_t row, int32_t w,
lv_value_precise_t start, lv_value_precise_t end)
{
lv_obj_t * obj = lv_arc_create(parent);
@@ -478,7 +478,7 @@ static void arc_core_cb(lv_obj_t * parent, const void * img_src)
{0, 360},
};
lv_coord_t widths[] = {1, 5, 10, 100};
int32_t widths[] = {1, 5, 10, 100};
uint32_t r;
for(r = 0; r < 2; r++) {
@@ -538,7 +538,7 @@ static void triangle_draw_event_cb(lv_event_t * e)
}
static lv_obj_t * triangle_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row, lv_point_t p[])
static lv_obj_t * triangle_obj_create(lv_obj_t * parent, int32_t col, int32_t row, lv_point_t p[])
{
lv_obj_t * obj = lv_arc_create(parent);
lv_obj_remove_style_all(obj);
@@ -613,7 +613,7 @@ static void triangle_cb(lv_obj_t * parent)
}
static lv_obj_t * layer_obj_create(lv_obj_t * parent, lv_coord_t col, lv_coord_t row, lv_blend_mode_t blend_mode)
static lv_obj_t * layer_obj_create(lv_obj_t * parent, int32_t col, int32_t row, lv_blend_mode_t blend_mode)
{
lv_obj_t * obj = lv_obj_create(parent);
lv_obj_remove_style_all(obj);
@@ -642,7 +642,7 @@ static void layer_core_cb(lv_obj_t * parent, lv_blend_mode_t blend_mode)
uint32_t i;
for(i = 0; i < 2; i++) {
lv_coord_t row = 4 * i;
int32_t row = 4 * i;
lv_obj_t * obj;
obj = layer_obj_create(parent, 0, row, blend_mode);
@@ -752,8 +752,8 @@ void lv_demo_render(lv_demo_render_scene_t id, lv_opa_t opa)
lv_obj_set_style_bg_color(main_parent, lv_color_hex3(0xaaf), 0);
lv_obj_set_size(main_parent, 480, 272);
static const lv_coord_t grid_cols[] = {60, 60, 60, 60, 60, 60, 60, 60, LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {34, 34, 34, 34, 34, 34, 34, 34, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_cols[] = {60, 60, 60, 60, 60, 60, 60, 60, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {34, 34, 34, 34, 34, 34, 34, 34, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(main_parent, grid_cols, grid_rows);
opa_saved = opa;
@@ -772,7 +772,7 @@ const char * lv_demo_render_get_scene_name(lv_demo_render_scene_t id)
* STATIC FUNCTIONS
**********************/
static void add_to_cell(lv_obj_t * obj, lv_coord_t col, lv_coord_t row)
static void add_to_cell(lv_obj_t * obj, int32_t col, int32_t row)
{
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_CENTER, col, 1, LV_GRID_ALIGN_CENTER, row, 1);
}
+3 -3
View File
@@ -48,8 +48,8 @@ LV_IMAGE_DECLARE(img_transform_avatar_15)
**********************/
void lv_demo_transform(void)
{
static const lv_coord_t grid_cols[] = {LV_GRID_CONTENT, 4, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {LV_GRID_CONTENT, -10, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static const int32_t grid_cols[] = {LV_GRID_CONTENT, 4, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t grid_rows[] = {LV_GRID_CONTENT, -10, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_style_init(&style_card);
lv_style_set_width(&style_card, 300);
@@ -87,7 +87,7 @@ void lv_demo_transform(void)
card_to_transform = card_create();
lv_obj_center(card_to_transform);
lv_coord_t disp_w = lv_display_get_horizontal_resolution(NULL);
int32_t disp_w = lv_display_get_horizontal_resolution(NULL);
lv_obj_t * arc = lv_arc_create(lv_screen_active());
lv_obj_set_size(arc, disp_w - 20, disp_w - 20);
lv_arc_set_range(arc, 0, 270);
+48 -48
View File
@@ -105,7 +105,7 @@ void lv_demo_widgets(void)
font_large = LV_FONT_DEFAULT;
font_normal = LV_FONT_DEFAULT;
lv_coord_t tab_h;
int32_t tab_h;
if(disp_size == DISP_LARGE) {
tab_h = 70;
#if LV_FONT_MONTSERRAT_24
@@ -346,15 +346,15 @@ static void profile_create(lv_obj_t * parent)
lv_obj_t * sw2 = lv_switch_create(panel3);
if(disp_size == DISP_LARGE) {
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
/*Create the top panel*/
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_CONTENT, LV_GRID_FR(2), LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_1_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, 10, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static int32_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_CONTENT, LV_GRID_FR(2), LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_1_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, 10, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_2_row_dsc[] = {
static int32_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_2_row_dsc[] = {
LV_GRID_CONTENT, /*Title*/
5, /*Separator*/
LV_GRID_CONTENT, /*Box title*/
@@ -405,13 +405,13 @@ static void profile_create(lv_obj_t * parent)
lv_obj_set_grid_cell(team_player_label, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_START, 5, 1);
}
else if(disp_size == DISP_MEDIUM) {
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
/*Create the top panel*/
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 1, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_1_row_dsc[] = {
static int32_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 1, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_1_row_dsc[] = {
LV_GRID_CONTENT, /*Name*/
LV_GRID_CONTENT, /*Description*/
LV_GRID_CONTENT, /*Email*/
@@ -421,8 +421,8 @@ static void profile_create(lv_obj_t * parent)
LV_GRID_TEMPLATE_LAST
};
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_2_row_dsc[] = {
static int32_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_2_row_dsc[] = {
LV_GRID_CONTENT, /*Title*/
5, /*Separator*/
LV_GRID_CONTENT, /*Box title*/
@@ -477,28 +477,28 @@ static void profile_create(lv_obj_t * parent)
lv_obj_set_grid_cell(sw1, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 7, 1);
}
else if(disp_size == DISP_SMALL) {
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(parent, grid_main_col_dsc, grid_main_row_dsc);
/*Create the top panel*/
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_1_row_dsc[] = {LV_GRID_CONTENT, /*Avatar*/
LV_GRID_CONTENT, /*Name*/
LV_GRID_CONTENT, /*Description*/
LV_GRID_CONTENT, /*Email*/
LV_GRID_CONTENT, /*Phone number*/
LV_GRID_CONTENT, /*Button1*/
LV_GRID_CONTENT, /*Button2*/
LV_GRID_TEMPLATE_LAST
};
static int32_t grid_1_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_1_row_dsc[] = {LV_GRID_CONTENT, /*Avatar*/
LV_GRID_CONTENT, /*Name*/
LV_GRID_CONTENT, /*Description*/
LV_GRID_CONTENT, /*Email*/
LV_GRID_CONTENT, /*Phone number*/
LV_GRID_CONTENT, /*Button1*/
LV_GRID_CONTENT, /*Button2*/
LV_GRID_TEMPLATE_LAST
};
lv_obj_set_grid_dsc_array(panel1, grid_1_col_dsc, grid_1_row_dsc);
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_2_row_dsc[] = {
static int32_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_2_row_dsc[] = {
LV_GRID_CONTENT, /*Title*/
5, /*Separator*/
LV_GRID_CONTENT, /*Box title*/
@@ -554,8 +554,8 @@ static void profile_create(lv_obj_t * parent)
static lv_obj_t * create_chart_with_scales(lv_obj_t * parent, const char * title, const char * hor_text[])
{
static const lv_coord_t col_dsc[] = {40, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), 40, LV_GRID_TEMPLATE_LAST};
static const int32_t col_dsc[] = {40, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), 40, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(parent, col_dsc, row_dsc);
lv_obj_set_style_pad_column(parent, 0, 0);
@@ -653,7 +653,7 @@ static void analytics_create(lv_obj_t * parent)
if(disp_size < DISP_LARGE) lv_obj_add_flag(lv_obj_get_parent(scale3), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
lv_obj_update_layout(parent);
lv_coord_t scale_w;
int32_t scale_w;
if(disp_size == DISP_MEDIUM) {
scale_w = 200;
lv_obj_set_size(scale1, scale_w, scale_w);
@@ -907,8 +907,8 @@ void shop_create(lv_obj_t * parent)
lv_chart_set_next_value(chart3, ser4, lv_rand(60, 90));
if(disp_size == DISP_LARGE) {
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid1_row_dsc[] = {
static int32_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid1_row_dsc[] = {
LV_GRID_CONTENT, /*Title*/
LV_GRID_CONTENT, /*Sub title*/
20, /*Spacer*/
@@ -929,8 +929,8 @@ void shop_create(lv_obj_t * parent)
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, 0, 5);
}
else if(disp_size == DISP_MEDIUM) {
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid1_row_dsc[] = {
static int32_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid1_row_dsc[] = {
LV_GRID_CONTENT, /*Title + Date*/
LV_GRID_CONTENT, /*Amount + Hint*/
200, /*Chart*/
@@ -949,8 +949,8 @@ void shop_create(lv_obj_t * parent)
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_END, 0, 2, LV_GRID_ALIGN_STRETCH, 2, 1);
}
else if(disp_size == DISP_SMALL) {
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid1_row_dsc[] = {
static int32_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid1_row_dsc[] = {
LV_GRID_CONTENT, /*Title*/
LV_GRID_CONTENT, /*Date*/
LV_GRID_CONTENT, /*Amount*/
@@ -1095,8 +1095,8 @@ static void color_changer_create(lv_obj_t * parent)
static void color_changer_anim_cb(void * var, int32_t v)
{
lv_obj_t * obj = var;
lv_coord_t max_w = lv_obj_get_width(lv_obj_get_parent(obj)) - LV_DPX(20);
lv_coord_t w;
int32_t max_w = lv_obj_get_width(lv_obj_get_parent(obj)) - LV_DPX(20);
int32_t w;
if(disp_size == DISP_SMALL) {
w = lv_map(v, 0, 256, LV_DPX(52), max_w);
@@ -1215,8 +1215,8 @@ static lv_obj_t * create_scale_box(lv_obj_t * parent, const char * title, const
lv_label_set_text(label3, text3);
if(disp_size == DISP_MEDIUM) {
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST};
static int32_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(cont, grid_col_dsc, grid_row_dsc);
lv_obj_set_grid_cell(title_label, LV_GRID_ALIGN_START, 0, 4, LV_GRID_ALIGN_START, 0, 1);
@@ -1229,8 +1229,8 @@ static lv_obj_t * create_scale_box(lv_obj_t * parent, const char * title, const
lv_obj_set_grid_cell(label3, LV_GRID_ALIGN_STRETCH, 3, 1, LV_GRID_ALIGN_CENTER, 4, 1);
}
else {
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static int32_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(cont, grid_col_dsc, grid_row_dsc);
lv_obj_set_grid_cell(title_label, LV_GRID_ALIGN_START, 0, 2, LV_GRID_ALIGN_START, 0, 1);
lv_obj_set_grid_cell(scale, LV_GRID_ALIGN_START, 0, 2, LV_GRID_ALIGN_START, 1, 1);
@@ -1247,8 +1247,8 @@ static lv_obj_t * create_scale_box(lv_obj_t * parent, const char * title, const
static lv_obj_t * create_shop_item(lv_obj_t * parent, const void * img_src, const char * name, const char * category,
const char * price)
{
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_row_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t grid_row_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
lv_obj_t * cont = lv_obj_create(parent);
lv_obj_remove_style_all(cont);
@@ -1356,7 +1356,7 @@ static void slider_event_cb(lv_event_t * e)
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
lv_coord_t * s = lv_event_get_param(e);
int32_t * s = lv_event_get_param(e);
*s = LV_MAX(*s, 60);
}
else if(code == LV_EVENT_DRAW_TASK_ADDED) {
@@ -1428,9 +1428,9 @@ static void chart_event_cb(lv_event_t * e)
tri_dsc.p[2].y = (int32_t)LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y);
tri_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
lv_coord_t full_h = lv_obj_get_height(obj);
lv_coord_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
lv_coord_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
int32_t full_h = lv_obj_get_height(obj);
int32_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
int32_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
tri_dsc.bg_grad.stops[0].color = ser->color;
tri_dsc.bg_grad.stops[0].opa = 255 - fract_uppter;
tri_dsc.bg_grad.stops[0].frac = 0;
+4 -4
View File
@@ -21,7 +21,7 @@ Naming and API
`LINK <https://github.com/lvgl/lvgl/pull/3390#discussion_r885915769>`__
- |check| Replace `disp_drv->direct_mode/full_refresh` with enum.
- |check| Consider flat directory structure. E.g. `extra/widgets` to `widgets`
- |uncheck| Use `uint32_t` and `int32_t` in APIs where possible. Consider hardcoding `lv_coord_t` as `int32_t`.
- |uncheck| Use `uint32_t` and `int32_t` in APIs where possible. Consider hardcoding `int32_t` as `int32_t`.
- |check| To define a new stdlib API use defines `LV_USE_CUSTOM_...` and
let the user implement `lv_...` functions somewhere (instead of defining the name of the custom functions)
(see `here <https://github.com/lvgl/lvgl/issues/3481#issuecomment-1206434501>`__)
@@ -45,12 +45,12 @@ Architecture
- |check| Drop `lv_mem_buf_get` as tlsf should be fast enough for normal allocations too.
Fragmentation is also lower if processes can completely clean up after themselves.
- |check| More color formats: 24 bit, ARGB1555, ARGB4444 etc
(see `here <https://forum.lvgl.io/t/keypad-input-device-why-lv-event-long-pressed-only-on-enter/10263>`__)
(see `here <https://forum.lvgl.io/t/keypad-input-device-why-lv-event-long-pressed-only-on-enter/10263>`__)
- |check| Unified caching #3116 #3415
- |check| Variable binding. I.e create properties which can be bound to objects and those objects are notified on value change. Maybe based on `lv_msg`?
- |uncheck| Add GPU abstraction for display rotation
- |uncheck| Add GPU abstraction for display rotation
- |check| Replace the `read_line_cb` of the image decoders with `get_area_cb`
- |check| Limit the image caching size in bytes instead of image count
- |check| Limit the image caching size in bytes instead of image count
- |check| lv_draw_buf for unified stride, buffer and cache invalidation management. `4241 <https://github.com/lvgl/lvgl/pull/4241>`__
- |uncheck| SVG support: integrate an SVG render library `4388 <https://github.com/lvgl/lvgl/issues/4388>`__
- |uncheck| Introduce optional ``float`` support. `4648 <https://github.com/lvgl/lvgl/issues/4648>`__
+2 -2
View File
@@ -43,8 +43,8 @@ For example:
.. code:: c
static lv_coord_t column_dsc[] = {100, 400, LV_GRID_TEMPLATE_LAST}; /*2 columns with 100 and 400 ps width*/
static lv_coord_t row_dsc[] = {100, 100, 100, LV_GRID_TEMPLATE_LAST}; /*3 100 px tall rows*/
static int32_t column_dsc[] = {100, 400, LV_GRID_TEMPLATE_LAST}; /*2 columns with 100 and 400 ps width*/
static int32_t row_dsc[] = {100, 100, 100, LV_GRID_TEMPLATE_LAST}; /*3 100 px tall rows*/
To set the descriptors on a parent use
:c:expr:`lv_obj_set_grid_dsc_array(obj, col_dsc, row_dsc)`.
+4 -4
View File
@@ -256,10 +256,10 @@ the following functions:
.. code:: c
lv_coord_t w = lv_obj_get_width(obj);
lv_coord_t h = lv_obj_get_height(obj);
lv_coord_t content_w = lv_obj_get_content_width(obj);
lv_coord_t content_h = lv_obj_get_content_height(obj);
int32_t w = lv_obj_get_width(obj);
int32_t h = lv_obj_get_height(obj);
int32_t content_w = lv_obj_get_content_width(obj);
int32_t content_h = lv_obj_get_content_height(obj);
Using styles
************
+8 -8
View File
@@ -73,7 +73,7 @@ draw the button under the text and it's not necessary to redraw the
display under the rest of the button too.
The difference between buffering modes regarding the drawing mechanism
is the following:
is the following:
1. **One buffer** - LVGL needs to wait for :cpp:func:`lv_disp_flush_ready` (called from ``flush_cb``) before starting to redraw the next part.
2. **Two buffers** - LVGL can immediately draw to the second buffer when the first is sent to ``flush_cb`` because the
@@ -128,14 +128,14 @@ applied real-time:
- :cpp:enumerator:`LV_DRAW_MASK_TYPE_MAP`: The mask is stored in a bitmap array and the
necessary parts are applied
Masks are used to create almost every basic primitive:
Masks are used to create almost every basic primitive:
- **letters**: Create a mask from the letter and draw a rectangle with the letter's color using the mask.
- **line**: Created from four "line masks" to mask out the left, right, top and bottom part of the line to get a perfectly perpendicular perimeter.
- **rounded rectangle**: A mask is created real-time to add a radius to the corners.
- **clip corner**: To clip overflowing content (usually children) on rounded corners, a rounded rectangle mask is also applied.
- **rectangle border**: Same as a rounded rectangle but the inner part is masked out too.
- **arc drawing**: A circular border is drawn but an arc mask is applied too.
- **line**: Created from four "line masks" to mask out the left, right, top and bottom part of the line to get a perfectly perpendicular perimeter.
- **rounded rectangle**: A mask is created real-time to add a radius to the corners.
- **clip corner**: To clip overflowing content (usually children) on rounded corners, a rounded rectangle mask is also applied.
- **rectangle border**: Same as a rounded rectangle but the inner part is masked out too.
- **arc drawing**: A circular border is drawn but an arc mask is applied too.
- **ARGB images**: The alpha channel is separated into a mask and the image is drawn as a normal RGB image.
Using masks
@@ -287,7 +287,7 @@ documentation.
uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/
uint32_t part; /**< The current part for which the event is sent*/
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
int32_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
} lv_obj_draw_part_dsc_t;
+1 -1
View File
@@ -107,7 +107,7 @@ Drawing events
--------------
- :cpp:enumerator:`LV_EVENT_COVER_CHECK`: Check if an object fully covers an area. The event parameter is :cpp:struct:`lv_cover_check_info_t` ``*``.
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around an object (e.g. for a shadow). The event parameter is :cpp:type:`lv_coord_t` ``*`` to store the size. Only overwrite it with a larger value.
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around an object (e.g. for a shadow). The event parameter is :cpp:type:`int32_t` ``*`` to store the size. Only overwrite it with a larger value.
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_BEGIN`: Starting the main drawing phase.
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN`: Perform the main drawing
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_END`: Finishing the main drawing phase
+8 -8
View File
@@ -354,12 +354,12 @@ to open is an animation.
Image post-processing
---------------------
Considering that some hardware has special requirements for image formats,
such as alpha premultiplication and stride alignment, most image decoders (such as PNG decoders)
may not directly output image data that meets hardware requirements.
Considering that some hardware has special requirements for image formats,
such as alpha premultiplication and stride alignment, most image decoders (such as PNG decoders)
may not directly output image data that meets hardware requirements.
For this reason, LVGL provides a solution for image post-processing.
First, call a custom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
For this reason, LVGL provides a solution for image post-processing.
First, call a custom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
and then mark the processing status in ``cache_entry->process_state`` (to avoid repeated post-processing).
See the detailed code below:
@@ -402,8 +402,8 @@ See the detailed code below:
}
if(!(entry->process_state & IMAGE_PROCESS_STATE_STRIDE_ALIGNED)) {
lv_coord_t image_w = dsc->header.w;
lv_coord_t image_h = dsc->header.h;
int32_t image_w = dsc->header.w;
int32_t image_h = dsc->header.h;
uint32_t width_byte = image_w * lv_color_format_get_size(color_format);
uint32_t stride = lv_draw_buf_width_to_stride(image_w, color_format);
@@ -426,7 +426,7 @@ See the detailed code below:
/* Copy image data */
const uint8_t * cur = ori_image;
for(lv_coord_t y = 0; y < image_h; y++) {
for(int32_t y = 0; y < image_h; y++) {
lv_memcpy(new_image, cur, width_byte);
new_image += stride;
cur += width_byte;
+7 -7
View File
@@ -176,14 +176,14 @@ can do custom GPU operations. Here is a complete example:
dsc->blend_mode == LV_BLEND_MODE_NORMAL && lv_area_get_size(&blend_area) > 100) {
/*Got the first pixel on the buffer*/
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area); /*Width of the destination buffer*/
int32_t dest_stride = lv_area_get_width(draw_ctx->buf_area); /*Width of the destination buffer*/
lv_color_t * dest_buf = draw_ctx->buf;
dest_buf += dest_stride * (blend_area.y1 - draw_ctx->buf_area->y1) + (blend_area.x1 - draw_ctx->buf_area->x1);
/*Make the blend area relative to the buffer*/
/*Make the blend area relative to the buffer*/
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
/*Call your custom gou fill function to fill blend_area, on dest_buf with dsc->color*/
/*Call your custom gou fill function to fill blend_area, on dest_buf with dsc->color*/
my_gpu_fill(dest_buf, dest_stride, &blend_area, dsc->color);
}
/*Fallback: the GPU doesn't support these settings. Call the SW renderer.*/
@@ -199,7 +199,7 @@ The implementation of wait callback is much simpler:
void my_gpu_wait(lv_draw_ctx_t * draw_ctx)
{
while(my_gpu_is_working());
/*Call SW renderer's wait callback too*/
lv_draw_sw_wait_for_finish(draw_ctx);
}
@@ -220,12 +220,12 @@ rectangles you can replace the original software drawer too. A custom
{
/*Draw the background*/
my_bg_drawer(draw_ctx, coords, dsc->bg_color, dsc->radius);
/*Draw the border if any*/
if(dsc->border_width) {
my_border_drawer(draw_ctx, coords, dsc->border_width, dsc->border_color, dsc->border_opa)
}
/*Draw the outline if any*/
if(dsc->outline_width) {
my_outline_drawer(draw_ctx, coords, dsc->outline_width, dsc->outline_color, dsc->outline_opa, dsc->outline_pad)
+1 -1
View File
@@ -69,7 +69,7 @@ an array for the data points. ``axis`` can have the following values:
:cpp:expr:`lv_chart_set_ext_y_array(chart, ser, value_array)` makes the chart
use an external array for the given series. ``value_array`` should look
like this: ``lv_coord_t * value_array[num_points]``. The array size
like this: ``int32_t * value_array[num_points]``. The array size
needs to be large enough to hold all the points of that series. The
array's pointer will be saved in the chart so it needs to be global,
static or dynamically allocated. Note: you should call
+2 -2
View File
@@ -36,8 +36,8 @@ static void anim_x_cb(void * var, int32_t v);
*/
void lv_example_anim_3(void)
{
static lv_coord_t col_dsc[] = {LV_GRID_FR(1), 200, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {LV_GRID_FR(1), 200, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
+2 -2
View File
@@ -7,8 +7,8 @@ static lv_obj_t * obj1 = NULL;
static lv_obj_t * obj2 = NULL;
static lv_obj_t * obj3 = NULL;
static const lv_coord_t obj_width = 90;
static const lv_coord_t obj_height = 70;
static const int32_t obj_width = 90;
static const int32_t obj_height = 70;
static void set_width(void * var, int32_t v)
{
+2 -2
View File
@@ -6,8 +6,8 @@
*/
void lv_example_grid_1(void)
{
static lv_coord_t col_dsc[] = {70, 70, 70, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {70, 70, 70, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
+2 -2
View File
@@ -7,8 +7,8 @@
*/
void lv_example_grid_2(void)
{
static lv_coord_t col_dsc[] = {70, 70, 70, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {70, 70, 70, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
+2 -2
View File
@@ -9,12 +9,12 @@ void lv_example_grid_3(void)
/*Column 1: fix width 60 px
*Column 2: 1 unit from the remaining free space
*Column 3: 2 unit from the remaining free space*/
static lv_coord_t col_dsc[] = {60, LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {60, LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
/*Row 1: fix width 50 px
*Row 2: 1 unit from the remaining free space
*Row 3: fix width 50 px*/
static lv_coord_t row_dsc[] = {50, LV_GRID_FR(1), 50, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {50, LV_GRID_FR(1), 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
+2 -2
View File
@@ -6,8 +6,8 @@
*/
void lv_example_grid_4(void)
{
static lv_coord_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
/*Add space between the columns and move the rows to the bottom (end)*/
+2 -2
View File
@@ -18,8 +18,8 @@ void lv_example_grid_5(void)
{
/*60x60 cells*/
static lv_coord_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
+2 -2
View File
@@ -7,8 +7,8 @@
void lv_example_grid_6(void)
{
static lv_coord_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
static int32_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
static int32_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_screen_active());
@@ -38,8 +38,8 @@ void lv_example_fragment_2(void)
lv_obj_t * root = lv_obj_create(lv_screen_active());
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
lv_obj_set_layout(root, LV_LAYOUT_GRID);
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t row_dsc[] = {LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
static const int32_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const int32_t row_dsc[] = {LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
lv_obj_set_grid_dsc_array(root, col_dsc, row_dsc);
container = lv_obj_create(root);
lv_obj_remove_style_all(container);
@@ -7,7 +7,7 @@
LV_IMAGE_DECLARE(emoji_F617)
char path_buf[128];
static const void * get_imgfont_path(const lv_font_t * font, uint32_t unicode, uint32_t unicode_next,
lv_coord_t * offset_y, void * user_data)
int32_t * offset_y, void * user_data)
{
LV_UNUSED(font);
LV_UNUSED(unicode_next);
+1 -1
View File
@@ -4,7 +4,7 @@
void lv_example_monkey_3(void)
{
static lv_point_t btn_points[3];
lv_coord_t hor_res = LV_HOR_RES;
int32_t hor_res = LV_HOR_RES;
/*Create button monkey test*/
lv_monkey_config_t config;
+6 -6
View File
@@ -26,12 +26,12 @@
static void touchpad_init(void);
static void touchpad_read(lv_indev_t * indev, lv_indev_data_t * data);
static bool touchpad_is_pressed(void);
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
static void touchpad_get_xy(int32_t * x, int32_t * y);
static void mouse_init(void);
static void mouse_read(lv_indev_t * indev, lv_indev_data_t * data);
static bool mouse_is_pressed(void);
static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y);
static void mouse_get_xy(int32_t * x, int32_t * y);
static void keypad_init(void);
static void keypad_read(lv_indev_t * indev, lv_indev_data_t * data);
@@ -182,8 +182,8 @@ static void touchpad_init(void)
/*Will be called by the library to read the touchpad*/
static void touchpad_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
static int32_t last_x = 0;
static int32_t last_y = 0;
/*Save the pressed coordinates and the state*/
if(touchpad_is_pressed()) {
@@ -208,7 +208,7 @@ static bool touchpad_is_pressed(void)
}
/*Get the x and y coordinates if the touchpad is pressed*/
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
static void touchpad_get_xy(int32_t * x, int32_t * y)
{
/*Your code comes here*/
@@ -250,7 +250,7 @@ static bool mouse_is_pressed(void)
}
/*Get the x and y coordinates if the mouse is pressed*/
static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
static void mouse_get_xy(int32_t * x, int32_t * y)
{
/*Your code comes here*/
+5 -5
View File
@@ -7,9 +7,9 @@ static void scroll_event_cb(lv_event_t * e)
lv_area_t cont_a;
lv_obj_get_coords(cont, &cont_a);
lv_coord_t cont_y_center = cont_a.y1 + lv_area_get_height(&cont_a) / 2;
int32_t cont_y_center = cont_a.y1 + lv_area_get_height(&cont_a) / 2;
lv_coord_t r = lv_obj_get_height(cont) * 7 / 10;
int32_t r = lv_obj_get_height(cont) * 7 / 10;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(cont);
for(i = 0; i < child_cnt; i++) {
@@ -17,13 +17,13 @@ static void scroll_event_cb(lv_event_t * e)
lv_area_t child_a;
lv_obj_get_coords(child, &child_a);
lv_coord_t child_y_center = child_a.y1 + lv_area_get_height(&child_a) / 2;
int32_t child_y_center = child_a.y1 + lv_area_get_height(&child_a) / 2;
lv_coord_t diff_y = child_y_center - cont_y_center;
int32_t diff_y = child_y_center - cont_y_center;
diff_y = LV_ABS(diff_y);
/*Get the x of diff_y on a circle.*/
lv_coord_t x;
int32_t x;
/*If diff_y is out of the circle use the last point of the circle (the radius)*/
if(diff_y >= r) {
x = r;
+3 -3
View File
@@ -11,7 +11,7 @@ static void event_cb(lv_event_t * e)
lv_obj_invalidate(chart);
}
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
lv_coord_t * s = lv_event_get_param(e);
int32_t * s = lv_event_get_param(e);
*s = LV_MAX(*s, 20);
}
else if(code == LV_EVENT_DRAW_POST_END) {
@@ -25,8 +25,8 @@ static void event_cb(lv_event_t * e)
lv_point_t p;
lv_chart_get_point_pos_by_id(chart, ser, id, &p);
lv_coord_t * y_array = lv_chart_get_y_array(chart, ser);
lv_coord_t value = y_array[id];
int32_t * y_array = lv_chart_get_y_array(chart, ser);
int32_t value = y_array[id];
char buf[16];
lv_snprintf(buf, sizeof(buf), LV_SYMBOL_DUMMY"$%d", value);
+2 -2
View File
@@ -11,8 +11,8 @@ static void draw_event_cb(lv_event_t * e)
lv_draw_fill_dsc_t * fill_dsc = draw_task->draw_dsc;
lv_obj_t * chart = lv_event_get_target(e);
lv_coord_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
lv_coord_t v = y_array[base_dsc->id2];
int32_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
int32_t v = y_array[base_dsc->id2];
uint32_t ratio = v * 255 / 100;
fill_dsc->color = lv_color_mix(lv_palette_main(LV_PALETTE_GREEN), lv_palette_main(LV_PALETTE_RED), ratio);
@@ -10,8 +10,6 @@ def event_cb(e):
chart.invalidate()
if code == lv.EVENT.REFR_EXT_DRAW_SIZE:
# s = lv.coord_t.__cast__(e.get_param())
# print("s: {:d}".format(s))
e.set_ext_draw_size(20)
elif code == lv.EVENT.DRAW_POST_END:
+3 -3
View File
@@ -70,9 +70,9 @@ static void add_faded_area(lv_event_t * e)
tri_dsc.p[2].y = LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y);
tri_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
lv_coord_t full_h = lv_obj_get_height(obj);
lv_coord_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
lv_coord_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
int32_t full_h = lv_obj_get_height(obj);
int32_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
int32_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
tri_dsc.bg_grad.stops[0].color = ser->color;
tri_dsc.bg_grad.stops[0].opa = 255 - fract_uppter;
tri_dsc.bg_grad.stops[0].frac = 0;
+2 -2
View File
@@ -15,8 +15,8 @@ static void draw_event_cb(lv_event_t * e)
rect_draw_dsc->bg_opa = (LV_OPA_COVER * base_dsc->id2) / (cnt - 1);
/*Make smaller values blue, higher values red*/
lv_coord_t * x_array = lv_chart_get_x_array(obj, ser);
lv_coord_t * y_array = lv_chart_get_y_array(obj, ser);
int32_t * x_array = lv_chart_get_x_array(obj, ser);
int32_t * y_array = lv_chart_get_y_array(obj, ser);
/*dsc->id is the tells drawing order, but we need the ID of the point being drawn.*/
uint32_t start_point = lv_chart_get_x_start_point(obj, ser);
uint32_t p_act = (start_point + base_dsc->id2) % cnt; /*Consider start point to get the index of the array*/
+1 -1
View File
@@ -11,7 +11,7 @@ static void add_data(lv_timer_t * t)
uint16_t p = lv_chart_get_point_count(chart);
uint16_t s = lv_chart_get_x_start_point(chart, ser);
lv_coord_t * a = lv_chart_get_y_array(chart, ser);
int32_t * a = lv_chart_get_y_array(chart, ser);
a[(s + 1) % p] = LV_CHART_POINT_NONE;
a[(s + 2) % p] = LV_CHART_POINT_NONE;
+2 -2
View File
@@ -11,8 +11,8 @@ static void drag_event_handler(lv_event_t * e)
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
lv_coord_t x = lv_obj_get_x(obj) + vect.x;
lv_coord_t y = lv_obj_get_y(obj) + vect.y;
int32_t x = lv_obj_get_x(obj) + vect.x;
int32_t y = lv_obj_get_y(obj) + vect.y;
lv_obj_set_pos(obj, x, y);
}
@@ -17,8 +17,8 @@ static void mask_event_cb(lv_event_t * e)
else if(code == LV_EVENT_DRAW_MAIN_BEGIN) {
/* add mask */
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN);
lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font);
int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
int32_t font_h = lv_font_get_line_height(font);
lv_area_t roller_coords;
lv_obj_get_coords(obj, &roller_coords);
@@ -30,7 +30,7 @@ void lv_example_spinbox_1(void)
lv_obj_set_width(spinbox, 100);
lv_obj_center(spinbox);
lv_coord_t h = lv_obj_get_height(spinbox);
int32_t h = lv_obj_get_height(spinbox);
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_set_size(btn, h, h);
+49 -49
View File
@@ -7,35 +7,35 @@ import sys
props = [
{'section': 'Size and position', 'dsc':'Properties related to size, position, alignment and layout of the objects.' },
{'name': 'WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area."},
{'name': 'MIN_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
{'name': 'MAX_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
{'name': 'HEIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area."},
{'name': 'MIN_HEIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
{'name': 'MAX_HEIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
{'name': 'X',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
{'name': 'Y',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
{'name': 'ALIGN',
@@ -43,81 +43,81 @@ props = [
'dsc': "Set the alignment which tells from which point of the parent the X and Y coordinates should be interpreted. The possible values are: `LV_ALIGN_DEFAULT`, `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base direction."},
{'name': 'TRANSFORM_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
{'name': 'TRANSFORM_HEIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
{'name': 'TRANSLATE_X',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Move the object with this value in X direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
{'name': 'TRANSLATE_Y',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
{'name': 'TRANSFORM_SCALE_X',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Zoom an objects horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
{'name': 'TRANSFORM_SCALE_Y',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Zoom an objects vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
{'name': 'TRANSFORM_ROTATION',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
{'name': 'TRANSFORM_PIVOT_X',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the pivot point's X coordinate for transformations. Relative to the object's top left corner'"},
{'name': 'TRANSFORM_PIVOT_Y',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the pivot point's Y coordinate for transformations. Relative to the object's top left corner'"},
{'section': 'Padding', 'dsc' : "Properties to describe spacing between the parent's sides and the children and among the children. Very similar to the padding properties in HTML."},
{'name': 'PAD_TOP',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding on the top. It makes the content area smaller in this direction."},
{'name': 'PAD_BOTTOM',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding on the bottom. It makes the content area smaller in this direction."},
{'name': 'PAD_LEFT',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding on the left. It makes the content area smaller in this direction."},
{'name': 'PAD_RIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding on the right. It makes the content area smaller in this direction."},
{'name': 'PAD_ROW',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding between the rows. Used by the layouts."},
{'name': 'PAD_COLUMN',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the padding between the columns. Used by the layouts."},
{'section': 'Margin', 'dsc' : "Properties to describe spacing around an object. Very similar to the margin properties in HTML."},
{'name': 'MARGIN_TOP',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the margin on the top. The object will keep this space from its siblings in layouts. "},
{'name': 'MARGIN_BOTTOM',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the margin on the bottom. The object will keep this space from its siblings in layouts."},
{'name': 'MARGIN_LEFT',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the margin on the left. The object will keep this space from its siblings in layouts."},
{'name': 'MARGIN_RIGHT',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Sets the margin on the right. The object will keep this space from its siblings in layouts."},
{'section': 'Background', 'dsc':'Properties to describe the background color and image of the objects.' },
@@ -138,11 +138,11 @@ props = [
'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."},
{'name': 'BG_MAIN_STOP',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the point from which the background color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
{'name': 'BG_GRAD_STOP',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the point from which the background's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
{'name': 'BG_MAIN_OPA',
@@ -187,7 +187,7 @@ props = [
'dsc': "Set the opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'BORDER_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the width of the border. Only pixel values can be used."},
{'name': 'BORDER_SIDE',
@@ -200,7 +200,7 @@ props = [
{'section': 'Outline', 'dsc':'Properties to describe the outline. It\'s like a border but drawn outside of the rectangles.' },
{'name': 'OUTLINE_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the width of the outline in pixels. "},
{'name': 'OUTLINE_COLOR',
@@ -212,24 +212,24 @@ props = [
'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'OUTLINE_PAD',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the padding of the outline, i.e. the gap between object and the outline."},
{'section': 'Shadow', 'dsc':'Properties to describe the shadow drawn under the rectangles.' },
{'name': 'SHADOW_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the width of the shadow in pixels. The value should be >= 0."},
{'name': 'SHADOW_OFFSET_X',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set an offset on the shadow in pixels in X direction. "},
{'name': 'SHADOW_OFFSET_Y',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set an offset on the shadow in pixels in Y direction. "},
{'name': 'SHADOW_SPREAD',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Make the shadow calculation to use a larger or smaller rectangle as base. The value can be in pixel to make the area larger/smaller"},
{'name': 'SHADOW_COLOR',
@@ -255,15 +255,15 @@ props = [
{'section': 'Line', 'dsc':'Properties to describe line-like objects' },
{'name': 'LINE_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the width of the lines in pixel."},
{'name': 'LINE_DASH_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines"},
{'name': 'LINE_DASH_GAP',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines"},
{'name': 'LINE_ROUNDED',
@@ -280,7 +280,7 @@ props = [
{'section': 'Arc', 'dsc':'TODO' },
{'name': 'ARC_WIDTH',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the width (thickness) of the arcs in pixel."},
{'name': 'ARC_ROUNDED',
@@ -313,11 +313,11 @@ props = [
'dsc': "Set the font of the text (a pointer `lv_font_t *`). "},
{'name': 'TEXT_LETTER_SPACE',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the letter space in pixels"},
{'name': 'TEXT_LINE_SPACE',
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the line space in pixels."},
{'name': 'TEXT_DECOR',
@@ -330,7 +330,7 @@ props = [
{'section': 'Miscellaneous', 'dsc':'Mixed properties for various purposes.' },
{'name': 'RADIUS',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"},
{'name': 'CLIP_CORNER',
@@ -415,7 +415,7 @@ props = [
{'name': 'GRID_COLUMN_DSC_ARRAY',
'style_type': 'ptr', 'var_type': 'const lv_coord_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'ptr', 'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
{'name': 'GRID_COLUMN_ALIGN',
@@ -424,7 +424,7 @@ props = [
{'name': 'GRID_ROW_DSC_ARRAY',
'style_type': 'ptr', 'var_type': 'const lv_coord_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'ptr', 'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
{'name': 'GRID_ROW_ALIGN',
@@ -432,7 +432,7 @@ props = [
'dsc': "Defines how to distribute the rows."},
{'name': 'GRID_CELL_COLUMN_POS',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the column in which the object should be placed"},
{'name': 'GRID_CELL_X_ALIGN',
@@ -440,11 +440,11 @@ props = [
'dsc': "Set how to align the object horizontally."},
{'name': 'GRID_CELL_COLUMN_SPAN',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set how many columns the object should span. Needs to be >= 1"},
{'name': 'GRID_CELL_ROW_POS',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set the row in which the object should be placed"},
{'name': 'GRID_CELL_Y_ALIGN',
@@ -452,7 +452,7 @@ props = [
'dsc': "Set how to align the object vertically."},
{'name': 'GRID_CELL_ROW_SPAN',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Set how many rows the object should span. Needs to be >= 1"},
]
+16 -16
View File
@@ -323,8 +323,8 @@ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
lv_obj_t * parent = obj->parent;
if(parent) {
lv_coord_t sl = lv_obj_get_scroll_left(parent);
lv_coord_t st = lv_obj_get_scroll_top(parent);
int32_t sl = lv_obj_get_scroll_left(parent);
int32_t st = lv_obj_get_scroll_top(parent);
obj->coords.y1 = parent->coords.y1 + lv_obj_get_style_pad_top(parent, LV_PART_MAIN) - st;
obj->coords.y2 = obj->coords.y1 - 1;
@@ -402,9 +402,9 @@ static void lv_obj_draw(lv_event_t * e)
}
/*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/
lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
int32_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &obj->coords);
lv_area_increase(&coords, w, h);
@@ -438,8 +438,8 @@ static void lv_obj_draw(lv_event_t * e)
draw_dsc.border_post = 1;
}
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &obj->coords);
lv_area_increase(&coords, w, h);
@@ -460,8 +460,8 @@ static void lv_obj_draw(lv_event_t * e)
draw_dsc.shadow_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &obj->coords);
lv_area_increase(&coords, w, h);
@@ -598,8 +598,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) {
/*scroll by keypad or encoder*/
lv_anim_enable_t anim_enable = LV_ANIM_OFF;
lv_coord_t sl = lv_obj_get_scroll_left(obj);
lv_coord_t sr = lv_obj_get_scroll_right(obj);
int32_t sl = lv_obj_get_scroll_left(obj);
int32_t sr = lv_obj_get_scroll_right(obj);
char c = *((char *)lv_event_get_param(e));
if(c == LV_KEY_DOWN) {
/*use scroll_to_x/y functions to enforce scroll limits*/
@@ -666,7 +666,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_obj_remove_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED | LV_STATE_FOCUS_KEY);
}
else if(code == LV_EVENT_SIZE_CHANGED) {
lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
int32_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
uint16_t layout = lv_obj_get_style_layout(obj, LV_PART_MAIN);
if(layout || align) {
lv_obj_mark_layout_as_dirty(obj);
@@ -680,16 +680,16 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
}
}
else if(code == LV_EVENT_CHILD_CHANGED) {
lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN);
lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_MAIN);
lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
int32_t w = lv_obj_get_style_width(obj, LV_PART_MAIN);
int32_t h = lv_obj_get_style_height(obj, LV_PART_MAIN);
int32_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
uint16_t layout = lv_obj_get_style_layout(obj, LV_PART_MAIN);
if(layout || align || w == LV_SIZE_CONTENT || h == LV_SIZE_CONTENT) {
lv_obj_mark_layout_as_dirty(obj);
}
}
else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN);
int32_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN);
lv_event_set_ext_draw_size(e, d);
}
else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) {
+2 -2
View File
@@ -210,8 +210,8 @@ typedef struct {
lv_point_t scroll; /**< The current X/Y scroll offset*/
lv_coord_t ext_click_pad; /**< Extra click padding in all direction*/
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
int32_t ext_click_pad; /**< Extra click padding in all direction*/
int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
lv_scrollbar_mode_t scrollbar_mode : 2; /**< How to display scrollbars*/
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/
+2 -2
View File
@@ -72,8 +72,8 @@ typedef struct _lv_obj_class_t {
void * user_data;
const char * name;
lv_coord_t width_def;
lv_coord_t height_def;
int32_t width_def;
int32_t height_def;
uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/
uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/
uint32_t instance_size : 16;
+13 -13
View File
@@ -250,35 +250,35 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part);
}
lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
{
lv_coord_t s = 0;
int32_t s = 0;
lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part);
int32_t sh_width = lv_obj_get_style_shadow_width(obj, part);
if(sh_width) {
lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part);
if(sh_opa > LV_OPA_MIN) {
sh_width = sh_width / 2 + 1; /*The blur adds only half width*/
sh_width += lv_obj_get_style_shadow_spread(obj, part);
lv_coord_t sh_ofs_x = lv_obj_get_style_shadow_offset_x(obj, part);
lv_coord_t sh_ofs_y = lv_obj_get_style_shadow_offset_y(obj, part);
int32_t sh_ofs_x = lv_obj_get_style_shadow_offset_x(obj, part);
int32_t sh_ofs_y = lv_obj_get_style_shadow_offset_y(obj, part);
sh_width += LV_MAX(LV_ABS(sh_ofs_x), LV_ABS(sh_ofs_y));
s = LV_MAX(s, sh_width);
}
}
lv_coord_t outline_width = lv_obj_get_style_outline_width(obj, part);
int32_t outline_width = lv_obj_get_style_outline_width(obj, part);
if(outline_width) {
lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part);
if(outline_opa > LV_OPA_MIN) {
lv_coord_t outline_pad = lv_obj_get_style_outline_pad(obj, part);
int32_t outline_pad = lv_obj_get_style_outline_pad(obj, part);
s = LV_MAX(s, outline_pad + outline_width);
}
}
lv_coord_t w = lv_obj_get_style_transform_width(obj, part);
lv_coord_t h = lv_obj_get_style_transform_height(obj, part);
lv_coord_t wh = LV_MAX(w, h);
int32_t w = lv_obj_get_style_transform_width(obj, part);
int32_t h = lv_obj_get_style_transform_height(obj, part);
int32_t wh = LV_MAX(w, h);
if(wh > 0) s += wh;
return s;
@@ -288,8 +288,8 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t s_old = _lv_obj_get_ext_draw_size(obj);
lv_coord_t s_new = 0;
int32_t s_old = _lv_obj_get_ext_draw_size(obj);
int32_t s_new = 0;
lv_obj_send_event(obj, LV_EVENT_REFR_EXT_DRAW_SIZE, &s_new);
if(s_new != s_old) lv_obj_invalidate(obj);
@@ -308,7 +308,7 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
if(s_new != s_old) lv_obj_invalidate(obj);
}
lv_coord_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj)
int32_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->ext_draw_size;
else return 0;
+2 -2
View File
@@ -92,7 +92,7 @@ void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc
* @param part part of the object
* @return the extra size required around the object
*/
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
int32_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
/**
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
@@ -106,7 +106,7 @@ void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the size extended draw area around the real coordinates
*/
lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
int32_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
lv_layer_type_t _lv_obj_get_layer_type(const struct _lv_obj_t * obj);
+2 -2
View File
@@ -230,10 +230,10 @@ lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e)
}
}
void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size)
void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size)
{
if(e->code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
lv_coord_t * cur_size = lv_event_get_param(e);
int32_t * cur_size = lv_event_get_param(e);
*cur_size = LV_MAX(*cur_size, size);
}
else {
+1 -1
View File
@@ -155,7 +155,7 @@ lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e);
* @param e pointer to an event
* @param size The new extra draw size
*/
void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size);
void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size);
/**
* Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`).
+85 -85
View File
@@ -25,8 +25,8 @@
/**********************
* STATIC PROTOTYPES
**********************/
static lv_coord_t calc_content_width(lv_obj_t * obj);
static lv_coord_t calc_content_height(lv_obj_t * obj);
static int32_t calc_content_width(lv_obj_t * obj);
static int32_t calc_content_height(lv_obj_t * obj);
static void layout_update_core(lv_obj_t * obj);
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv);
@@ -42,7 +42,7 @@ static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv);
* GLOBAL FUNCTIONS
**********************/
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
void lv_obj_set_pos(lv_obj_t * obj, int32_t x, int32_t y)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -50,7 +50,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
lv_obj_set_y(obj, y);
}
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
void lv_obj_set_x(lv_obj_t * obj, int32_t x)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -64,7 +64,7 @@ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
}
}
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
void lv_obj_set_y(lv_obj_t * obj, int32_t y)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -91,7 +91,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
bool w_is_content = false;
bool w_is_pct = false;
lv_coord_t w;
int32_t w;
if(obj->w_layout) {
w = lv_obj_get_width(obj);
}
@@ -99,7 +99,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
w = lv_obj_get_style_width(obj, LV_PART_MAIN);
w_is_content = w == LV_SIZE_CONTENT;
w_is_pct = LV_COORD_IS_PCT(w);
lv_coord_t parent_w = lv_obj_get_content_width(parent);
int32_t parent_w = lv_obj_get_content_width(parent);
if(w_is_content) {
w = calc_content_width(obj);
@@ -116,12 +116,12 @@ bool lv_obj_refr_size(lv_obj_t * obj)
}
}
lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN);
lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN);
int32_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN);
int32_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN);
w = lv_clamp_width(w, minw, maxw, parent_w);
}
lv_coord_t h;
int32_t h;
bool h_is_content = false;
bool h_is_pct = false;
if(obj->h_layout) {
@@ -131,7 +131,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
h = lv_obj_get_style_height(obj, LV_PART_MAIN);
h_is_content = h == LV_SIZE_CONTENT;
h_is_pct = LV_COORD_IS_PCT(h);
lv_coord_t parent_h = lv_obj_get_content_height(parent);
int32_t parent_h = lv_obj_get_content_height(parent);
if(h_is_content) {
h = calc_content_height(obj);
@@ -148,8 +148,8 @@ bool lv_obj_refr_size(lv_obj_t * obj)
}
}
lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN);
lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN);
int32_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN);
int32_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN);
h = lv_clamp_height(h, minh, maxh, parent_h);
}
@@ -204,7 +204,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
return true;
}
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -212,7 +212,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
lv_obj_set_height(obj, h);
}
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
void lv_obj_set_width(lv_obj_t * obj, int32_t w)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_w;
@@ -225,7 +225,7 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
}
}
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
void lv_obj_set_height(lv_obj_t * obj, int32_t h)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_h;
@@ -238,17 +238,17 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
}
}
void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w)
void lv_obj_set_content_width(lv_obj_t * obj, int32_t w)
{
lv_coord_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
lv_coord_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
int32_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
int32_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
lv_obj_set_width(obj, w + left + right);
}
void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h)
void lv_obj_set_content_height(lv_obj_t * obj, int32_t h)
{
lv_coord_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
int32_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
int32_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
lv_obj_set_height(obj, h + top + bottom);
}
@@ -311,13 +311,13 @@ void lv_obj_set_align(lv_obj_t * obj, lv_align_t align)
lv_obj_set_style_align(obj, align, 0);
}
void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs)
{
lv_obj_set_style_align(obj, align, 0);
lv_obj_set_pos(obj, x_ofs, y_ofs);
}
void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, int32_t x_ofs, int32_t y_ofs)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -326,18 +326,18 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv
LV_ASSERT_OBJ(base, MY_CLASS);
lv_coord_t x = 0;
lv_coord_t y = 0;
int32_t x = 0;
int32_t y = 0;
lv_obj_t * parent = lv_obj_get_parent(obj);
LV_ASSERT_OBJ(parent, MY_CLASS);
lv_coord_t pleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_space_top(parent, LV_PART_MAIN);
int32_t pleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN);
int32_t ptop = lv_obj_get_style_space_top(parent, LV_PART_MAIN);
lv_coord_t bleft = lv_obj_get_style_space_left(base, LV_PART_MAIN);
lv_coord_t btop = lv_obj_get_style_space_top(base, LV_PART_MAIN);
int32_t bleft = lv_obj_get_style_space_left(base, LV_PART_MAIN);
int32_t btop = lv_obj_get_style_space_top(base, LV_PART_MAIN);
if(align == LV_ALIGN_DEFAULT) {
if(lv_obj_get_style_base_dir(base, LV_PART_MAIN) == LV_BASE_DIR_RTL) align = LV_ALIGN_TOP_RIGHT;
@@ -469,11 +469,11 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords)
lv_area_copy(coords, &obj->coords);
}
lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
int32_t lv_obj_get_x(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t rel_x;
int32_t rel_x;
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent) {
rel_x = obj->coords.x1 - parent->coords.x1;
@@ -486,18 +486,18 @@ lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
return rel_x;
}
lv_coord_t lv_obj_get_x2(const lv_obj_t * obj)
int32_t lv_obj_get_x2(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
return lv_obj_get_x(obj) + lv_obj_get_width(obj);
}
lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
int32_t lv_obj_get_y(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t rel_y;
int32_t rel_y;
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent) {
rel_y = obj->coords.y1 - parent->coords.y1;
@@ -510,54 +510,54 @@ lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
return rel_y;
}
lv_coord_t lv_obj_get_y2(const lv_obj_t * obj)
int32_t lv_obj_get_y2(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
return lv_obj_get_y(obj) + lv_obj_get_height(obj);
}
lv_coord_t lv_obj_get_x_aligned(const lv_obj_t * obj)
int32_t lv_obj_get_x_aligned(const lv_obj_t * obj)
{
return lv_obj_get_style_x(obj, LV_PART_MAIN);
}
lv_coord_t lv_obj_get_y_aligned(const lv_obj_t * obj)
int32_t lv_obj_get_y_aligned(const lv_obj_t * obj)
{
return lv_obj_get_style_y(obj, LV_PART_MAIN);
}
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
int32_t lv_obj_get_width(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
return lv_area_get_width(&obj->coords);
}
lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
int32_t lv_obj_get_height(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
return lv_area_get_height(&obj->coords);
}
lv_coord_t lv_obj_get_content_width(const lv_obj_t * obj)
int32_t lv_obj_get_content_width(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
lv_coord_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
int32_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
int32_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
return lv_obj_get_width(obj) - left - right;
}
lv_coord_t lv_obj_get_content_height(const lv_obj_t * obj)
int32_t lv_obj_get_content_height(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
int32_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
int32_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
return lv_obj_get_height(obj) - top - bottom;
}
@@ -574,14 +574,14 @@ void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area)
}
lv_coord_t lv_obj_get_self_width(const lv_obj_t * obj)
int32_t lv_obj_get_self_width(const lv_obj_t * obj)
{
lv_point_t p = {0, LV_COORD_MIN};
lv_obj_send_event((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p);
return p.x;
}
lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj)
int32_t lv_obj_get_self_height(const lv_obj_t * obj)
{
lv_point_t p = {LV_COORD_MIN, 0};
lv_obj_send_event((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p);
@@ -590,8 +590,8 @@ lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj)
bool lv_obj_refresh_self_size(lv_obj_t * obj)
{
lv_coord_t w_set = lv_obj_get_style_width(obj, LV_PART_MAIN);
lv_coord_t h_set = lv_obj_get_style_height(obj, LV_PART_MAIN);
int32_t w_set = lv_obj_get_style_width(obj, LV_PART_MAIN);
int32_t h_set = lv_obj_get_style_height(obj, LV_PART_MAIN);
if(w_set != LV_SIZE_CONTENT && h_set != LV_SIZE_CONTENT) return false;
lv_obj_mark_layout_as_dirty(obj);
@@ -604,8 +604,8 @@ void lv_obj_refr_pos(lv_obj_t * obj)
lv_obj_t * parent = lv_obj_get_parent(obj);
lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN);
lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN);
int32_t x = lv_obj_get_style_x(obj, LV_PART_MAIN);
int32_t y = lv_obj_get_style_y(obj, LV_PART_MAIN);
if(parent == NULL) {
lv_obj_move_to(obj, x, y);
@@ -613,16 +613,16 @@ void lv_obj_refr_pos(lv_obj_t * obj)
}
/*Handle percentage value*/
lv_coord_t pw = lv_obj_get_content_width(parent);
lv_coord_t ph = lv_obj_get_content_height(parent);
int32_t pw = lv_obj_get_content_width(parent);
int32_t ph = lv_obj_get_content_height(parent);
if(LV_COORD_IS_PCT(x)) x = (pw * LV_COORD_GET_PCT(x)) / 100;
if(LV_COORD_IS_PCT(y)) y = (ph * LV_COORD_GET_PCT(y)) / 100;
/*Handle percentage value of translate*/
lv_coord_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN);
lv_coord_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN);
lv_coord_t w = lv_obj_get_width(obj);
lv_coord_t h = lv_obj_get_height(obj);
int32_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN);
int32_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN);
int32_t w = lv_obj_get_width(obj);
int32_t h = lv_obj_get_height(obj);
if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100;
if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100;
@@ -675,7 +675,7 @@ void lv_obj_refr_pos(lv_obj_t * obj)
lv_obj_move_to(obj, x, y);
}
void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y)
{
/*Convert x and y to absolute coordinates*/
lv_obj_t * parent = obj->parent;
@@ -744,7 +744,7 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
}
}
void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating)
void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating)
{
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
@@ -818,7 +818,7 @@ void lv_obj_invalidate(const lv_obj_t * obj)
/*Truncate the area to the object*/
lv_area_t obj_coords;
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
@@ -845,7 +845,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Truncate the area to the object*/
lv_area_t obj_coords;
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
lv_area_increase(&obj_coords, ext_size, ext_size);
@@ -863,7 +863,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Truncate to the parent and if no common parts break*/
lv_area_t parent_coords = parent->coords;
if(lv_obj_has_flag(parent, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
lv_coord_t parent_ext_size = _lv_obj_get_ext_draw_size(parent);
int32_t parent_ext_size = _lv_obj_get_ext_draw_size(parent);
lv_area_increase(&parent_coords, parent_ext_size, parent_ext_size);
}
@@ -881,7 +881,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj)
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_area_t obj_coords;
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
@@ -891,7 +891,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj)
return lv_obj_area_is_visible(obj, &obj_coords);
}
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t size)
void lv_obj_set_ext_click_area(lv_obj_t * obj, int32_t size)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -927,14 +927,14 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point)
return res;
}
lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max_width, lv_coord_t ref_width)
int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width)
{
if(LV_COORD_IS_PCT(min_width)) min_width = (ref_width * LV_COORD_GET_PCT(min_width)) / 100;
if(LV_COORD_IS_PCT(max_width)) max_width = (ref_width * LV_COORD_GET_PCT(max_width)) / 100;
return LV_CLAMP(min_width, width, max_width);
}
lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t max_height, lv_coord_t ref_height)
int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height)
{
if(LV_COORD_IS_PCT(min_height)) min_height = (ref_height * LV_COORD_GET_PCT(min_height)) / 100;
if(LV_COORD_IS_PCT(max_height)) max_height = (ref_height * LV_COORD_GET_PCT(max_height)) / 100;
@@ -947,24 +947,24 @@ lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t
* STATIC FUNCTIONS
**********************/
static lv_coord_t calc_content_width(lv_obj_t * obj)
static int32_t calc_content_width(lv_obj_t * obj)
{
lv_coord_t scroll_x_tmp = lv_obj_get_scroll_x(obj);
int32_t scroll_x_tmp = lv_obj_get_scroll_x(obj);
if(obj->spec_attr) obj->spec_attr->scroll.x = 0;
lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
lv_coord_t self_w;
int32_t self_w;
self_w = lv_obj_get_self_width(obj) + space_left + space_right;
lv_coord_t child_res = LV_COORD_MIN;
int32_t child_res = LV_COORD_MIN;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
/*With RTL find the left most coordinate*/
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL) {
for(i = 0; i < child_cnt; i++) {
lv_coord_t child_res_tmp = LV_COORD_MIN;
int32_t child_res_tmp = LV_COORD_MIN;
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
@@ -1000,7 +1000,7 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
/*Else find the right most coordinate*/
else {
for(i = 0; i < child_cnt; i++) {
lv_coord_t child_res_tmp = LV_COORD_MIN;
int32_t child_res_tmp = LV_COORD_MIN;
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
@@ -1042,22 +1042,22 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
return LV_MAX(child_res, self_w);
}
static lv_coord_t calc_content_height(lv_obj_t * obj)
static int32_t calc_content_height(lv_obj_t * obj)
{
lv_coord_t scroll_y_tmp = lv_obj_get_scroll_y(obj);
int32_t scroll_y_tmp = lv_obj_get_scroll_y(obj);
if(obj->spec_attr) obj->spec_attr->scroll.y = 0;
lv_coord_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
lv_coord_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
int32_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
int32_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
lv_coord_t self_h;
int32_t self_h;
self_h = lv_obj_get_self_height(obj) + space_top + space_bottom;
lv_coord_t child_res = LV_COORD_MIN;
int32_t child_res = LV_COORD_MIN;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
lv_coord_t child_res_tmp = LV_COORD_MIN;
int32_t child_res_tmp = LV_COORD_MIN;
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
@@ -1117,9 +1117,9 @@ static void layout_update_core(lv_obj_t * obj)
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
{
lv_coord_t angle = lv_obj_get_style_transform_rotation(obj, 0);
lv_coord_t zoom_x = lv_obj_get_style_transform_scale_x_safe(obj, 0);
lv_coord_t zoom_y = lv_obj_get_style_transform_scale_y_safe(obj, 0);
int32_t angle = lv_obj_get_style_transform_rotation(obj, 0);
int32_t zoom_x = lv_obj_get_style_transform_scale_x_safe(obj, 0);
int32_t zoom_y = lv_obj_get_style_transform_scale_y_safe(obj, 0);
if(angle == 0 && zoom_x == LV_SCALE_NONE && zoom_y == LV_SCALE_NONE) return;
+28 -28
View File
@@ -37,7 +37,7 @@ extern "C" {
* @note The position is interpreted on the content area of the parent
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
*/
void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_obj_set_pos(struct _lv_obj_t * obj, int32_t x, int32_t y);
/**
* Set the x coordinate of an object
@@ -48,7 +48,7 @@ void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
* @note The position is interpreted on the content area of the parent
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
*/
void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
void lv_obj_set_x(struct _lv_obj_t * obj, int32_t x);
/**
* Set the y coordinate of an object
@@ -59,7 +59,7 @@ void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
* @note The position is interpreted on the content area of the parent
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
*/
void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
void lv_obj_set_y(struct _lv_obj_t * obj, int32_t y);
/**
* Set the size of an object.
@@ -72,7 +72,7 @@ void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
* LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_size(struct _lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
void lv_obj_set_size(struct _lv_obj_t * obj, int32_t w, int32_t h);
/**
* Recalculate the size of the object
@@ -91,7 +91,7 @@ bool lv_obj_refr_size(struct _lv_obj_t * obj);
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w);
void lv_obj_set_width(struct _lv_obj_t * obj, int32_t w);
/**
* Set the height of an object
@@ -103,21 +103,21 @@ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w);
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h);
void lv_obj_set_height(struct _lv_obj_t * obj, int32_t h);
/**
* Set the width reduced by the left and right padding and the border width.
* @param obj pointer to an object
* @param w the width without paddings in pixels
*/
void lv_obj_set_content_width(struct _lv_obj_t * obj, lv_coord_t w);
void lv_obj_set_content_width(struct _lv_obj_t * obj, int32_t w);
/**
* Set the height reduced by the top and bottom padding and the border width.
* @param obj pointer to an object
* @param h the height without paddings in pixels
*/
void lv_obj_set_content_height(struct _lv_obj_t * obj, lv_coord_t h);
void lv_obj_set_content_height(struct _lv_obj_t * obj, int32_t h);
/**
* Set a layout for an object
@@ -162,7 +162,7 @@ void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align);
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs);
/**
* Align an object to an other object.
@@ -173,8 +173,8 @@ void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv
* @param y_ofs y coordinate offset after alignment
* @note if the position or size of `base` changes `obj` needs to be aligned manually again
*/
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs,
lv_coord_t y_ofs);
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, int32_t x_ofs,
int32_t y_ofs);
/**
* Align an object to the center on its parent.
@@ -204,7 +204,7 @@ void lv_obj_get_coords(const struct _lv_obj_t * obj, lv_area_t * coords);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj);
int32_t lv_obj_get_x(const struct _lv_obj_t * obj);
/**
* Get the x2 coordinate of object.
@@ -216,7 +216,7 @@ lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj);
int32_t lv_obj_get_x2(const struct _lv_obj_t * obj);
/**
* Get the y coordinate of object.
@@ -228,7 +228,7 @@ lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
int32_t lv_obj_get_y(const struct _lv_obj_t * obj);
/**
* Get the y2 coordinate of object.
@@ -240,21 +240,21 @@ lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj);
int32_t lv_obj_get_y2(const struct _lv_obj_t * obj);
/**
* Get the actually set x coordinate of object, i.e. the offset form the set alignment
* @param obj pointer to an object
* @return the set x coordinate
*/
lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj);
int32_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj);
/**
* Get the actually set y coordinate of object, i.e. the offset form the set alignment
* @param obj pointer to an object
* @return the set y coordinate
*/
lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
int32_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
/**
* Get the width of an object
@@ -263,7 +263,7 @@ lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
* call `lv_obj_update_layout(obj)`.
* @return the width in pixels
*/
lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj);
int32_t lv_obj_get_width(const struct _lv_obj_t * obj);
/**
* Get the height of an object
@@ -272,7 +272,7 @@ lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj);
* call `lv_obj_update_layout(obj)`.
* @return the height in pixels
*/
lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj);
int32_t lv_obj_get_height(const struct _lv_obj_t * obj);
/**
* Get the width reduced by the left and right padding and the border width.
@@ -281,7 +281,7 @@ lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj);
* call `lv_obj_update_layout(obj)`.
* @return the width which still fits into its parent without causing overflow (making the parent scrollable)
*/
lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj);
int32_t lv_obj_get_content_width(const struct _lv_obj_t * obj);
/**
* Get the height reduced by the top and bottom padding and the border width.
@@ -290,7 +290,7 @@ lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj);
* call `lv_obj_update_layout(obj)`.
* @return the height which still fits into the parent without causing overflow (making the parent scrollable)
*/
lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj);
int32_t lv_obj_get_content_height(const struct _lv_obj_t * obj);
/**
* Get the area reduced by the paddings and the border width.
@@ -308,7 +308,7 @@ void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area);
* @note This size independent from the real size of the widget.
* It just tells how large the internal ("virtual") content is.
*/
lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
int32_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
/**
* Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table.
@@ -317,7 +317,7 @@ lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
* @note This size independent from the real size of the widget.
* It just tells how large the internal ("virtual") content is.
*/
lv_coord_t lv_obj_get_self_height(const struct _lv_obj_t * obj);
int32_t lv_obj_get_self_height(const struct _lv_obj_t * obj);
/**
* Handle if the size of the internal ("virtual") content of an object has changed.
@@ -328,10 +328,10 @@ bool lv_obj_refresh_self_size(struct _lv_obj_t * obj);
void lv_obj_refr_pos(struct _lv_obj_t * obj);
void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_obj_move_to(struct _lv_obj_t * obj, int32_t x, int32_t y);
void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating);
void lv_obj_move_children_by(struct _lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating);
/**
* Transform a point using the angle and zoom style properties of an object
@@ -385,7 +385,7 @@ bool lv_obj_is_visible(const struct _lv_obj_t * obj);
* @param obj pointer to an object
* @param size extended clickable area in all 4 directions [px]
*/
void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, lv_coord_t size);
void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, int32_t size);
/**
* Get the an area where to object can be clicked.
@@ -411,7 +411,7 @@ bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point);
* @param ref_width the reference width used when min/max width is in percentage
* @return the clamped width
*/
lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max_width, lv_coord_t ref_width);
int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width);
/**
* Clamp a height between min and max height. If the min/max height is in percentage value use the ref_height
@@ -421,7 +421,7 @@ lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max
* @param ref_height the reference height used when min/max height is in percentage
* @return the clamped height
*/
lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t max_height, lv_coord_t ref_height);
int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height);
/**********************
* MACROS
+85 -85
View File
@@ -113,53 +113,53 @@ lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj)
else return LV_SCROLL_SNAP_NONE;
}
lv_coord_t lv_obj_get_scroll_x(const lv_obj_t * obj)
int32_t lv_obj_get_scroll_x(const lv_obj_t * obj)
{
if(obj->spec_attr == NULL) return 0;
return -obj->spec_attr->scroll.x;
}
lv_coord_t lv_obj_get_scroll_y(const lv_obj_t * obj)
int32_t lv_obj_get_scroll_y(const lv_obj_t * obj)
{
if(obj->spec_attr == NULL) return 0;
return -obj->spec_attr->scroll.y;
}
lv_coord_t lv_obj_get_scroll_top(lv_obj_t * obj)
int32_t lv_obj_get_scroll_top(lv_obj_t * obj)
{
if(obj->spec_attr == NULL) return 0;
return -obj->spec_attr->scroll.y;
}
lv_coord_t lv_obj_get_scroll_bottom(lv_obj_t * obj)
int32_t lv_obj_get_scroll_bottom(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_coord_t child_res = LV_COORD_MIN;
int32_t child_res = LV_COORD_MIN;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
lv_coord_t tmp_y = child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN);
int32_t tmp_y = child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN);
child_res = LV_MAX(child_res, tmp_y);
}
lv_coord_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
lv_coord_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
int32_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN);
int32_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN);
if(child_res != LV_COORD_MIN) {
child_res -= (obj->coords.y2 - space_bottom);
}
lv_coord_t self_h = lv_obj_get_self_height(obj);
int32_t self_h = lv_obj_get_self_height(obj);
self_h = self_h - (lv_obj_get_height(obj) - space_top - space_bottom);
self_h -= lv_obj_get_scroll_y(obj);
return LV_MAX(child_res, self_h);
}
lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
int32_t lv_obj_get_scroll_left(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -171,19 +171,19 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
}
/*With RTL base direction scrolling the left is normal so find the left most coordinate*/
lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
lv_coord_t child_res = 0;
int32_t child_res = 0;
uint32_t i;
lv_coord_t x1 = LV_COORD_MAX;
int32_t x1 = LV_COORD_MAX;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
lv_coord_t tmp_x = child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN);
int32_t tmp_x = child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN);
x1 = LV_MIN(x1, tmp_x);
}
@@ -195,14 +195,14 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
child_res = LV_COORD_MIN;
}
lv_coord_t self_w = lv_obj_get_self_width(obj);
int32_t self_w = lv_obj_get_self_width(obj);
self_w = self_w - (lv_obj_get_width(obj) - space_right - space_left);
self_w += lv_obj_get_scroll_x(obj);
return LV_MAX(child_res, self_w);
}
lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
int32_t lv_obj_get_scroll_right(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -214,25 +214,25 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
}
/*With other base direction (LTR) scrolling to the right is normal so find the right most coordinate*/
lv_coord_t child_res = LV_COORD_MIN;
int32_t child_res = LV_COORD_MIN;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
lv_coord_t tmp_x = child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN);
int32_t tmp_x = child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN);
child_res = LV_MAX(child_res, tmp_x);
}
lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN);
int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN);
if(child_res != LV_COORD_MIN) {
child_res -= (obj->coords.x2 - space_right);
}
lv_coord_t self_w;
int32_t self_w;
self_w = lv_obj_get_self_width(obj);
self_w = self_w - (lv_obj_get_width(obj) - space_right - space_left);
self_w -= lv_obj_get_scroll_x(obj);
@@ -253,7 +253,7 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
* Other functions
*====================*/
void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en)
void lv_obj_scroll_by_bounded(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en)
{
if(dx == 0 && dy == 0) return;
@@ -261,13 +261,13 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a
lv_obj_update_layout(obj);
/*Don't let scroll more than naturally possible by the size of the content*/
lv_coord_t x_current = -lv_obj_get_scroll_x(obj);
lv_coord_t x_bounded = x_current + dx;
int32_t x_current = -lv_obj_get_scroll_x(obj);
int32_t x_bounded = x_current + dx;
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
if(x_bounded > 0) x_bounded = 0;
if(x_bounded < 0) {
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
int32_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
if(scroll_max < 0) scroll_max = 0;
if(x_bounded < -scroll_max) x_bounded = -scroll_max;
@@ -276,7 +276,7 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a
else {
if(x_bounded < 0) x_bounded = 0;
if(x_bounded > 0) {
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
int32_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
if(scroll_max < 0) scroll_max = 0;
if(x_bounded > scroll_max) x_bounded = scroll_max;
@@ -284,12 +284,12 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a
}
/*Don't let scroll more than naturally possible by the size of the content*/
lv_coord_t y_current = -lv_obj_get_scroll_y(obj);
lv_coord_t y_bounded = y_current + dy;
int32_t y_current = -lv_obj_get_scroll_y(obj);
int32_t y_bounded = y_current + dy;
if(y_bounded > 0) y_bounded = 0;
if(y_bounded < 0) {
lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj);
int32_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj);
if(scroll_max < 0) scroll_max = 0;
if(y_bounded < -scroll_max) y_bounded = -scroll_max;
}
@@ -302,7 +302,7 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a
}
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en)
void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en)
{
if(dx == 0 && dy == 0) return;
if(anim_en == LV_ANIM_ON) {
@@ -317,7 +317,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t);
lv_coord_t sx = lv_obj_get_scroll_x(obj);
int32_t sx = lv_obj_get_scroll_x(obj);
lv_anim_set_values(&a, -sx, -sx + dx);
lv_anim_set_exec_cb(&a, scroll_x_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
@@ -333,7 +333,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t);
lv_coord_t sy = lv_obj_get_scroll_y(obj);
int32_t sy = lv_obj_get_scroll_y(obj);
lv_anim_set_values(&a, -sy, -sy + dy);
lv_anim_set_exec_cb(&a, scroll_y_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
@@ -361,28 +361,28 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
}
}
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
void lv_obj_scroll_to(lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en)
{
lv_obj_scroll_to_x(obj, x, anim_en);
lv_obj_scroll_to_y(obj, y, anim_en);
}
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
void lv_obj_scroll_to_x(lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en)
{
lv_anim_delete(obj, scroll_x_anim);
lv_coord_t scroll_x = lv_obj_get_scroll_x(obj);
lv_coord_t diff = -x + scroll_x;
int32_t scroll_x = lv_obj_get_scroll_x(obj);
int32_t diff = -x + scroll_x;
lv_obj_scroll_by_bounded(obj, diff, 0, anim_en);
}
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
void lv_obj_scroll_to_y(lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en)
{
lv_anim_delete(obj, scroll_y_anim);
lv_coord_t scroll_y = lv_obj_get_scroll_y(obj);
lv_coord_t diff = -y + scroll_y;
int32_t scroll_y = lv_obj_get_scroll_y(obj);
int32_t diff = -y + scroll_y;
lv_obj_scroll_by_bounded(obj, 0, diff, anim_en);
}
@@ -411,7 +411,7 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en)
}
}
lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y)
{
if(x == 0 && y == 0) return LV_RESULT_OK;
@@ -467,10 +467,10 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
if(indev == NULL) return;
}
lv_coord_t st = lv_obj_get_scroll_top(obj);
lv_coord_t sb = lv_obj_get_scroll_bottom(obj);
lv_coord_t sl = lv_obj_get_scroll_left(obj);
lv_coord_t sr = lv_obj_get_scroll_right(obj);
int32_t st = lv_obj_get_scroll_top(obj);
int32_t sb = lv_obj_get_scroll_bottom(obj);
int32_t sl = lv_obj_get_scroll_left(obj);
int32_t sr = lv_obj_get_scroll_right(obj);
lv_dir_t dir = lv_obj_get_scroll_dir(obj);
@@ -495,19 +495,19 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
bool rtl = lv_obj_get_style_base_dir(obj, LV_PART_SCROLLBAR) == LV_BASE_DIR_RTL;
lv_coord_t top_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR);
lv_coord_t bottom_space = lv_obj_get_style_pad_bottom(obj, LV_PART_SCROLLBAR);
lv_coord_t left_space = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR);
lv_coord_t right_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR);
lv_coord_t thickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR);
int32_t top_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR);
int32_t bottom_space = lv_obj_get_style_pad_bottom(obj, LV_PART_SCROLLBAR);
int32_t left_space = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR);
int32_t right_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR);
int32_t thickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR);
lv_coord_t obj_h = lv_obj_get_height(obj);
lv_coord_t obj_w = lv_obj_get_width(obj);
int32_t obj_h = lv_obj_get_height(obj);
int32_t obj_w = lv_obj_get_width(obj);
/*Space required for the vertical and horizontal scrollbars*/
lv_coord_t ver_reg_space = ver_draw ? thickness : 0;
lv_coord_t hor_req_space = hor_draw ? thickness : 0;
lv_coord_t rem;
int32_t ver_reg_space = ver_draw ? thickness : 0;
int32_t hor_req_space = hor_draw ? thickness : 0;
int32_t rem;
if(lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN &&
lv_obj_get_style_border_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN) {
@@ -515,7 +515,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
}
/*Draw vertical scrollbar if the mode is ON or can be scrolled in this direction*/
lv_coord_t content_h = obj_h + st + sb;
int32_t content_h = obj_h + st + sb;
if(ver_draw && content_h) {
ver_area->y1 = obj->coords.y1;
ver_area->y2 = obj->coords.y2;
@@ -528,17 +528,17 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
ver_area->x1 = ver_area->x2 - thickness + 1;
}
lv_coord_t sb_h = ((obj_h - top_space - bottom_space - hor_req_space) * obj_h) / content_h;
int32_t sb_h = ((obj_h - top_space - bottom_space - hor_req_space) * obj_h) / content_h;
sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE);
rem = (obj_h - top_space - bottom_space - hor_req_space) -
sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/
int32_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/
if(scroll_h <= 0) {
ver_area->y1 = obj->coords.y1 + top_space;
ver_area->y2 = obj->coords.y2 - bottom_space - hor_req_space - 1;
}
else {
lv_coord_t sb_y = (rem * sb) / scroll_h;
int32_t sb_y = (rem * sb) / scroll_h;
sb_y = rem - sb_y;
ver_area->y1 = obj->coords.y1 + sb_y + top_space;
@@ -559,18 +559,18 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
}
/*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
lv_coord_t content_w = obj_w + sl + sr;
int32_t content_w = obj_w + sl + sr;
if(hor_draw && content_w) {
hor_area->y2 = obj->coords.y2 - bottom_space;
hor_area->y1 = hor_area->y2 - thickness + 1;
hor_area->x1 = obj->coords.x1;
hor_area->x2 = obj->coords.x2;
lv_coord_t sb_w = ((obj_w - left_space - right_space - ver_reg_space) * obj_w) / content_w;
int32_t sb_w = ((obj_w - left_space - right_space - ver_reg_space) * obj_w) / content_w;
sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE);
rem = (obj_w - left_space - right_space - ver_reg_space) -
sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/
int32_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/
if(scroll_w <= 0) {
if(rtl) {
hor_area->x1 = obj->coords.x1 + left_space + ver_reg_space - 1;
@@ -582,7 +582,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
}
}
else {
lv_coord_t sb_x = (rem * sr) / scroll_w;
int32_t sb_x = (rem * sr) / scroll_w;
sb_x = rem - sb_x;
if(rtl) {
@@ -638,8 +638,8 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en)
/*Be sure the bottom side is not remains scrolled in*/
/*With snapping the content can't be scrolled in*/
if(lv_obj_get_scroll_snap_y(obj) == LV_SCROLL_SNAP_NONE) {
lv_coord_t st = lv_obj_get_scroll_top(obj);
lv_coord_t sb = lv_obj_get_scroll_bottom(obj);
int32_t st = lv_obj_get_scroll_top(obj);
int32_t sb = lv_obj_get_scroll_bottom(obj);
if(sb < 0 && st > 0) {
sb = LV_MIN(st, -sb);
lv_obj_scroll_by(obj, 0, sb, anim_en);
@@ -647,8 +647,8 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en)
}
if(lv_obj_get_scroll_snap_x(obj) == LV_SCROLL_SNAP_NONE) {
lv_coord_t sl = lv_obj_get_scroll_left(obj);
lv_coord_t sr = lv_obj_get_scroll_right(obj);
int32_t sl = lv_obj_get_scroll_left(obj);
int32_t sr = lv_obj_get_scroll_right(obj);
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
/*Be sure the left side is not remains scrolled in*/
if(sr < 0 && sl > 0) {
@@ -693,31 +693,31 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
if(!lv_obj_has_flag(parent, LV_OBJ_FLAG_SCROLLABLE)) return;
lv_dir_t scroll_dir = lv_obj_get_scroll_dir(parent);
lv_coord_t snap_goal = 0;
lv_coord_t act = 0;
int32_t snap_goal = 0;
int32_t act = 0;
const lv_area_t * area_tmp;
lv_coord_t y_scroll = 0;
int32_t y_scroll = 0;
lv_scroll_snap_t snap_y = lv_obj_get_scroll_snap_y(parent);
if(snap_y != LV_SCROLL_SNAP_NONE) area_tmp = &child->coords;
else area_tmp = area;
lv_coord_t stop = lv_obj_get_style_space_top(parent, LV_PART_MAIN);
lv_coord_t sbottom = lv_obj_get_style_space_bottom(parent, LV_PART_MAIN);
lv_coord_t top_diff = parent->coords.y1 + stop - area_tmp->y1 - scroll_value->y;
lv_coord_t bottom_diff = -(parent->coords.y2 - sbottom - area_tmp->y2 - scroll_value->y);
lv_coord_t parent_h = lv_obj_get_height(parent) - stop - sbottom;
int32_t stop = lv_obj_get_style_space_top(parent, LV_PART_MAIN);
int32_t sbottom = lv_obj_get_style_space_bottom(parent, LV_PART_MAIN);
int32_t top_diff = parent->coords.y1 + stop - area_tmp->y1 - scroll_value->y;
int32_t bottom_diff = -(parent->coords.y2 - sbottom - area_tmp->y2 - scroll_value->y);
int32_t parent_h = lv_obj_get_height(parent) - stop - sbottom;
if((top_diff >= 0 && bottom_diff >= 0)) y_scroll = 0;
else if(top_diff > 0) {
y_scroll = top_diff;
/*Do not let scrolling in*/
lv_coord_t st = lv_obj_get_scroll_top(parent);
int32_t st = lv_obj_get_scroll_top(parent);
if(st - y_scroll < 0) y_scroll = 0;
}
else if(bottom_diff > 0) {
y_scroll = -bottom_diff;
/*Do not let scrolling in*/
lv_coord_t sb = lv_obj_get_scroll_bottom(parent);
int32_t sb = lv_obj_get_scroll_bottom(parent);
if(sb + y_scroll < 0) y_scroll = 0;
}
@@ -739,30 +739,30 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
break;
}
lv_coord_t x_scroll = 0;
int32_t x_scroll = 0;
lv_scroll_snap_t snap_x = lv_obj_get_scroll_snap_x(parent);
if(snap_x != LV_SCROLL_SNAP_NONE) area_tmp = &child->coords;
else area_tmp = area;
lv_coord_t sleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN);
lv_coord_t sright = lv_obj_get_style_space_right(parent, LV_PART_MAIN);
lv_coord_t left_diff = parent->coords.x1 + sleft - area_tmp->x1 - scroll_value->x;
lv_coord_t right_diff = -(parent->coords.x2 - sright - area_tmp->x2 - scroll_value->x);
int32_t sleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN);
int32_t sright = lv_obj_get_style_space_right(parent, LV_PART_MAIN);
int32_t left_diff = parent->coords.x1 + sleft - area_tmp->x1 - scroll_value->x;
int32_t right_diff = -(parent->coords.x2 - sright - area_tmp->x2 - scroll_value->x);
if((left_diff >= 0 && right_diff >= 0)) x_scroll = 0;
else if(left_diff > 0) {
x_scroll = left_diff;
/*Do not let scrolling in*/
lv_coord_t sl = lv_obj_get_scroll_left(parent);
int32_t sl = lv_obj_get_scroll_left(parent);
if(sl - x_scroll < 0) x_scroll = 0;
}
else if(right_diff > 0) {
x_scroll = -right_diff;
/*Do not let scrolling in*/
lv_coord_t sr = lv_obj_get_scroll_right(parent);
int32_t sr = lv_obj_get_scroll_right(parent);
if(sr + x_scroll < 0) x_scroll = 0;
}
lv_coord_t parent_w = lv_obj_get_width(parent) - sleft - sright;
int32_t parent_w = lv_obj_get_width(parent) - sleft - sright;
switch(snap_x) {
case LV_SCROLL_SNAP_START:
snap_goal = parent->coords.x1 + sleft;
+12 -12
View File
@@ -132,7 +132,7 @@ lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj);
* If scrolled return > 0
* If scrolled in (elastic scroll) return < 0
*/
lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
/**
* Get current Y scroll position.
@@ -142,7 +142,7 @@ lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
* If scrolled return > 0
* If scrolled inside return < 0
*/
lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
/**
* Return the height of the area above the object.
@@ -151,7 +151,7 @@ lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area above the object in pixels
*/
lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
/**
* Return the height of the area below the object.
@@ -160,7 +160,7 @@ lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area below the object in pixels
*/
lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
/**
* Return the width of the area on the left the object.
@@ -169,7 +169,7 @@ lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area on the left the object in pixels
*/
lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
/**
* Return the width of the area on the right the object.
@@ -178,7 +178,7 @@ lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area on the right the object in pixels
*/
lv_coord_t lv_obj_get_scroll_right(struct _lv_obj_t * obj);
int32_t lv_obj_get_scroll_right(struct _lv_obj_t * obj);
/**
* Get the X and Y coordinates where the scrolling will end for this object if a scrolling animation is in progress.
@@ -201,7 +201,7 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end);
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
* @note e.g. dy = -20 means scroll down 20 px
*/
void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_by(struct _lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en);
/**
* Scroll by a given amount of pixels.
@@ -212,7 +212,7 @@ void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
* @note e.g. dy = -20 means scroll down 20 px
*/
void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en);
void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en);
/**
* Scroll to a given coordinate on an object.
@@ -222,7 +222,7 @@ void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_to(struct _lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en);
/**
* Scroll to a given X coordinate on an object.
@@ -231,7 +231,7 @@ void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani
* @param x pixels to scroll horizontally
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_x(struct _lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en);
/**
* Scroll to a given Y coordinate on an object
@@ -240,7 +240,7 @@ void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t a
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_y(struct _lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_y(struct _lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en);
/**
* Scroll to an object until it becomes visible on its parent
@@ -268,7 +268,7 @@ void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t an
* @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RESULT_OK`: if the object is still valid
*/
lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, int32_t x, int32_t y);
/**
* Tell whether an object is being scrolled or not at this moment

Some files were not shown because too many files have changed in this diff Show More