diff --git a/examples/get_started/lv_get_started_example_1.c b/examples/get_started/lv_get_started_example_1.c deleted file mode 100644 index 2c189ad994..0000000000 --- a/examples/get_started/lv_get_started_example_1.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "../../lvgl.h" - -static void btn_event_cb(lv_obj_t * btn, lv_event_t event) -{ - if(event == LV_EVENT_CLICKED) { - static uint8_t cnt = 0; - cnt++; - - /*Get the first child of the button which is the label and change its text*/ - lv_obj_t * label = lv_obj_get_child(btn, 0); - lv_label_set_text_fmt(label, "Button: %d", cnt); - } -} - -/** - * Create a button with a label and react on Click event. - */ -void lv_ex_get_started_1(void) -{ - lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/ - lv_obj_set_pos(btn, 10, 10); /*Set its position*/ - lv_obj_set_size(btn, 120, 50); /*Set its size*/ - lv_obj_add_event_cb(btn, btn_event_cb, NULL); /*Assign a callback to the button*/ - - lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/ - lv_label_set_text(label, "Button"); /*Set the labels text*/ -} - diff --git a/examples/get_started/lv_get_started_example_2.c b/examples/get_started/lv_get_started_example_2.c deleted file mode 100644 index b178ee69ce..0000000000 --- a/examples/get_started/lv_get_started_example_2.c +++ /dev/null @@ -1,83 +0,0 @@ -//#include "../../lv_examples.h" -// -// -///** -// * Create styles from scratch for buttons. -// */ -//void lv_ex_get_started_2(void) -//{ -// static lv_style_t style_btn; -// static lv_style_t style_btn_red; -// -// /*Create a simple button style*/ -// lv_style_init(&style_btn); -// lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10); -// lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// lv_style_set_bg_grad_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_GRAY); -// lv_style_set_bg_grad_dir(&style_btn, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); -// -// /*Swap the colors in pressed state*/ -// lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_GRAY); -// lv_style_set_bg_grad_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_SILVER); -// -// /*Add a border*/ -// lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); -// lv_style_set_border_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_70); -// lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 2); -// -// /*Different border color in focused state*/ -// lv_style_set_border_color(&style_btn, LV_STATE_FOCUSED, LV_COLOR_BLUE); -// lv_style_set_border_color(&style_btn, LV_STATE_FOCUSED | LV_STATE_PRESSED, LV_COLOR_NAVY); -// -// /*Set the text style*/ -// lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); -// -// /*Make the button smaller when pressed*/ -// lv_style_set_transform_height(&style_btn, LV_STATE_PRESSED, -5); -// lv_style_set_transform_width(&style_btn, LV_STATE_PRESSED, -10); -//#if LV_USE_ANIMATION -// /*Add a transition to the size change*/ -// static lv_anim_path_t path; -// lv_anim_path_init(&path); -// lv_anim_path_set_cb(&path, lv_anim_path_overshoot); -// -// lv_style_set_transition_prop_1(&style_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_HEIGHT); -// lv_style_set_transition_prop_2(&style_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH); -// lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 300); -// lv_style_set_transition_path(&style_btn, LV_STATE_DEFAULT, &path); -//#endif -// -// /*Create a red style. Change only some colors.*/ -// lv_style_init(&style_btn_red); -// lv_style_set_bg_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_RED); -// lv_style_set_bg_grad_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_MAROON); -// lv_style_set_bg_color(&style_btn_red, LV_STATE_PRESSED, LV_COLOR_MAROON); -// lv_style_set_bg_grad_color(&style_btn_red, LV_STATE_PRESSED, LV_COLOR_RED); -// lv_style_set_text_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_WHITE); -//#if LV_USE_BTN -// /*Create buttons and use the new styles*/ -// lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/ -// lv_obj_set_pos(btn, 10, 10); /*Set its position*/ -// lv_obj_set_size(btn, 120, 50); /*Set its size*/ -// lv_obj_reset_style_list(btn, LV_BTN_PART_MAIN); /*Remove the styles coming from the theme*/ -// lv_obj_add_style(btn, LV_BTN_PART_MAIN, &style_btn); -// -// lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/ -// lv_label_set_text(label, "Button"); /*Set the labels text*/ -// -// /*Create a new button*/ -// lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), btn); -// lv_obj_set_pos(btn2, 10, 80); -// lv_obj_set_size(btn2, 120, 50); /*Set its size*/ -// lv_obj_reset_style_list(btn2, LV_BTN_PART_MAIN); /*Remove the styles coming from the theme*/ -// lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &style_btn); -// lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &style_btn_red); /*Add the red style on top of the current */ -// lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); /*Add a local style*/ -// -// label = lv_label_create(btn2, NULL); /*Add a label to the button*/ -// lv_label_set_text(label, "Button 2"); /*Set the labels text*/ -//#endif -//} -// -// diff --git a/examples/get_started/lv_get_started_example_3.c b/examples/get_started/lv_get_started_example_3.c deleted file mode 100644 index 0aed939ab9..0000000000 --- a/examples/get_started/lv_get_started_example_3.c +++ /dev/null @@ -1,31 +0,0 @@ -//#include "../../lv_examples.h" -// -//static lv_obj_t * label; -// -//static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -//{ -// if(event == LV_EVENT_VALUE_CHANGED) { -// /*Refresh the text*/ -// lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); -// lv_obj_align(label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); /*Align below the slider*/ -// } -//} -// -///** -// * Create a slider and write its value on a label. -// */ -//void lv_ex_get_started_3(void) -//{ -// /* Create a slider in the center of the display */ -// lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL); -// lv_obj_set_width(slider, 200); /*Set the width*/ -// lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/ -// lv_obj_set_event_cb(slider, slider_event_cb); /*Assign an event function*/ -// -// /* Create a label below the slider */ -// label = lv_label_create(lv_scr_act(), NULL); -// lv_label_set_text(label, "0"); -// lv_obj_align(label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); /*Align below the slider*/ -//} -// -// diff --git a/examples/layouts/flex/lv_flex_example_1.c b/examples/layouts/flex/lv_flex_example_1.c deleted file mode 100644 index c7f0393b1d..0000000000 --- a/examples/layouts/flex/lv_flex_example_1.c +++ /dev/null @@ -1,43 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * A simple row and a column layout with flexbox -// */ -//void lv_ex_flex_1(void) -//{ -// /*Create a container with ROW flex direction*/ -// lv_obj_t * cont_row = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont_row, 300, 75); -// lv_obj_align(cont_row, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); -// lv_obj_set_flex_dir(cont_row, LV_FLEX_DIR_ROW); -// lv_obj_set_flex_gap(cont_row, 10); -// -// /*Create a container with COLUMN flex direction*/ -// lv_obj_t * cont_col = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont_col, 200, 150); -// lv_obj_align(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); -// lv_obj_set_flex_dir(cont_col, LV_FLEX_DIR_COLUMN); -// lv_obj_set_flex_gap(cont_col, 10); -// -// uint32_t i; -// for(i = 0; i < 10; i++) { -// /*Add items to the row*/ -// lv_obj_t * obj1 = lv_obj_create(cont_row, NULL); -// lv_obj_set_size(obj1, 100, LV_COORD_PCT(100)); -// lv_obj_set_flex_item(obj1, true); -// -// lv_obj_t * label1 = lv_label_create(obj1, NULL); -// lv_label_set_text_fmt(label1, "Item: %d", i); -// lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0); -// -// /*Add items to the column*/ -// lv_obj_t * obj2 = lv_obj_create(cont_col, NULL); -// lv_obj_set_size(obj2, LV_COORD_PCT(100), LV_SIZE_AUTO); -// lv_obj_set_flex_item(obj2, true); -// -// lv_obj_t * label3 = lv_label_create(obj2, NULL); -// lv_label_set_text_fmt(label3, "Item: %d", i); -// lv_obj_align(label3, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/flex/lv_flex_example_2.c b/examples/layouts/flex/lv_flex_example_2.c deleted file mode 100644 index 48cfcf4a82..0000000000 --- a/examples/layouts/flex/lv_flex_example_2.c +++ /dev/null @@ -1,24 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Arrange items in column with wrap and place the row to get even space around them. -// */ -//void lv_ex_flex_2(void) -//{ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP); -// lv_obj_set_flex_place(cont, LV_FLEX_PLACE_START, LV_FLEX_PLACE_START); -// -// uint32_t i; -// for(i = 0; i < 3; i++) { -// lv_obj_t * obj = lv_obj_create(cont, NULL); -// lv_obj_set_flex_item_place(obj, LV_FLEX_PLACE_STRETCH); -// lv_obj_set_size(obj, 70, LV_SIZE_AUTO); -// -// lv_obj_t * label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d", i); -// } -//} -// diff --git a/examples/layouts/flex/lv_flex_example_3.c b/examples/layouts/flex/lv_flex_example_3.c deleted file mode 100644 index 376ea2c234..0000000000 --- a/examples/layouts/flex/lv_flex_example_3.c +++ /dev/null @@ -1,30 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Arrange items in a row and demonstrate flex grow. -// */ -//void lv_ex_flex_3(void) -//{ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_ROW); -// -// lv_obj_t * obj; -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, 20, 20); /*Fix size*/ -// lv_obj_set_flex_item(obj, true); -// -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_FLEX_GROW(1), 30); /*1 portion from the free space*/ -// lv_obj_set_flex_item(obj, true); -// -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_FLEX_GROW(2), 40); /*2 portion from the free space*/ -// lv_obj_set_flex_item(obj, true); -// -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, 20, 20); /*Fix size. It is flushed to the right by the "grow" items*/ -// lv_obj_set_flex_item(obj, true); -//} -// diff --git a/examples/layouts/flex/lv_flex_example_4.c b/examples/layouts/flex/lv_flex_example_4.c deleted file mode 100644 index 04b8d9a46b..0000000000 --- a/examples/layouts/flex/lv_flex_example_4.c +++ /dev/null @@ -1,24 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Reverse the order of flex items -// */ -//void lv_ex_flex_4(void) -//{ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP_REVERSE); -// lv_obj_set_flex_gap(cont, 10); -// -// uint32_t i; -// for(i = 0; i < 20; i++) { -// lv_obj_t * obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, 100, LV_SIZE_AUTO); -// lv_obj_set_flex_item(obj, true); -// -// lv_obj_t * label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "Item: %d", i); -// } -//} -// diff --git a/examples/layouts/flex/lv_flex_example_5.c b/examples/layouts/flex/lv_flex_example_5.c deleted file mode 100644 index 35196dcffc..0000000000 --- a/examples/layouts/flex/lv_flex_example_5.c +++ /dev/null @@ -1,28 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate the effect of margin on flex item -// */ -//void lv_ex_flex_5(void) -//{ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_ROW_WRAP); -// -// uint32_t i; -// for(i = 0; i < 20; i++) { -// lv_obj_t * obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, 100, LV_SIZE_AUTO); -// lv_obj_set_flex_item(obj, true); -// -// /*Set margin on every side*/ -// if(i == 4) { -// lv_obj_set_style_local_margin_all(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 20); -// } -// -// lv_obj_t * label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "Item:%d", i); -// } -//} -// diff --git a/examples/layouts/flex/lv_flex_example_6.c b/examples/layouts/flex/lv_flex_example_6.c deleted file mode 100644 index 74bbc16c78..0000000000 --- a/examples/layouts/flex/lv_flex_example_6.c +++ /dev/null @@ -1,25 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * RTL base direction changes order of the items. -// */ -//void lv_ex_flex_6(void) -//{ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_base_dir(cont, LV_BIDI_DIR_RTL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP); -// -// uint32_t i; -// for(i = 0; i < 20; i++) { -// lv_obj_t * obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, 80, LV_SIZE_AUTO); -// lv_obj_set_flex_item(obj, true); -// -// lv_obj_t * label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d", i); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/grid/lv_grid_example.h b/examples/layouts/grid/lv_grid_example.h deleted file mode 100644 index 187289af0b..0000000000 --- a/examples/layouts/grid/lv_grid_example.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file lv_ex_grid.h - * - */ - -#ifndef LV_EX_GRID_H -#define LV_EX_GRID_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_EX_GRID_H*/ diff --git a/examples/layouts/grid/lv_grid_example_1.c b/examples/layouts/grid/lv_grid_example_1.c deleted file mode 100644 index 75c46dfc84..0000000000 --- a/examples/layouts/grid/lv_grid_example_1.c +++ /dev/null @@ -1,39 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * A simple grid -// */ -//void lv_ex_grid_1(void) -//{ -// static lv_coord_t col_dsc[3] = {80, 80, 80}; -// static lv_coord_t row_dsc[3] = {60, 60, 60}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// -// uint32_t i; -// for(i = 0; i < 9; i++) { -// uint8_t col = i % 3; -// uint8_t row = i / 3; -// -// obj = lv_obj_create(cont, NULL); -// /* Stretch the cell horizontally and vertically too -// * Set span to 1 to make the cell 1 column/row sized */ -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(col, 1), LV_GRID_CELL_STRETCH(row, 1)); -// -// label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "c%d, r%d", col, row); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/grid/lv_grid_example_2.c b/examples/layouts/grid/lv_grid_example_2.c deleted file mode 100644 index be449a4e4d..0000000000 --- a/examples/layouts/grid/lv_grid_example_2.c +++ /dev/null @@ -1,59 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate cell placement and span -// */ -//void lv_ex_grid_2(void) -//{ -// static lv_coord_t col_dsc[3] = {80, 80, 80}; -// static lv_coord_t row_dsc[3] = {60, 60, 60}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// -// /*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too */ -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_START(0, 1), LV_GRID_CELL_START(0, 1)); -// label = lv_label_create(obj, NULL); -// lv_label_set_text(label, "c0, r0"); -// -// /*Cell to 1;0 and align to to the start (left) horizontally and center vertically too */ -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_START(1, 1), LV_GRID_CELL_CENTER(0, 1)); -// label = lv_label_create(obj, NULL); -// lv_label_set_text(label, "c1, r0"); -// -// /*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too */ -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_START(2, 1), LV_GRID_CELL_END(0, 1)); -// label = lv_label_create(obj, NULL); -// lv_label_set_text(label, "c2, r0"); -// -// /*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched. */ -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(1, 2), LV_GRID_CELL_STRETCH(1, 1)); -// label = lv_label_create(obj, NULL); -// lv_label_set_text(label, "c1-2, r1"); -// -// /*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched. */ -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(0, 1), LV_GRID_CELL_STRETCH(1, 2)); -// label = lv_label_create(obj, NULL); -// lv_label_set_text(label, "c0\nr1-2"); -//} -// diff --git a/examples/layouts/grid/lv_grid_example_3.c b/examples/layouts/grid/lv_grid_example_3.c deleted file mode 100644 index 20f95d02cc..0000000000 --- a/examples/layouts/grid/lv_grid_example_3.c +++ /dev/null @@ -1,45 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate grid's "free unit" -// */ -//void lv_ex_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[3] = {60, LV_GRID_FR(1), LV_GRID_FR(2)}; -// -// /* Row 1: fix width 60 px -// * Row 2: 1 unit from the remaining free space -// * Row 3: fix width 60 px */ -// static lv_coord_t row_dsc[3] = {60, LV_GRID_FR(1), 60}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// uint32_t i; -// for(i = 0; i < 9; i++) { -// uint8_t col = i % 3; -// uint8_t row = i / 3; -// -// obj = lv_obj_create(cont, NULL); -// /* Stretch the cell horizontally and vertically too -// * Set span to 1 to make the cell 1 column/row sized */ -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(col, 1), LV_GRID_CELL_STRETCH(row, 1)); -// -// label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d,%d", col, row); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/grid/lv_grid_example_4.c b/examples/layouts/grid/lv_grid_example_4.c deleted file mode 100644 index 7726ff2e8e..0000000000 --- a/examples/layouts/grid/lv_grid_example_4.c +++ /dev/null @@ -1,41 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate track placement -// */ -//void lv_ex_grid_4(void) -//{ -// static lv_coord_t col_dsc[3] = {60, 60, 60}; -// static lv_coord_t row_dsc[3] = {50, 50, 50}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Add space between the columns and move the rows to the bottom (end)*/ -// lv_grid_set_place(&grid, LV_GRID_SPACE_BETWEEN, LV_GRID_END); -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// uint32_t i; -// for(i = 0; i < 9; i++) { -// uint8_t col = i % 3; -// uint8_t row = i / 3; -// -// obj = lv_obj_create(cont, NULL); -// /* Stretch the cell horizontally and vertically too -// * Set span to 1 to make the cell 1 column/row sized */ -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(col, 1), LV_GRID_CELL_STRETCH(row, 1)); -// -// label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d,%d", col, row); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/grid/lv_grid_example_5.c b/examples/layouts/grid/lv_grid_example_5.c deleted file mode 100644 index 1868b3669f..0000000000 --- a/examples/layouts/grid/lv_grid_example_5.c +++ /dev/null @@ -1,41 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate margin in grid -// */ -//void lv_ex_grid_5(void) -//{ -// -// /*60x60 cells*/ -// static lv_coord_t col_dsc[3] = {100, 60, 60}; -// static lv_coord_t row_dsc[3] = {60, 60, 60}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// uint32_t i; -// for(i = 0; i < 9; i++) { -// uint8_t col = i % 3; -// uint8_t row = i / 3; -// -// obj = lv_obj_create(cont, NULL); -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_START(col, 1), LV_GRID_CELL_START(row, 1)); -// lv_obj_set_size(obj, 55, 55); -// if(i == 1) { -// lv_obj_set_style_local_margin_all(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 5); -// } -// label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d,%d", col, row); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/layouts/grid/lv_grid_example_6.c b/examples/layouts/grid/lv_grid_example_6.c deleted file mode 100644 index 90d1f1da65..0000000000 --- a/examples/layouts/grid/lv_grid_example_6.c +++ /dev/null @@ -1,43 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Demonstrate RTL direction on grid -// */ -//void lv_ex_grid_6(void) -//{ -// -// static lv_coord_t col_dsc[3] = {100, 60, 60}; -// static lv_coord_t row_dsc[3] = {60, 60, 60}; -// -// static lv_grid_t grid; -// lv_grid_init(&grid); -// lv_grid_set_template(&grid, col_dsc, 3, row_dsc, 3); -// -// /*Add space between the columns and move the rows to the bottom (end)*/ -// -// /*Create a container with grid*/ -// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(cont, 300, 220); -// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_base_dir(cont, LV_BIDI_DIR_RTL); -// lv_obj_set_grid(cont, &grid); -// -// lv_obj_t * label; -// lv_obj_t * obj; -// uint32_t i; -// for(i = 0; i < 3; i++) { -// uint8_t col = i % 3; -// uint8_t row = i / 3; -// -// obj = lv_obj_create(cont, NULL); -// /* Stretch the cell horizontally and vertically too -// * Set span to 1 to make the cell 1 column/row sized */ -// lv_obj_set_grid_cell(obj, LV_GRID_CELL_STRETCH(col, 1), LV_GRID_CELL_START(row, 1)); -// lv_obj_set_size(obj, 55, 55); -// -// label = lv_label_create(obj, NULL); -// lv_label_set_text_fmt(label, "%d,%d", col, row); -// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); -// } -//} -// diff --git a/examples/styles/lv_style_example.h b/examples/styles/lv_style_example.h deleted file mode 100644 index 61497c8f11..0000000000 --- a/examples/styles/lv_style_example.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file lv_ex_widgets.h - * - */ - -#ifndef LV_EX_STYLE_H -#define LV_EX_STYLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -void lv_ex_style_1(void); -void lv_ex_style_2(void); -void lv_ex_style_3(void); -void lv_ex_style_4(void); -void lv_ex_style_5(void); -void lv_ex_style_6(void); -void lv_ex_style_7(void); -void lv_ex_style_8(void); -void lv_ex_style_9(void); -void lv_ex_style_10(void); -void lv_ex_style_11(void); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_EX_STYLE_H*/ diff --git a/examples/styles/lv_style_example_1.c b/examples/styles/lv_style_example_1.c deleted file mode 100644 index f91ba6a464..0000000000 --- a/examples/styles/lv_style_example_1.c +++ /dev/null @@ -1,28 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the background style properties -// */ -//void lv_ex_style_1(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// -// /*Make a gradient*/ -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// lv_style_set_bg_grad_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_bg_grad_dir(&style, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); -// -// /*Shift the gradient to the bottom*/ -// lv_style_set_bg_main_stop(&style, LV_STATE_DEFAULT, 128); -// lv_style_set_bg_grad_stop(&style, LV_STATE_DEFAULT, 192); -// -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_10.c b/examples/styles/lv_style_example_10.c deleted file mode 100644 index d4b937a160..0000000000 --- a/examples/styles/lv_style_example_10.c +++ /dev/null @@ -1,35 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the transitions style properties -// */ -//void lv_ex_style_10(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Set different background color in pressed state*/ -// lv_style_set_bg_color(&style, LV_STATE_PRESSED, LV_COLOR_GRAY); -// -// /*Set different transition time in default and pressed state -// *fast press, slower revert to default*/ -// lv_style_set_transition_time(&style, LV_STATE_DEFAULT, 500); -// lv_style_set_transition_time(&style, LV_STATE_PRESSED, 200); -// -// /*Small delay to make transition more visible*/ -// lv_style_set_transition_delay(&style, LV_STATE_DEFAULT, 100); -// -// /*Add `bg_color` to transitioned properties*/ -// lv_style_set_transition_prop_1(&style, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_11.c b/examples/styles/lv_style_example_11.c deleted file mode 100644 index e72a230571..0000000000 --- a/examples/styles/lv_style_example_11.c +++ /dev/null @@ -1,36 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the scale style properties -// */ -//void lv_ex_style_11(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Set some paddings*/ -// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 20); -// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 5); -// -// lv_style_set_scale_end_color(&style, LV_STATE_DEFAULT, LV_COLOR_RED); -// lv_style_set_line_color(&style, LV_STATE_DEFAULT, LV_COLOR_WHITE); -// lv_style_set_scale_grad_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_line_width(&style, LV_STATE_DEFAULT, 2); -// lv_style_set_scale_end_line_width(&style, LV_STATE_DEFAULT, 4); -// lv_style_set_scale_end_border_width(&style, LV_STATE_DEFAULT, 4); -// -// /*Gauge has a needle but for simplicity its style is not initialized here*/ -//#if LV_USE_GAUGE -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_gauge_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_GAUGE_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//#endif -//} -// diff --git a/examples/styles/lv_style_example_2.c b/examples/styles/lv_style_example_2.c deleted file mode 100644 index be16155036..0000000000 --- a/examples/styles/lv_style_example_2.c +++ /dev/null @@ -1,27 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the border style properties -// */ -//void lv_ex_style_2(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 20); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Add border to the bottom+right*/ -// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_border_opa(&style, LV_STATE_DEFAULT, LV_OPA_50); -// lv_style_set_border_side(&style, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_RIGHT); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_3.c b/examples/styles/lv_style_example_3.c deleted file mode 100644 index 95f6cf8025..0000000000 --- a/examples/styles/lv_style_example_3.c +++ /dev/null @@ -1,26 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the outline style properties -// */ -//void lv_ex_style_3(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Add outline*/ -// lv_style_set_outline_width(&style, LV_STATE_DEFAULT, 2); -// lv_style_set_outline_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_outline_pad(&style, LV_STATE_DEFAULT, 8); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_4.c b/examples/styles/lv_style_example_4.c deleted file mode 100644 index b231f44164..0000000000 --- a/examples/styles/lv_style_example_4.c +++ /dev/null @@ -1,27 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the Shadow style properties -// */ -//void lv_ex_style_4(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Add a shadow*/ -// lv_style_set_shadow_width(&style, LV_STATE_DEFAULT, 8); -// lv_style_set_shadow_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_shadow_ofs_x(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_shadow_ofs_y(&style, LV_STATE_DEFAULT, 20); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_5.c b/examples/styles/lv_style_example_5.c deleted file mode 100644 index a2ab991ad8..0000000000 --- a/examples/styles/lv_style_example_5.c +++ /dev/null @@ -1,27 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the pattern style properties -// */ -//void lv_ex_style_5(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Add a repeating pattern*/ -// lv_style_set_pattern_image(&style, LV_STATE_DEFAULT, LV_SYMBOL_OK); -// lv_style_set_pattern_recolor(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_pattern_opa(&style, LV_STATE_DEFAULT, LV_OPA_50); -// lv_style_set_pattern_repeat(&style, LV_STATE_DEFAULT, true); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_6.c b/examples/styles/lv_style_example_6.c deleted file mode 100644 index 6fe08a0e18..0000000000 --- a/examples/styles/lv_style_example_6.c +++ /dev/null @@ -1,30 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the value style properties -// */ -//void lv_ex_style_6(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// -// /*Add a value text properties*/ -// lv_style_set_value_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_value_align(&style, LV_STATE_DEFAULT, LV_ALIGN_IN_BOTTOM_RIGHT); -// lv_style_set_value_ofs_x(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_value_ofs_y(&style, LV_STATE_DEFAULT, 10); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -// -// /*Add a value text to the local style. This way every object can have different text*/ -// lv_obj_set_style_local_value_str(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, "Text"); -//} -// diff --git a/examples/styles/lv_style_example_7.c b/examples/styles/lv_style_example_7.c deleted file mode 100644 index bd27787acf..0000000000 --- a/examples/styles/lv_style_example_7.c +++ /dev/null @@ -1,34 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the text style properties -// */ -//void lv_ex_style_7(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 2); -// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// -// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_bottom(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 10); -// -// lv_style_set_text_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_text_letter_space(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_text_line_space(&style, LV_STATE_DEFAULT, 20); -// lv_style_set_text_decor(&style, LV_STATE_DEFAULT, LV_TEXT_DECOR_UNDERLINE); -// -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_label_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_LABEL_PART_MAIN, &style); -// lv_label_set_text(obj, "Text of\n" -// "a label"); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//} -// diff --git a/examples/styles/lv_style_example_8.c b/examples/styles/lv_style_example_8.c deleted file mode 100644 index 553c890fef..0000000000 --- a/examples/styles/lv_style_example_8.c +++ /dev/null @@ -1,24 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the line style properties -// */ -//void lv_ex_style_8(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// lv_style_set_line_color(&style, LV_STATE_DEFAULT, LV_COLOR_GRAY); -// lv_style_set_line_width(&style, LV_STATE_DEFAULT, 6); -// lv_style_set_line_rounded(&style, LV_STATE_DEFAULT, true); -//#if LV_USE_LINE -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_line_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_LINE_PART_MAIN, &style); -// -// static lv_point_t p[] = {{10, 30}, {30, 50}, {100, 0}}; -// lv_line_set_points(obj, p, 3); -// -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//#endif -//} diff --git a/examples/styles/lv_style_example_9.c b/examples/styles/lv_style_example_9.c deleted file mode 100644 index a0417ad402..0000000000 --- a/examples/styles/lv_style_example_9.c +++ /dev/null @@ -1,35 +0,0 @@ -//#include "../../lv_examples.h" -// -///** -// * Using the image style properties -// */ -//void lv_ex_style_9(void) -//{ -// static lv_style_t style; -// lv_style_init(&style); -// -// /*Set a background color and a radius*/ -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); -// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); -// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); -// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 2); -// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// -// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_bottom(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 10); -// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 10); -// -// lv_style_set_image_recolor(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// lv_style_set_image_recolor_opa(&style, LV_STATE_DEFAULT, LV_OPA_50); -// -//#if LV_USE_IMG -// /*Create an object with the new style*/ -// lv_obj_t * obj = lv_img_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj, LV_IMG_PART_MAIN, &style); -// LV_IMG_DECLARE(img_cogwheel_argb); -// lv_img_set_src(obj, &img_cogwheel_argb); -// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); -//#endif -//} -// diff --git a/examples/widgets/arc/lv_arc_example_1.c b/examples/widgets/arc/lv_arc_example_1.c deleted file mode 100644 index 49024ce4b6..0000000000 --- a/examples/widgets/arc/lv_arc_example_1.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "../../../lvgl.h" - -#if LV_USE_ARC - -void lv_ex_arc_1(void) -{ - /*Create an Arc*/ - lv_obj_t * arc = lv_arc_create(lv_scr_act(), NULL); - lv_arc_set_end_angle(arc, 200); - lv_obj_set_size(arc, 150, 150); - lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0); -} - -#endif diff --git a/examples/widgets/arc/lv_arc_example_1.py b/examples/widgets/arc/lv_arc_example_1.py deleted file mode 100644 index 2fc6dae397..0000000000 --- a/examples/widgets/arc/lv_arc_example_1.py +++ /dev/null @@ -1,12 +0,0 @@ -# Create style for the Arcs -style = lv.style_t() -lv.style_copy(style, lv.style_plain) -style.line.color = lv.color_make(0,0,255) # Arc color -style.line.width = 8 # Arc width - -# Create an Arc -arc = lv.arc(lv.scr_act()) -arc.set_style(lv.arc.STYLE.MAIN, style) # Use the new style -arc.set_angles(90, 60) -arc.set_size(150, 150) -arc.align(None, lv.ALIGN.CENTER, 0, 0) \ No newline at end of file diff --git a/examples/widgets/arc/lv_arc_example_2.c b/examples/widgets/arc/lv_arc_example_2.c deleted file mode 100644 index f1da86d24c..0000000000 --- a/examples/widgets/arc/lv_arc_example_2.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_ARC - -/** - * An `lv_task` to call periodically to set the angles of the arc - * @param t - */ -static void arc_loader(lv_timer_t * t) -{ - static int16_t a = 270; - - a+=5; - - lv_arc_set_end_angle(t->user_data, a); - - if(a >= 270 + 360) { - lv_timer_del(t); - return; - } -} - -/** - * Create an arc which acts as a loader. - */ -void lv_ex_arc_2(void) -{ - /*Create an Arc*/ - lv_obj_t * arc = lv_arc_create(lv_scr_act(), NULL); - lv_arc_set_bg_angles(arc, 0, 360); - lv_arc_set_angles(arc, 270, 270); - lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0); - - /* Create an `lv_task` to update the arc. - * Store the `arc` in the user data*/ - lv_timer_create(arc_loader, 20, arc); -} - -#endif diff --git a/examples/widgets/arc/lv_arc_example_2.py b/examples/widgets/arc/lv_arc_example_2.py deleted file mode 100644 index a03f4ec610..0000000000 --- a/examples/widgets/arc/lv_arc_example_2.py +++ /dev/null @@ -1,43 +0,0 @@ -# Create an arc which acts as a loader. -class loader_arc(lv.arc): - - def __init__(self, parent, color=lv.color_hex(0x000080), - width=8, style=lv.style_plain, rate=20): - super().__init__(parent) - - self.a = 0 - self.rate = rate - - # Create style for the Arcs - self.style = lv.style_t() - lv.style_copy(self.style, style) - self.style.line.color = color - self.style.line.width = width - - # Create an Arc - self.set_angles(180, 180); - self.set_style(self.STYLE.MAIN, self.style); - - # Spin the Arc - self.spin() - - def spin(self): - # Create an `lv_task` to update the arc. - lv.task_create(self.task_cb, self.rate, lv.TASK_PRIO.LOWEST, {}) - - - # An `lv_task` to call periodically to set the angles of the arc - def task_cb(self, task): - self.a+=5; - if self.a >= 359: self.a = 359 - - if self.a < 180: self.set_angles(180-self.a, 180) - else: self.set_angles(540-self.a, 180) - - if self.a == 359: - self.a = 0 - lv.task_del(task) - -# Create a loader arc -loader_arc = loader_arc(lv.scr_act()) -loader_arc.align(None, lv.ALIGN.CENTER, 0, 0) \ No newline at end of file diff --git a/examples/widgets/bar/lv_bar_example_1.c b/examples/widgets/bar/lv_bar_example_1.c deleted file mode 100644 index fee6f4d01b..0000000000 --- a/examples/widgets/bar/lv_bar_example_1.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_BAR - -void lv_ex_bar_1(void) -{ - lv_obj_t * bar1 = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_size(bar1, 200, 20); - lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_bar_set_value(bar1, 70, LV_ANIM_OFF); -} - -#endif diff --git a/examples/widgets/bar/lv_bar_example_1.py b/examples/widgets/bar/lv_bar_example_1.py deleted file mode 100644 index 2f663c7e28..0000000000 --- a/examples/widgets/bar/lv_bar_example_1.py +++ /dev/null @@ -1,5 +0,0 @@ -bar1 = lv.bar(lv.scr_act()) -bar1.set_size(200, 30) -bar1.align(None, lv.ALIGN.CENTER, 0, 0) -bar1.set_anim_time(1000) -bar1.set_value(100, lv.ANIM.ON) diff --git a/examples/widgets/bar/lv_bar_example_2.c b/examples/widgets/bar/lv_bar_example_2.c index 0461872b0c..ce93913571 100644 --- a/examples/widgets/bar/lv_bar_example_2.c +++ b/examples/widgets/bar/lv_bar_example_2.c @@ -4,7 +4,7 @@ /** * Example of styling the bar */ -void lv_ex_bar_2(void) +void lv_example_bar_2(void) { static lv_style_t style_bg; static lv_style_t style_indic; diff --git a/examples/widgets/bar/lv_bar_example_3.c b/examples/widgets/bar/lv_bar_example_3.c deleted file mode 100644 index bc9ecd0ee0..0000000000 --- a/examples/widgets/bar/lv_bar_example_3.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_BAR - -static void set_temp(lv_obj_t * bar, int32_t temp) -{ - lv_bar_set_value(bar, temp, LV_ANIM_ON); - - static char buf[10]; /*Only the pointer t saved so must be static*/ - lv_snprintf(buf, sizeof(buf), "%d°C", temp); - lv_obj_set_style_content_text(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, buf); -} - -/** - * A temperature meter example - */ -void lv_ex_bar_3(void) -{ - static lv_style_t style_indic; - - lv_style_init(&style_indic); - lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); - lv_style_set_bg_color(&style_indic, LV_COLOR_RED); - lv_style_set_bg_grad_color(&style_indic, LV_COLOR_BLUE); - lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER); - lv_style_set_content_align(&style_indic, LV_ALIGN_OUT_LEFT_TOP); - lv_style_set_content_ofs_x(&style_indic, -3); - - lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL); - lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic); - lv_obj_set_size(bar, 20, 200); - lv_obj_align(bar, NULL, LV_ALIGN_CENTER, 0, 0); - lv_bar_set_range(bar, -20, 40); - set_temp(bar, 30); -} - - -#endif diff --git a/examples/widgets/bar/lv_bar_example_4.c b/examples/widgets/bar/lv_bar_example_4.c deleted file mode 100644 index ad9cf0605d..0000000000 --- a/examples/widgets/bar/lv_bar_example_4.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_BAR - -/** - * Bar with stripe pattern and ranged value - */ -void lv_ex_bar_4(void) -{ - LV_IMG_DECLARE(img_skew_strip); - static lv_style_t style_indic; - - lv_style_init(&style_indic); - lv_style_set_bg_img_src(&style_indic, &img_skew_strip); - lv_style_set_bg_img_tiled(&style_indic, true); - lv_style_set_bg_img_opa(&style_indic, LV_OPA_30); - - lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL); - lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic); - - lv_obj_set_size(bar, 260, 20); - lv_obj_align(bar, NULL, LV_ALIGN_CENTER, 0, 0); - lv_bar_set_type(bar, LV_BAR_TYPE_RANGE); - lv_bar_set_value(bar, 90, LV_ANIM_OFF); - lv_bar_set_start_value(bar, 20, LV_ANIM_OFF); -} - -#endif diff --git a/examples/widgets/bar/lv_bar_example_5.c b/examples/widgets/bar/lv_bar_example_5.c deleted file mode 100644 index c01a912127..0000000000 --- a/examples/widgets/bar/lv_bar_example_5.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_BAR - -/** - * Bar with LTR and RTL base direction - */ -void lv_ex_bar_5(void) -{ - static lv_style_t style_bg; - lv_style_init(&style_bg); - lv_style_set_content_ofs_y(&style_bg, -3); - lv_style_set_content_align(&style_bg, LV_ALIGN_OUT_TOP_MID); - - lv_obj_t * bar_ltr = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_size(bar_ltr, 200, 20); - lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF); - lv_obj_align(bar_ltr, NULL, LV_ALIGN_CENTER, 0, -30); - lv_obj_add_style(bar_ltr, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg); - lv_obj_set_style_content_text(bar_ltr, LV_PART_MAIN, LV_STATE_DEFAULT, "Left to Right base direction"); - - lv_obj_t * bar_rtl = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_base_dir(bar_rtl, LV_BIDI_DIR_RTL); - lv_obj_set_size(bar_rtl, 200, 20); - lv_bar_set_value(bar_rtl, 70, LV_ANIM_OFF); - lv_obj_align(bar_rtl, NULL, LV_ALIGN_CENTER, 0, 30); - lv_obj_add_style(bar_rtl, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg); - lv_obj_set_style_content_text(bar_rtl, LV_PART_MAIN, LV_STATE_DEFAULT, "Right to Left base direction"); -} - -#endif diff --git a/examples/widgets/bar/lv_bar_example_6.c b/examples/widgets/bar/lv_bar_example_6.c deleted file mode 100644 index 4656eb82ab..0000000000 --- a/examples/widgets/bar/lv_bar_example_6.c +++ /dev/null @@ -1,68 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_BAR - -static void event_cb(lv_obj_t * obj, lv_event_t e) -{ - if(e == LV_EVENT_DRAW_POST_END) { - lv_bar_t * bar = (lv_bar_t *)obj; - - lv_draw_label_dsc_t dsc; - lv_draw_label_dsc_init(&dsc); - dsc.font = LV_THEME_FONT_NORMAL; - - char buf[8]; - lv_snprintf(buf, sizeof(buf), "%d", lv_bar_get_value(obj)); - - lv_point_t txt_size; - lv_txt_get_size(&txt_size, buf, dsc.font, dsc.letter_space, dsc.line_space, LV_COORD_MAX, dsc.flag); - - lv_area_t txt_area; - /*If the indicator is long enough put the text inside on the right*/ - if(lv_area_get_width(&bar->indic_area) > txt_size.x + 20) { - txt_area.x2 = bar->indic_area.x2 - 5; - txt_area.x1 = txt_area.x2 - txt_size.x + 1; - dsc.color = LV_COLOR_WHITE; - } - /*If the indicator is still short put the text out of it on the right */ - else { - txt_area.x1 = bar->indic_area.x2 + 5; - txt_area.x2 = txt_area.x1 + txt_size.x - 1; - dsc.color = LV_COLOR_BLACK; - } - - txt_area.y1 = bar->indic_area.y1 + (lv_area_get_height(&bar->indic_area) - txt_size.y) / 2; - txt_area.y2 = txt_area.y1 + txt_size.y - 1; - - const lv_area_t * clip_area = lv_event_get_param(); - lv_draw_label(&txt_area, clip_area, &dsc, buf, NULL); - } -} - -/** - * Custom drawer on bar to display the current value - */ -void lv_ex_bar_6(void) -{ - static lv_style_t style_bg; - lv_style_init(&style_bg); - lv_style_set_content_ofs_y(&style_bg, -3); - lv_style_set_content_align(&style_bg, LV_ALIGN_OUT_TOP_MID); - - lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL); - lv_obj_add_event_cb(bar, event_cb, NULL); - lv_obj_set_size(bar, 200, 20); - lv_obj_align(bar, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_var(&a, bar); - lv_anim_set_values(&a, 0, 100); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) lv_bar_set_value); - lv_anim_set_time(&a, 2000); - lv_anim_set_playback_time(&a, 2000); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_start(&a); - -} - -#endif diff --git a/examples/widgets/btn/lv_btn_example_1.c b/examples/widgets/btn/lv_btn_example_1.c deleted file mode 100644 index c76522c214..0000000000 --- a/examples/widgets/btn/lv_btn_example_1.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_BTN - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_CLICKED) { - printf("Clicked\n"); - } - else if(event == LV_EVENT_VALUE_CHANGED) { - printf("Toggled\n"); - } -} - -void lv_ex_btn_1(void) -{ - lv_obj_t * label; - - lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL); - lv_obj_add_event_cb(btn1, event_handler, NULL); - lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40); - - label = lv_label_create(btn1, NULL); - lv_label_set_text(label, "Button"); - - lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL); - lv_obj_add_event_cb(btn2, event_handler, NULL); - lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40); - lv_obj_add_flag(btn2, LV_OBJ_FLAG_CHECKABLE); - lv_obj_set_height(btn2, LV_SIZE_CONTENT); - - label = lv_label_create(btn2, NULL); - lv_label_set_text(label, "Toggle"); -} -#endif diff --git a/examples/widgets/btn/lv_btn_example_1.py b/examples/widgets/btn/lv_btn_example_1.py deleted file mode 100644 index 007821e655..0000000000 --- a/examples/widgets/btn/lv_btn_example_1.py +++ /dev/null @@ -1,21 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.CLICKED: - print("Clicked") - -btn1 = lv.btn(lv.scr_act()) -btn1.set_event_cb(event_handler) -btn1.align(None, lv.ALIGN.CENTER, 0, -40) - -label = lv.label(btn1) -label.set_text("Button") - -btn2 = lv.btn(lv.scr_act()) -# callback can be lambda: -btn2.set_event_cb(lambda obj, event: print("Toggled") if event == lv.EVENT.VALUE_CHANGED else None) -btn2.align(None, lv.ALIGN.CENTER, 0, 40) -btn2.set_toggle(True) -btn2.toggle() -btn2.set_fit2(lv.FIT.NONE, lv.FIT.TIGHT) - -label = lv.label(btn2) -label.set_text("Toggled") diff --git a/examples/widgets/btn/lv_btn_example_2.c b/examples/widgets/btn/lv_btn_example_2.c deleted file mode 100644 index caff9a737e..0000000000 --- a/examples/widgets/btn/lv_btn_example_2.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_BTN - -/** - * Style a button from scratch - */ -void lv_ex_btn_2(void) -{ - - static lv_style_t style; - static lv_style_t style_pr; - lv_style_init(&style); - lv_style_init(&style_pr); - - /*Init the default style*/ - lv_style_set_radius(&style, 3); - - lv_style_set_bg_opa(&style, LV_OPA_70); - lv_style_set_bg_color(&style, LV_COLOR_BLUE); - lv_style_set_bg_grad_color(&style, LV_COLOR_AQUA); - lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); - - lv_style_set_border_opa(&style, LV_OPA_40); - lv_style_set_border_width(&style, 2); - lv_style_set_border_color(&style, LV_COLOR_GRAY); - - lv_style_set_shadow_width(&style, 8); - lv_style_set_shadow_color(&style, LV_COLOR_GRAY); - lv_style_set_shadow_ofs_x(&style, 8); - lv_style_set_shadow_ofs_y(&style, 8); - - lv_style_set_text_color(&style, LV_COLOR_WHITE); - - /*Init the pressed style*/ - lv_style_set_shadow_ofs_x(&style_pr, 4); - lv_style_set_shadow_ofs_y(&style_pr, 4); - lv_style_set_color_filter_cb(&style_pr, lv_color_darken); /*Darken every color*/ - lv_style_set_color_filter_opa(&style_pr, LV_OPA_30); - - lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL); - lv_obj_remove_style(btn1, LV_PART_ANY, LV_STATE_ANY, NULL); - lv_obj_add_style(btn1, LV_PART_MAIN, LV_STATE_DEFAULT, &style); - lv_obj_add_style(btn1, LV_PART_MAIN, LV_STATE_PRESSED, &style_pr); - lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_obj_t * label = lv_label_create(btn1, NULL); - lv_label_set_text(label, "Button"); - lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); - -} -#endif diff --git a/examples/widgets/btn/lv_btn_example_3.c b/examples/widgets/btn/lv_btn_example_3.c index e183e305c0..5e8755b275 100644 --- a/examples/widgets/btn/lv_btn_example_3.c +++ b/examples/widgets/btn/lv_btn_example_3.c @@ -5,7 +5,7 @@ /** * Create a style transition on a button to act like a gum when clicked */ -void lv_ex_btn_3(void) +void lv_example_btn_3(void) { /*Properties to transition*/ static lv_style_prop_t props[] = { diff --git a/examples/widgets/btnmatrix/lv_btnmatrix_example_1.c b/examples/widgets/btnmatrix/lv_btnmatrix_example_1.c deleted file mode 100644 index c5b99d1dce..0000000000 --- a/examples/widgets/btnmatrix/lv_btnmatrix_example_1.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_BTNMATRIX - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - uint32_t id = lv_btnmatrix_get_active_btn(obj); - const char * txt = lv_btnmatrix_get_btn_text(obj, id); - - printf("%s was pressed\n", txt); - } -} - - -static const char * btnm_map[] = {"1", "2", "3", "4", "5", "\n", - "6", "7", "8", "9", "0", "\n", - "Action1", "Action2", ""}; - -void lv_ex_btnmatrix_1(void) -{ - lv_obj_t * btnm1 = lv_btnmatrix_create(lv_scr_act(), NULL); - lv_btnmatrix_set_map(btnm1, btnm_map); - lv_btnmatrix_set_btn_width(btnm1, 10, 2); /*Make "Action1" twice as wide as "Action2"*/ - lv_btnmatrix_set_btn_ctrl(btnm1, 10, LV_BTNMATRIX_CTRL_CHECKABLE); - lv_btnmatrix_set_btn_ctrl(btnm1, 11, LV_BTNMATRIX_CTRL_CHECKED); - lv_obj_align(btnm1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(btnm1, event_handler, NULL); -} - -#endif diff --git a/examples/widgets/btnmatrix/lv_btnmatrix_example_1.py b/examples/widgets/btnmatrix/lv_btnmatrix_example_1.py deleted file mode 100644 index 2cf6849664..0000000000 --- a/examples/widgets/btnmatrix/lv_btnmatrix_example_1.py +++ /dev/null @@ -1,14 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - txt = obj.get_active_btn_text() - print("%s was pressed" % txt) - -btnm_map = ["1", "2", "3", "4", "5", "\n", - "6", "7", "8", "9", "0", "\n", - "Action1", "Action2", ""] - -btnm1 = lv.btnm(lv.scr_act()) -btnm1.set_map(btnm_map) -btnm1.set_btn_width(10, 2) # Make "Action1" twice as wide as "Action2" -btnm1.align(None, lv.ALIGN.CENTER, 0, 0) -btnm1.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/btnmatrix/lv_btnmatrix_example_2.c b/examples/widgets/btnmatrix/lv_btnmatrix_example_2.c deleted file mode 100644 index 6115403459..0000000000 --- a/examples/widgets/btnmatrix/lv_btnmatrix_example_2.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_BTNMATRIX - - -void event_cb(lv_obj_t * obj, lv_event_t e) -{ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_hook_dsc_t * dsc = lv_event_get_param(); - - /*Change the draw descriptor the 2nd button */ - if(dsc->id == 1) { - dsc->rect_dsc->radius = 0; - if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = LV_COLOR_NAVY; - else dsc->rect_dsc->bg_color = LV_COLOR_BLUE; - - dsc->rect_dsc->shadow_width = 6; - dsc->rect_dsc->shadow_ofs_x = 3; - dsc->rect_dsc->shadow_ofs_y = 3; - dsc->label_dsc->color = LV_COLOR_WHITE; - } - /*Change the draw descriptor the 3rd button */ - else if(dsc->id == 2) { - dsc->rect_dsc->radius = LV_RADIUS_CIRCLE; - if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = LV_COLOR_MAROON; - else dsc->rect_dsc->bg_color = LV_COLOR_RED; - - dsc->label_dsc->color = LV_COLOR_WHITE; - } - else if(dsc->id == 3) { - dsc->label_dsc->opa = LV_OPA_TRANSP; /*Hide the text if any*/ - - } - } - if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_hook_dsc_t * dsc = lv_event_get_param(); - - /*Add custom content to the 4th button when the button itself was drawn*/ - if(dsc->id == 3) { - LV_IMG_DECLARE(img_star); - lv_img_header_t header; - lv_res_t res = lv_img_decoder_get_info(&img_star, &header); - if(res != LV_RES_OK) return; - - lv_area_t a; - a.x1 = dsc->draw_area->x1 + (lv_area_get_width(dsc->draw_area) - header.w) / 2; - a.x2 = a.x1 + header.w - 1; - a.y1 = dsc->draw_area->y1 + (lv_area_get_height(dsc->draw_area) - header.h) / 2; - a.y2 = a.y1 + header.h - 1; - - lv_draw_img_dsc_t img_draw_dsc; - lv_draw_img_dsc_init(&img_draw_dsc); - img_draw_dsc.recolor = LV_COLOR_BLACK; - if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) img_draw_dsc.recolor_opa = LV_OPA_30; - - lv_draw_img(&a, dsc->clip_area, &img_star, &img_draw_dsc); - } - } -} - -/** - * Add custom drawer to the button matrix to c - */ -void lv_ex_btnmatrix_2(void) -{ - lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act(), NULL); - lv_obj_add_event_cb(btnm, event_cb, NULL); - lv_obj_align(btnm, NULL, LV_ALIGN_CENTER, 0, 0); -} - -#endif diff --git a/examples/widgets/btnmatrix/lv_btnmatrix_example_3.c b/examples/widgets/btnmatrix/lv_btnmatrix_example_3.c deleted file mode 100644 index 07256b55a7..0000000000 --- a/examples/widgets/btnmatrix/lv_btnmatrix_example_3.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_BTNMATRIX - - -static void event_cb(lv_obj_t * obj, lv_event_t e) -{ - if(e == LV_EVENT_VALUE_CHANGED) { - uint32_t id = lv_btnmatrix_get_active_btn(obj); - bool prev = id == 0 ? true : false; - bool next = id == 6 ? true : false; - if(prev || next) { - /*Find the checked button*/ - uint32_t i; - for(i = 1; i < 7; i++) { - if(lv_btnmatrix_has_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED)) break; - } - - if(prev && i > 1) i--; - else if(next && i < 5) i++; - - lv_btnmatrix_set_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED); - } - } -} - -/** - * Make a button group - */ -void lv_ex_btnmatrix_3(void) -{ - static lv_style_t style_bg; - lv_style_init(&style_bg); - lv_style_set_pad_all(&style_bg, 0); - lv_style_set_pad_gap(&style_bg, 0); - lv_style_set_clip_corner(&style_bg, true); - lv_style_set_radius(&style_bg, LV_RADIUS_CIRCLE); - lv_style_set_border_width(&style_bg, 0); - - - static lv_style_t style_btn; - lv_style_init(&style_btn); - lv_style_set_radius(&style_btn, 0); - lv_style_set_border_width(&style_btn, 1); - lv_style_set_border_opa(&style_btn, LV_OPA_50); - lv_style_set_border_color(&style_btn, LV_COLOR_GRAY); - lv_style_set_border_side(&style_btn, LV_BORDER_SIDE_INTERNAL); - lv_style_set_radius(&style_btn, 0); - - static const char * map[] = {LV_SYMBOL_LEFT, "1", "2", "3", "4", "5", LV_SYMBOL_RIGHT, ""}; - - lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act(), NULL); - lv_btnmatrix_set_map(btnm, map); - lv_obj_add_style(btnm, LV_PART_MAIN, LV_STATE_DEFAULT, &style_bg); - lv_obj_add_style(btnm, LV_PART_ITEMS, LV_STATE_DEFAULT, &style_btn); - lv_obj_add_event_cb(btnm, event_cb, NULL); - lv_obj_set_size(btnm, 225, 35); - - /*Allow selecting on one number at time*/ - lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CHECKABLE); - lv_btnmatrix_clear_btn_ctrl(btnm, 0, LV_BTNMATRIX_CTRL_CHECKABLE); - lv_btnmatrix_clear_btn_ctrl(btnm, 6, LV_BTNMATRIX_CTRL_CHECKABLE); - - lv_btnmatrix_set_one_checked(btnm, true); - lv_btnmatrix_set_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_CHECKED); - - lv_obj_align(btnm, NULL, LV_ALIGN_CENTER, 0, 0); - -} - -#endif diff --git a/examples/widgets/calendar/lv_calendar_example_1.c b/examples/widgets/calendar/lv_calendar_example_1.c deleted file mode 100644 index 0c3c9759eb..0000000000 --- a/examples/widgets/calendar/lv_calendar_example_1.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "../../../lvgl.h" -#include - -#if LV_USE_CALENDAR - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - lv_calendar_date_t date; - if(lv_calendar_get_pressed_date(obj, &date)) { - printf("Clicked date: %02d.%02d.%d\n", date.day, date.month, date.year); - } - } -} - -void lv_ex_calendar_1(void) -{ - lv_obj_t * calendar = lv_calendar_create(lv_scr_act()); - lv_obj_set_size(calendar, 180, 180); - lv_obj_align(calendar, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(calendar, event_handler, NULL); - - /*Set today's date*/ - lv_calendar_date_t today; - today.year = 2021; - today.month = 02; - today.day = 23; - - lv_calendar_set_today_date(calendar, &today); - lv_calendar_set_showed_date(calendar, &today); - - /*Highlight a few days*/ - static lv_calendar_date_t highlighted_days[3]; /*Only its pointer will be saved so should be static*/ - highlighted_days[0].year = 2020; - highlighted_days[0].month = 10; - highlighted_days[0].day = 6; - - highlighted_days[1].year = 2020; - highlighted_days[1].month = 10; - highlighted_days[1].day = 11; - - highlighted_days[2].year = 2020; - highlighted_days[2].month = 11; - highlighted_days[2].day = 22; - - lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3); - -#if LV_USE_CALENDAR_HEADER_ARROW - lv_obj_t * h = lv_calendar_header_arrow_create(lv_scr_act(), calendar, 25); - lv_obj_align(h, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); - lv_obj_align(calendar, h, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); -#endif -} - -#endif diff --git a/examples/widgets/canvas/lv_canvas_example_1.c b/examples/widgets/canvas/lv_canvas_example_1.c deleted file mode 100644 index d4cf3ed3ba..0000000000 --- a/examples/widgets/canvas/lv_canvas_example_1.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CANVAS - - -#define CANVAS_WIDTH 200 -#define CANVAS_HEIGHT 150 - -void lv_ex_canvas_1(void) -{ - lv_draw_rect_dsc_t rect_dsc; - lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.radius = 10; - rect_dsc.bg_opa = LV_OPA_COVER; - rect_dsc.bg_grad_dir = LV_GRAD_DIR_HOR; - rect_dsc.bg_color = LV_COLOR_RED; - rect_dsc.bg_grad_color = LV_COLOR_BLUE; - rect_dsc.border_width = 2; - rect_dsc.border_opa = LV_OPA_90; - rect_dsc.border_color = LV_COLOR_WHITE; - rect_dsc.shadow_width = 5; - rect_dsc.shadow_ofs_x = 5; - rect_dsc.shadow_ofs_y = 5; - - lv_draw_label_dsc_t label_dsc; - lv_draw_label_dsc_init(&label_dsc); - label_dsc.color = LV_COLOR_YELLOW; - - static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)]; - - lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL); - lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR); - lv_obj_align(canvas, NULL, LV_ALIGN_CENTER, 0, 0); - lv_canvas_fill_bg(canvas, LV_COLOR_SILVER, LV_OPA_COVER); - - lv_canvas_draw_rect(canvas, 70, 60, 100, 70, &rect_dsc); - - lv_canvas_draw_text(canvas, 40, 20, 100, &label_dsc, "Some text on text canvas"); - - /* Test the rotation. It requires an other buffer where the orignal image is stored. - * So copy the current image to buffer and rotate it to the canvas */ - static lv_color_t cbuf_tmp[CANVAS_WIDTH * CANVAS_HEIGHT]; - memcpy(cbuf_tmp, cbuf, sizeof(cbuf_tmp)); - lv_img_dsc_t img; - img.data = (void *)cbuf_tmp; - img.header.cf = LV_IMG_CF_TRUE_COLOR; - img.header.w = CANVAS_WIDTH; - img.header.h = CANVAS_HEIGHT; - - lv_canvas_fill_bg(canvas, LV_COLOR_SILVER, LV_OPA_COVER); - lv_canvas_transform(canvas, &img, 30, LV_IMG_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true); -} - -#endif diff --git a/examples/widgets/canvas/lv_canvas_example_1.py b/examples/widgets/canvas/lv_canvas_example_1.py deleted file mode 100644 index 1167841642..0000000000 --- a/examples/widgets/canvas/lv_canvas_example_1.py +++ /dev/null @@ -1,38 +0,0 @@ -CANVAS_WIDTH = 200 -CANVAS_HEIGHT = 150 - -style = lv.style_t() -lv.style_copy(style, lv.style_plain) -style.body.main_color = lv.color_make(0xFF,0,0) -style.body.grad_color = lv.color_make(0x80,0,0) -style.body.radius = 4 -style.body.border.width = 2 -style.body.border.color = lv.color_make(0xFF,0xFF,0xFF) -style.body.shadow.color = lv.color_make(0xFF,0xFF,0xFF) -style.body.shadow.width = 4 -style.line.width = 2 -style.line.color = lv.color_make(0,0,0) -style.text.color = lv.color_make(0,0,0xFF) - -# CF.TRUE_COLOR requires 4 bytes per pixel -cbuf = bytearray(CANVAS_WIDTH * CANVAS_HEIGHT * 4) - -canvas = lv.canvas(lv.scr_act()) -canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.img.CF.TRUE_COLOR) -canvas.align(None, lv.ALIGN.CENTER, 0, 0) -canvas.fill_bg(lv.color_make(0xC0, 0xC0, 0xC0)) - -canvas.draw_rect(70, 60, 100, 70, style) - -canvas.draw_text(40, 20, 100, style, "Some text on text canvas", lv.label.ALIGN.LEFT) - -# Test the rotation. It requires an other buffer where the orignal image is stored. -# So copy the current image to buffer and rotate it to the canvas -img = lv.img_dsc_t() -img.data = cbuf[:] -img.header.cf = lv.img.CF.TRUE_COLOR -img.header.w = CANVAS_WIDTH -img.header.h = CANVAS_HEIGHT - -canvas.fill_bg(lv.color_make(0xC0, 0xC0, 0xC0)) -canvas.rotate(img, 30, 0, 0, CANVAS_WIDTH // 2, CANVAS_HEIGHT // 2) \ No newline at end of file diff --git a/examples/widgets/canvas/lv_canvas_example_2.c b/examples/widgets/canvas/lv_canvas_example_2.c deleted file mode 100644 index 6583cec33c..0000000000 --- a/examples/widgets/canvas/lv_canvas_example_2.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CANVAS - -#define CANVAS_WIDTH 50 -#define CANVAS_HEIGHT 50 - -/** - * Create a transparent canvas with Chroma keying and indexed color format (palette). - */ -void lv_ex_canvas_2(void) -{ - /*Create a button to better see the transparency*/ - lv_btn_create(lv_scr_act(), NULL); - - /*Create a buffer for the canvas*/ - static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(CANVAS_WIDTH, CANVAS_HEIGHT)]; - - /*Create a canvas and initialize its the palette*/ - lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL); - lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT); - lv_canvas_set_palette(canvas, 0, LV_COLOR_CHROMA_KEY); - lv_canvas_set_palette(canvas, 1, LV_COLOR_RED); - - /*Create colors with the indices of the palette*/ - lv_color_t c0; - lv_color_t c1; - - c0.full = 0; - c1.full = 1; - - /*Red background (There is no dedicated alpha channel in indexed images so LV_OPA_COVER is ignored)*/ - lv_canvas_fill_bg(canvas, c1, LV_OPA_COVER); - - /*Create hole on the canvas*/ - uint32_t x; - uint32_t y; - for( y = 10; y < 30; y++) { - for( x = 5; x < 20; x++) { - lv_canvas_set_px(canvas, x, y, c0); - } - } - -} -#endif diff --git a/examples/widgets/canvas/lv_canvas_example_2.png b/examples/widgets/canvas/lv_canvas_example_2.png deleted file mode 100644 index d00f8470df..0000000000 Binary files a/examples/widgets/canvas/lv_canvas_example_2.png and /dev/null differ diff --git a/examples/widgets/canvas/lv_canvas_example_2.py b/examples/widgets/canvas/lv_canvas_example_2.py deleted file mode 100644 index 2ebe8f4f48..0000000000 --- a/examples/widgets/canvas/lv_canvas_example_2.py +++ /dev/null @@ -1,41 +0,0 @@ -# Create a transparent canvas with Chroma keying and indexed color format (palette). - -CANVAS_WIDTH = 50 -CANVAS_HEIGHT = 50 - -def bufsize(w, h, bits, indexed=False): - """this function determines required buffer size - depending on the color depth""" - size = (w * bits // 8 + 1) * h - if indexed: - # + 4 bytes per palette color - size += 4 * (2**bits) - return size - -# Create a button to better see the transparency -lv.btn(lv.scr_act()) - -# Create a buffer for the canvas -cbuf = bytearray(bufsize(CANVAS_WIDTH, CANVAS_HEIGHT, 1, indexed=True)) - -# Create a canvas and initialize its the palette -canvas = lv.canvas(lv.scr_act()) -canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.img.CF.INDEXED_1BIT) -# transparent color can be defined in lv_conf.h and set to pure green by default -canvas.set_palette(0, lv.color_make(0x00, 0xFF, 0x00)) -canvas.set_palette(1, lv.color_make(0xFF, 0x00, 0x00)) - -# Create colors with the indices of the palette -c0 = lv.color_t() -c1 = lv.color_t() - -c0.full = 0 -c1.full = 1 - -# Transparent background -canvas.fill_bg(c1) - -# Create hole on the canvas -for y in range(10,30): - for x in range(5, 20): - canvas.set_px(x, y, c0) diff --git a/examples/widgets/chart/lv_chart_example_1.c b/examples/widgets/chart/lv_chart_example_1.c deleted file mode 100644 index 29407e47f9..0000000000 --- a/examples/widgets/chart/lv_chart_example_1.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CHART - -void lv_ex_chart_1(void) -{ - /*Create a chart*/ - lv_obj_t * chart; - chart = lv_chart_create(lv_scr_act(), NULL); - lv_obj_set_size(chart, 200, 150); - lv_obj_align(chart, NULL, LV_ALIGN_CENTER, 0, 0); - lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ - - /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_SECONDARY_Y); - - /*Set the next points on 'ser1'*/ - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 30); - lv_chart_set_next_value(chart, ser1, 70); - lv_chart_set_next_value(chart, ser1, 90); - - /*Directly set points on 'ser2'*/ - ser2->points[0] = 90; - ser2->points[1] = 70; - ser2->points[2] = 65; - ser2->points[3] = 65; - ser2->points[4] = 65; - ser2->points[5] = 65; - ser2->points[6] = 65; - ser2->points[7] = 65; - ser2->points[8] = 65; - ser2->points[9] = 65; - - lv_chart_refresh(chart); /*Required after direct set*/ -} - -#endif diff --git a/examples/widgets/chart/lv_chart_example_1.py b/examples/widgets/chart/lv_chart_example_1.py deleted file mode 100644 index f2250ff783..0000000000 --- a/examples/widgets/chart/lv_chart_example_1.py +++ /dev/null @@ -1,19 +0,0 @@ -# Create a chart -chart = lv.chart(lv.scr_act()) -chart.set_size(200, 150) -chart.align(None, lv.ALIGN.CENTER, 0, 0) -chart.set_type(lv.chart.TYPE.POINT | lv.chart.TYPE.LINE) # Show lines and points too -chart.set_series_opa(lv.OPA._70) # Opacity of the data series -chart.set_series_width(4) # Line width and point radious - -chart.set_range(0, 100) - -# Add two data series -ser1 = chart.add_series(lv.color_make(0xFF,0,0)) -ser2 = chart.add_series(lv.color_make(0,0x80,0)) - -# Set points on 'dl1' -chart.set_points(ser1, [10, 10, 10, 10, 10, 10, 10, 30, 70, 90]) - -# Set points on 'dl2' -chart.set_points(ser2, [90, 70, 65, 65, 65, 65, 65, 65, 65, 65]) \ No newline at end of file diff --git a/examples/widgets/chart/lv_chart_example_2.c b/examples/widgets/chart/lv_chart_example_2.c deleted file mode 100644 index f819f7139b..0000000000 --- a/examples/widgets/chart/lv_chart_example_2.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CHART - -static lv_obj_t * chart1; -static lv_chart_series_t * ser1; -static lv_chart_series_t * ser2; - -static void event_cb(lv_obj_t * obj, lv_event_t e) -{ - /*Add the faded area before the lines are drawn */ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_hook_dsc_t * hook_dsc = lv_event_get_param(); - if(hook_dsc->part != LV_PART_ITEMS) return; - if(!hook_dsc->p1 || !hook_dsc->p2) return; - - /*Add a line mask that keeps the area below the line*/ - lv_draw_mask_line_param_t line_mask_param; - lv_draw_mask_line_points_init(&line_mask_param, hook_dsc->p1->x, hook_dsc->p1->y, hook_dsc->p2->x, hook_dsc->p2->y, LV_DRAW_MASK_LINE_SIDE_BOTTOM); - int16_t line_mask_id = lv_draw_mask_add(&line_mask_param, NULL); - - /*Add a fade effect: transparent bottom covering top*/ - lv_coord_t h = lv_obj_get_height(obj); - lv_draw_mask_fade_param_t fade_mask_param; - lv_draw_mask_fade_init(&fade_mask_param, &obj->coords, LV_OPA_COVER, obj->coords.y1 + h / 8, LV_OPA_TRANSP,obj->coords.y2); - int16_t fade_mask_id = lv_draw_mask_add(&fade_mask_param, NULL); - - /*Draw a rectangle that will be affected by the mask*/ - lv_draw_rect_dsc_t draw_rect_dsc; - lv_draw_rect_dsc_init(&draw_rect_dsc); - draw_rect_dsc.bg_opa = LV_OPA_20; - draw_rect_dsc.bg_color = hook_dsc->line_dsc->color; - - lv_area_t a; - a.x1 = hook_dsc->p1->x; - a.x2 = hook_dsc->p2->x - 1; - a.y1 = LV_MIN(hook_dsc->p1->y, hook_dsc->p2->y); - a.y2 = obj->coords.y2; - lv_draw_rect(&a, hook_dsc->clip_area, &draw_rect_dsc); - - /*Remove the masks*/ - lv_draw_mask_remove_id(line_mask_id); - lv_draw_mask_remove_id(fade_mask_id); - } -} - -static void add_data(lv_timer_t * timer) -{ - static uint32_t cnt = 0; - lv_chart_set_next_value(chart1, ser1, lv_rand(20, 90)); - - if(cnt % 4 == 0) lv_chart_set_next_value(chart1, ser2, lv_rand(40, 60)); - - cnt++; -} - -/** - * Add a faded area effect to the line chart - */ -void lv_ex_chart_2(void) -{ - /*Create a chart1*/ - chart1 = lv_chart_create(lv_scr_act(), NULL); - lv_obj_set_size(chart1, 200, 150); - lv_obj_align(chart1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_chart_set_type(chart1, LV_CHART_TYPE_LINE); /*Show lines and points too*/ - - lv_obj_add_event_cb(chart1, event_cb, NULL); - - /*Add two data series*/ - ser1 = lv_chart_add_series(chart1, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); - ser2 = lv_chart_add_series(chart1, LV_COLOR_BLUE, LV_CHART_AXIS_SECONDARY_Y); - - uint32_t i; - for(i = 0; i < 10; i++) { - lv_chart_set_next_value(chart1, ser1, lv_rand(20, 90)); - lv_chart_set_next_value(chart1, ser2, lv_rand(30, 70)); - } - - lv_timer_create(add_data, 200, NULL); -} - -#endif diff --git a/examples/widgets/chart/lv_chart_example_3.c b/examples/widgets/chart/lv_chart_example_3.c deleted file mode 100644 index b2553e601f..0000000000 --- a/examples/widgets/chart/lv_chart_example_3.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CHART - -static void event_cb(lv_obj_t * chart, lv_event_t e) -{ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_hook_dsc_t * hook_dsc = lv_event_get_param(); - if(hook_dsc->part == LV_PART_MARKER && hook_dsc->sub_part_id == LV_CHART_AXIS_X) { - const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; - lv_snprintf(hook_dsc->text, sizeof(hook_dsc->text), "%s", month[hook_dsc->id]); - } - } -} - -/** - * Add ticks and labels to the axis and demonstrate scrolling - */ -void lv_ex_chart_3(void) -{ - /*Create a chart*/ - lv_obj_t * chart; - chart = lv_chart_create(lv_scr_act(), NULL); - lv_obj_set_size(chart, 200, 150); - lv_obj_align(chart, NULL, LV_ALIGN_CENTER, 0, 0); - lv_chart_set_type(chart, LV_CHART_TYPE_BAR); - lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100); - lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 0, 400); - lv_chart_set_point_count(chart, 12); - lv_obj_add_event_cb(chart, event_cb, NULL); - - /*Add ticks and label to every axis*/ - lv_chart_set_axis_tick(chart, LV_CHART_AXIS_X, 10, 5, 12, 3, true, 40); - lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 2, true, 50); - lv_chart_set_axis_tick(chart, LV_CHART_AXIS_SECONDARY_Y, 10, 5, 3, 4, true, 50); - - /*Zoom in a little in X*/ - lv_chart_set_zoom_x(chart, 800); - - /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_SECONDARY_Y); - - /*Set the next points on 'ser1'*/ - lv_chart_set_next_value(chart, ser1, 31); - lv_chart_set_next_value(chart, ser1, 66); - lv_chart_set_next_value(chart, ser1, 10); - lv_chart_set_next_value(chart, ser1, 89); - lv_chart_set_next_value(chart, ser1, 63); - lv_chart_set_next_value(chart, ser1, 56); - lv_chart_set_next_value(chart, ser1, 32); - lv_chart_set_next_value(chart, ser1, 35); - lv_chart_set_next_value(chart, ser1, 57); - lv_chart_set_next_value(chart, ser1, 85); - lv_chart_set_next_value(chart, ser1, 22); - lv_chart_set_next_value(chart, ser1, 58); - - lv_coord_t * ser2_array = lv_chart_get_array(chart, ser2); - /*Directly set points on 'ser2'*/ - ser2_array[0] = 92; - ser2_array[1] = 71; - ser2_array[2] = 61; - ser2_array[3] = 15; - ser2_array[4] = 21; - ser2_array[5] = 35; - ser2_array[6] = 35; - ser2_array[7] = 58; - ser2_array[8] = 31; - ser2_array[9] = 53; - ser2_array[10] = 33; - ser2_array[11] = 73; - - lv_chart_refresh(chart); /*Required after direct set*/ -} - -#endif diff --git a/examples/widgets/chart/lv_chart_example_4.c b/examples/widgets/chart/lv_chart_example_4.c deleted file mode 100644 index 201f59ce48..0000000000 --- a/examples/widgets/chart/lv_chart_example_4.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_CHART - - -static void event_cb(lv_obj_t * chart, lv_event_t e) -{ - if(e == LV_EVENT_VALUE_CHANGED) { - lv_obj_invalidate(chart); - } - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); - *s = LV_MAX(*s, 20); - } - else if(e == LV_EVENT_DRAW_POST_END) { - int32_t id = lv_chart_get_pressed_point(chart); - if(id < 0) return; - - printf("Selected point %d\n", id); - - lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL); - while(ser) { - lv_point_t p; - lv_chart_get_point_pos_by_id(chart, ser, id, &p); - - lv_coord_t * y_array = lv_chart_get_array(chart, ser); - lv_coord_t value = y_array[id]; - - char buf[16]; - lv_snprintf(buf, sizeof(buf), "$%d", value); - - lv_draw_rect_dsc_t draw_rect_dsc; - lv_draw_rect_dsc_init(&draw_rect_dsc); - draw_rect_dsc.bg_color = LV_COLOR_BLACK; - draw_rect_dsc.bg_opa = LV_OPA_50; - draw_rect_dsc.radius = 3; - draw_rect_dsc.content_text = buf; - draw_rect_dsc.content_color = LV_COLOR_WHITE; - - lv_area_t a; - a.x1 = chart->coords.x1 + p.x - 20; - a.x2 = chart->coords.x1 + p.x + 20; - a.y1 = chart->coords.y1 + p.y - 30; - a.y2 = chart->coords.y1 + p.y - 10; - - const lv_area_t * clip_area = lv_event_get_param(); - lv_draw_rect(&a, clip_area, &draw_rect_dsc); - - ser = lv_chart_get_series_next(chart, ser); - } - } -} - -/** - * Add ticks and labels to the axis and demonstrate scrolling - */ -void lv_ex_chart_4(void) -{ - /*Create a chart*/ - lv_obj_t * chart; - chart = lv_chart_create(lv_scr_act(), NULL); - lv_obj_set_size(chart, 200, 150); - lv_obj_align(chart, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_obj_add_event_cb(chart, event_cb, NULL); - lv_obj_refresh_ext_draw_size(chart); - - /*Zoom in a little in X*/ - lv_chart_set_zoom_x(chart, 800); - - /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_PRIMARY_Y); - uint32_t i; - for(i = 0; i < 10; i++) { - lv_chart_set_next_value(chart, ser1, lv_rand(60,90)); - lv_chart_set_next_value(chart, ser2, lv_rand(10,40)); - } -} - -#endif diff --git a/examples/widgets/checkbox/lv_checkbox_example_1.c b/examples/widgets/checkbox/lv_checkbox_example_1.c deleted file mode 100644 index 5d7c8058d0..0000000000 --- a/examples/widgets/checkbox/lv_checkbox_example_1.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_CHECKBOX - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - const char * txt = lv_checkbox_get_text(obj); - const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked"; - printf("%s: %s\n", txt, state); - } -} - -void lv_ex_checkbox_1(void) -{ - static lv_flex_t flex_center; - lv_flex_init(&flex_center); - lv_flex_set_flow(&flex_center, LV_FLEX_FLOW_COLUMN); - lv_flex_set_place(&flex_center, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER); - - lv_obj_set_layout(lv_scr_act(), &flex_center); - - lv_obj_t * cb; - cb = lv_checkbox_create(lv_scr_act(), NULL); - lv_checkbox_set_text(cb, "Apple"); - lv_obj_add_event_cb(cb, event_handler, NULL); - - cb = lv_checkbox_create(lv_scr_act(), NULL); - lv_checkbox_set_text(cb, "Banana"); - lv_obj_add_state(cb, LV_STATE_CHECKED); - lv_obj_add_event_cb(cb, event_handler, NULL); - - cb = lv_checkbox_create(lv_scr_act(), NULL); - lv_checkbox_set_text(cb, "Lemon"); - lv_obj_add_state(cb, LV_STATE_DISABLED); - lv_obj_add_event_cb(cb, event_handler, NULL); - - cb = lv_checkbox_create(lv_scr_act(), NULL); - lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_checkbox_set_text(cb, "Melon"); - lv_obj_add_event_cb(cb, event_handler, NULL); -} - -#endif diff --git a/examples/widgets/checkbox/lv_checkbox_example_1.py b/examples/widgets/checkbox/lv_checkbox_example_1.py deleted file mode 100644 index d0ffb7e337..0000000000 --- a/examples/widgets/checkbox/lv_checkbox_example_1.py +++ /dev/null @@ -1,8 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("State: %s" % ("Checked" if obj.is_checked() else "Unchecked")) - -cb = lv.cb(lv.scr_act()) -cb.set_text("I agree to terms and conditions.") -cb.align(None, lv.ALIGN.CENTER, 0, 0) -cb.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/colorwheel/lv_cpicker_example_1.c b/examples/widgets/colorwheel/lv_cpicker_example_1.c deleted file mode 100644 index 52ce152e4f..0000000000 --- a/examples/widgets/colorwheel/lv_cpicker_example_1.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_COLORWHEEL - -void lv_ex_colorwheel_1(void) -{ - lv_obj_t * cw; - - cw = lv_colorwheel_create(lv_scr_act(), true); - lv_obj_set_size(cw, 200, 200); - lv_obj_align(cw, NULL, LV_ALIGN_CENTER, 0, 0); -} - -#endif diff --git a/examples/widgets/dropdown/lv_dropdown_example_1.c b/examples/widgets/dropdown/lv_dropdown_example_1.c deleted file mode 100644 index e2e15b568b..0000000000 --- a/examples/widgets/dropdown/lv_dropdown_example_1.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_DROPDOWN - - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - char buf[32]; - lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); - printf("Option: %s\n", buf); - } -} - -void lv_ex_dropdown_1(void) -{ - - /*Create a normal drop down list*/ - lv_obj_t * dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_dropdown_set_options(dd, "Apple\n" - "Banana\n" - "Orange\n" - "Cherry\n" - "Grape\n" - "Raspberry\n" - "Melon\n" - "Orange\n" - "Lemon\n" - "Nuts"); - - lv_obj_align(dd, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); - lv_obj_add_event_cb(dd, event_handler, NULL); -} - -#endif diff --git a/examples/widgets/dropdown/lv_dropdown_example_1.py b/examples/widgets/dropdown/lv_dropdown_example_1.py deleted file mode 100644 index da76df5178..0000000000 --- a/examples/widgets/dropdown/lv_dropdown_example_1.py +++ /dev/null @@ -1,21 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - option = " "*10 # should be large enough to store the option - obj.get_selected_str(option, len(option)) - # .strip() removes trailing spaces - print("Option: \"%s\"" % option.strip()) - -# Create a drop down list -ddlist = lv.ddlist(lv.scr_act()) -ddlist.set_options("\n".join([ - "Apple", - "Banana", - "Orange", - "Melon", - "Grape", - "Raspberry"])) - -ddlist.set_fix_width(150) -ddlist.set_draw_arrow(True) -ddlist.align(None, lv.ALIGN.IN_TOP_MID, 0, 20) -ddlist.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/dropdown/lv_dropdown_example_2.c b/examples/widgets/dropdown/lv_dropdown_example_2.c deleted file mode 100644 index c94dcf12b2..0000000000 --- a/examples/widgets/dropdown/lv_dropdown_example_2.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_DROPDOWN - - -/** - * Create a drop down, up, left and right menus - */ -void lv_ex_dropdown_2(void) -{ - static const char * opts = "Apple\n" - "Banana\n" - "Orange\n" - "Melon\n" - "Grape\n" - "Raspberry"; - - lv_obj_t * dd; - dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_dropdown_set_options_static(dd, opts); - lv_obj_align(dd, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); - - dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_dropdown_set_options_static(dd, opts); - lv_dropdown_set_dir(dd, LV_DIR_BOTTOM); - lv_dropdown_set_symbol(dd, LV_SYMBOL_UP); - lv_obj_align(dd, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -10); - - dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_dropdown_set_options_static(dd, opts); - lv_dropdown_set_dir(dd, LV_DIR_RIGHT); - lv_dropdown_set_symbol(dd, LV_SYMBOL_RIGHT); - lv_obj_align(dd, NULL, LV_ALIGN_IN_LEFT_MID, 10, 0); - - dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_dropdown_set_options_static(dd, opts); - lv_dropdown_set_dir(dd, LV_DIR_LEFT); - lv_dropdown_set_symbol(dd, LV_SYMBOL_LEFT); - lv_obj_align(dd, NULL, LV_ALIGN_IN_RIGHT_MID, -10, 0); -} - -#endif diff --git a/examples/widgets/dropdown/lv_dropdown_example_2.py b/examples/widgets/dropdown/lv_dropdown_example_2.py deleted file mode 100644 index e01334c400..0000000000 --- a/examples/widgets/dropdown/lv_dropdown_example_2.py +++ /dev/null @@ -1,23 +0,0 @@ -# Create a drop UP list by applying auto realign - -# Create a drop down list -ddlist = lv.ddlist(lv.scr_act()) -ddlist.set_options("\n".join([ - "Apple", - "Banana", - "Orange", - "Melon", - "Grape", - "Raspberry"])) - - -ddlist.set_fix_width(150) -ddlist.set_fix_height(150) -ddlist.set_draw_arrow(True) - -# Enable auto-realign when the size changes. -# It will keep the bottom of the ddlist fixed -ddlist.set_auto_realign(True) - -# It will be called automatically when the size changes -ddlist.align(None, lv.ALIGN.IN_BOTTOM_MID, 0, -20) diff --git a/examples/widgets/dropdown/lv_dropdown_example_3.c b/examples/widgets/dropdown/lv_dropdown_example_3.c deleted file mode 100644 index bfb83cdb44..0000000000 --- a/examples/widgets/dropdown/lv_dropdown_example_3.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_DROPDOWN - - -/** - * Create a menu from a drop-down list and show some drop-down list features and styling - */ -void lv_ex_dropdown_3(void) -{ - /*Create a drop down list*/ - lv_obj_t * dd = lv_dropdown_create(lv_scr_act(), NULL); - lv_obj_align(dd, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); - lv_dropdown_set_options(dd, "New\n" - "Open\n" - "Edit\n" - "Close\n" - "Preferences\n" - "Exit"); - - /*Set a fixed text to display on the button of the drop-down list*/ - lv_dropdown_set_text(dd, "Menu"); - - /*Use a custom image as down icon*/ - LV_IMG_DECLARE(img_caret_down) - lv_dropdown_set_symbol(dd, &img_caret_down); - - /* Remove the style of the selected part on the list. - * In a menu we don't need to show the last clicked item*/ - lv_obj_t * list = lv_dropdown_get_list(dd); - lv_obj_remove_style(list, LV_PART_SELECTED, LV_STATE_DEFAULT, NULL); -} - -#endif diff --git a/examples/widgets/keyboard/lv_keyboard_example_1.c b/examples/widgets/keyboard/lv_keyboard_example_1.c deleted file mode 100644 index dacecf19d4..0000000000 --- a/examples/widgets/keyboard/lv_keyboard_example_1.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_KEYBOARD - - -static void ta_event_cb(lv_obj_t * ta, lv_event_t e) -{ - lv_obj_t * kb = lv_event_get_user_data(); - if(e == LV_EVENT_FOCUSED) { - lv_keyboard_set_textarea(kb, ta); - lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN); - } - - if(e == LV_EVENT_DEFOCUSED) { - lv_keyboard_set_textarea(kb, NULL); - lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); - } -} - -void lv_keyboard_example_1(void) -{ - /*Create a keyboard to use it with an of the text areas*/ - lv_obj_t *kb = lv_keyboard_create(lv_scr_act()); - - /*Create a text area. The keyboard will write here*/ - lv_obj_t * ta; - ta = lv_textarea_create(lv_scr_act(), NULL); - lv_obj_align(ta, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); - lv_textarea_set_placeholder_text(ta, "Hello"); - - ta = lv_textarea_create(lv_scr_act(), NULL); - lv_obj_align(ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); - - lv_keyboard_set_textarea(kb, ta); -} -#endif diff --git a/examples/widgets/keyboard/lv_keyboard_example_1.py b/examples/widgets/keyboard/lv_keyboard_example_1.py deleted file mode 100644 index 61d83ad767..0000000000 --- a/examples/widgets/keyboard/lv_keyboard_example_1.py +++ /dev/null @@ -1,26 +0,0 @@ -# Create styles for the keyboard -rel_style = lv.style_t() -pr_style = lv.style_t() - -lv.style_copy(rel_style, lv.style_btn_rel) -rel_style.body.radius = 0 -rel_style.body.border.width = 1 - -lv.style_copy(pr_style, lv.style_btn_pr) -pr_style.body.radius = 0 -pr_style.body.border.width = 1 - -# Create a keyboard and apply the styles -kb = lv.kb(lv.scr_act()) -kb.set_cursor_manage(True) -kb.set_style(lv.kb.STYLE.BG, lv.style_transp_tight) -kb.set_style(lv.kb.STYLE.BTN_REL, rel_style) -kb.set_style(lv.kb.STYLE.BTN_PR, pr_style) - -# Create a text area. The keyboard will write here -ta = lv.ta(lv.scr_act()) -ta.align(None, lv.ALIGN.IN_TOP_MID, 0, 10) -ta.set_text("") - -# Assign the text area to the keyboard -kb.set_ta(ta) \ No newline at end of file diff --git a/examples/widgets/label/lv_label_example_1.c b/examples/widgets/label/lv_label_example_1.c deleted file mode 100644 index 4040909965..0000000000 --- a/examples/widgets/label/lv_label_example_1.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_LABEL - -/** - * Show line wrap, re-color, line align and text scrolling. - */ -void lv_ex_label_1(void) -{ - lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/ - lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/ - lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center" - "and wrap long text automatically."); - lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/ - lv_obj_set_style_text_align(label1, LV_PART_MAIN, LV_STATE_DEFAULT, LV_TEXT_ALIGN_CENTER); - lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, -40); - - - lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/ - lv_obj_set_width(label2, 150); - lv_label_set_text(label2, "It is a circularly scrolling text. "); - lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 40); -} - -#endif diff --git a/examples/widgets/label/lv_label_example_1.py b/examples/widgets/label/lv_label_example_1.py deleted file mode 100644 index 659d3d9e88..0000000000 --- a/examples/widgets/label/lv_label_example_1.py +++ /dev/null @@ -1,14 +0,0 @@ -label1 = lv.label(lv.scr_act()) -label1.set_long_mode(lv.label.LONG.BREAK) # Break the long lines -label1.set_recolor(True) # Enable re-coloring by commands in the text -label1.set_align(lv.label.ALIGN.CENTER) # Center aligned lines -label1.set_text("#000080 Re-color# #0000ff words# #6666ff of a# label " + - "and wrap long text automatically.") -label1.set_width(150) -label1.align(None, lv.ALIGN.CENTER, 0, -30) - -label2 = lv.label(lv.scr_act()) -label2.set_long_mode(lv.label.LONG.SROLL_CIRC) # Circular scroll -label2.set_width(150) -label2.set_text("It is a circularly scrolling text. ") -label2.align(None, lv.ALIGN.CENTER, 0, 30) \ No newline at end of file diff --git a/examples/widgets/label/lv_label_example_2.c b/examples/widgets/label/lv_label_example_2.c deleted file mode 100644 index 279c3af09c..0000000000 --- a/examples/widgets/label/lv_label_example_2.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_LABEL - -/** - * Create a fake text shadow - */ -void lv_ex_label_2(void) -{ - /* Create a style for the shadow*/ - static lv_style_t style_shadow; - lv_style_init(&style_shadow); - lv_style_set_text_opa(&style_shadow, LV_OPA_30); - lv_style_set_text_color(&style_shadow, LV_COLOR_BLACK); - - /*Create a label for the shadow first (it's in the background) */ - lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL); - lv_obj_add_style(shadow_label, LV_PART_MAIN, LV_STATE_DEFAULT, &style_shadow); - - /* Create the main label */ - lv_obj_t * main_label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(main_label, "A simple method to create\n" - "shadows on a text.\n" - "It even works with\n\n" - "newlines and spaces."); - - /*Set the same text for the shadow label*/ - lv_label_set_text(shadow_label, lv_label_get_text(main_label)); - - /* Position the main label */ - lv_obj_align(main_label, NULL, LV_ALIGN_CENTER, 0, 0); - - /* Shift the second label down and to the right by 2 pixel */ - lv_obj_align(shadow_label, main_label, LV_ALIGN_IN_TOP_LEFT, 2, 2); -} - -#endif diff --git a/examples/widgets/label/lv_label_example_2.py b/examples/widgets/label/lv_label_example_2.py deleted file mode 100644 index c25e59ad2d..0000000000 --- a/examples/widgets/label/lv_label_example_2.py +++ /dev/null @@ -1,24 +0,0 @@ -# Create a style for the shadow -label_style = lv.style_t() -lv.style_copy(label_style, lv.style_plain) -label_style.text.opa = lv.OPA._50 - -# Create a label for the shadow first (it's in the background) -shadow_label = lv.label(lv.scr_act()) -shadow_label.set_style(lv.label.STYLE.MAIN, label_style) - -# Create the main label -main_label = lv.label(lv.scr_act()) -main_label.set_text("A simple method to create\n" + - "shadows on text\n" + - "It even works with\n\n" + - "newlines and spaces.") - -# Set the same text for the shadow label -shadow_label.set_text(main_label.get_text()) - -# Position the main label -main_label.align(None, lv.ALIGN.CENTER, 0, 0) - -# Shift the second label down and to the right by 1 pixel -shadow_label.align(main_label, lv.ALIGN.IN_TOP_LEFT, 1, 1) \ No newline at end of file diff --git a/examples/widgets/led/lv_led_example_1.c b/examples/widgets/led/lv_led_example_1.c deleted file mode 100644 index ccbe5cff34..0000000000 --- a/examples/widgets/led/lv_led_example_1.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_LED - -void lv_ex_led_1(void) -{ - /*Create a LED and switch it OFF*/ - lv_obj_t * led1 = lv_led_create(lv_scr_act()); - lv_obj_align(led1, NULL, LV_ALIGN_CENTER, -80, 0); - lv_led_off(led1); - - /*Copy the previous LED and set a brightness*/ - lv_obj_t * led2 = lv_led_create(lv_scr_act()); - lv_obj_align(led2, NULL, LV_ALIGN_CENTER, 0, 0); - lv_led_set_bright(led2, 150); - - /*Copy the previous LED and switch it ON*/ - lv_obj_t * led3 = lv_led_create(lv_scr_act()); - lv_obj_align(led3, NULL, LV_ALIGN_CENTER, 80, 0); - lv_led_on(led3); -} - -#endif diff --git a/examples/widgets/led/lv_led_example_1.py b/examples/widgets/led/lv_led_example_1.py deleted file mode 100644 index dc17829983..0000000000 --- a/examples/widgets/led/lv_led_example_1.py +++ /dev/null @@ -1,27 +0,0 @@ -# Create a style for the LED -style_led = lv.style_t() -lv.style_copy(style_led, lv.style_pretty_color) -style_led.body.radius = 800 # large enough to draw a circle -style_led.body.main_color = lv.color_make(0xb5, 0x0f, 0x04) -style_led.body.grad_color = lv.color_make(0x50, 0x07, 0x02) -style_led.body.border.color = lv.color_make(0xfa, 0x0f, 0x00) -style_led.body.border.width = 3 -style_led.body.border.opa = lv.OPA._30 -style_led.body.shadow.color = lv.color_make(0xb5, 0x0f, 0x04) -style_led.body.shadow.width = 5 - -# Create a LED and switch it OFF -led1 = lv.led(lv.scr_act()) -led1.set_style(lv.led.STYLE.MAIN, style_led) -led1.align(None, lv.ALIGN.CENTER, -80, 0) -led1.off() - -# Copy the previous LED and set a brightness -led2 = lv.led(lv.scr_act(), led1) -led2.align(None, lv.ALIGN.CENTER, 0, 0) -led2.set_bright(190) - -# Copy the previous LED and switch it ON -led3 = lv.led(lv.scr_act(), led1) -led3.align(None, lv.ALIGN.CENTER, 80, 0) -led3.on() \ No newline at end of file diff --git a/examples/widgets/line/lv_line_example_1.c b/examples/widgets/line/lv_line_example_1.c deleted file mode 100644 index 8a5fb1debf..0000000000 --- a/examples/widgets/line/lv_line_example_1.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_LINE - -void lv_ex_line_1(void) -{ - /*Create an array for the points of the line*/ - static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} }; - - /*Create style*/ - static lv_style_t style_line; - lv_style_init(&style_line); - lv_style_set_line_width(&style_line, 8); - lv_style_set_line_color(&style_line, LV_COLOR_BLUE); - lv_style_set_line_rounded(&style_line, true); - - /*Create a line and apply the new style*/ - lv_obj_t * line1; - line1 = lv_line_create(lv_scr_act(), NULL); - lv_line_set_points(line1, line_points, 5); /*Set the points*/ - lv_obj_add_style(line1, LV_PART_MAIN, LV_STATE_DEFAULT, &style_line); /*Set the points*/ - lv_obj_align(line1, NULL, LV_ALIGN_CENTER, 0, 0); -} - -#endif diff --git a/examples/widgets/line/lv_line_example_1.py b/examples/widgets/line/lv_line_example_1.py deleted file mode 100644 index a590d23af5..0000000000 --- a/examples/widgets/line/lv_line_example_1.py +++ /dev/null @@ -1,19 +0,0 @@ -# Create an array for the points of the line -line_points = [ {"x":5, "y":5}, - {"x":70, "y":70}, - {"x":120, "y":10}, - {"x":180, "y":60}, - {"x":240, "y":10}] - -# Create new style (thick dark blue) -style_line = lv.style_t() -lv.style_copy(style_line, lv.style_plain) -style_line.line.color = lv.color_make(0x00, 0x3b, 0x75) -style_line.line.width = 3 -style_line.line.rounded = 1 - -# Copy the previous line and apply the new style -line1 = lv.line(lv.scr_act()) -line1.set_points(line_points, len(line_points)) # Set the points -line1.set_style(lv.line.STYLE.MAIN, style_line) -line1.align(None, lv.ALIGN.CENTER, 0, 0) \ No newline at end of file diff --git a/examples/widgets/list/lv_list__example_1.py b/examples/widgets/list/lv_list__example_1.py deleted file mode 100644 index 22a0db2f47..0000000000 --- a/examples/widgets/list/lv_list__example_1.py +++ /dev/null @@ -1,25 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.CLICKED: - print("Clicked: %s" % lv.list.get_btn_text(obj)) - -# Create a list -list1 = lv.list(lv.scr_act()) -list1.set_size(160, 200) -list1.align(None, lv.ALIGN.CENTER, 0, 0) - -# Add buttons to the list - -list_btn = list1.add_btn(lv.SYMBOL.FILE, "New") -list_btn.set_event_cb(event_handler) - -list_btn = list1.add_btn(lv.SYMBOL.DIRECTORY, "Open") -list_btn.set_event_cb(event_handler) - -list_btn = list1.add_btn(lv.SYMBOL.CLOSE, "Delete") -list_btn.set_event_cb(event_handler) - -list_btn = list1.add_btn(lv.SYMBOL.EDIT, "Edit") -list_btn.set_event_cb(event_handler) - -list_btn = list1.add_btn(lv.SYMBOL.SAVE, "Save") -list_btn.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/list/lv_list_example_1.c b/examples/widgets/list/lv_list_example_1.c deleted file mode 100644 index bc2017a228..0000000000 --- a/examples/widgets/list/lv_list_example_1.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_LIST - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_CLICKED) { - printf("Clicked: %s\n", lv_list_get_btn_text(obj)); - } -} -void lv_list_example_1(void) -{ - /*Create a list*/ - lv_obj_t * list1 = lv_list_create(lv_scr_act()); - lv_obj_align(list1, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Add buttons to the list*/ - lv_list_add_text(list1, "File"); - lv_list_add_btn(list1, LV_SYMBOL_FILE, "New", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_DIRECTORY, "Open", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_SAVE, "Save", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "Delete", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_EDIT, "Edit", event_handler); - lv_list_add_text(list1, "Connectivity"); - lv_list_add_btn(list1, LV_SYMBOL_BLUETOOTH, "Bluetooth", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_GPS, "Navigation", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_USB, "USB", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_BATTERY_FULL, "Battery", event_handler); - lv_list_add_text(list1, "Exit"); - lv_list_add_btn(list1, LV_SYMBOL_OK, "Apply", event_handler); - lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "Close", event_handler); -} - -#endif diff --git a/examples/widgets/lv_img/index.rst b/examples/widgets/lv_img/index.rst deleted file mode 100644 index 5f47ada01b..0000000000 --- a/examples/widgets/lv_img/index.rst +++ /dev/null @@ -1,21 +0,0 @@ -C -^ - -Image from variable and symbol -""""""""""""""""""""""""""""""" - -.. lv_example:: lv_ex_widgets/lv_ex_img/lv_ex_img_1 - :language: c - - -Image recoloring -"""""""""""""""" - -.. lv_example:: lv_ex_widgets/lv_ex_img/lv_ex_img_2 - :language: c - - -MicroPython -^^^^^^^^^^^ - -No examples yet. diff --git a/examples/widgets/lv_img/lv_img_example_1.c b/examples/widgets/lv_img/lv_img_example_1.c deleted file mode 100644 index 817cea7e6c..0000000000 --- a/examples/widgets/lv_img/lv_img_example_1.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_IMG - -/* Find the image here: https://github.com/lvgl/lv_examples/tree/master/assets */ -LV_IMG_DECLARE(img_cogwheel_argb); - -void lv_ex_img_1(void) -{ - lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(img1, &img_cogwheel_argb); - lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, -20); - - lv_obj_t * img2 = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(img2, LV_SYMBOL_OK "Accept"); - lv_obj_align(img2, img1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); -} - -#endif diff --git a/examples/widgets/lv_img/lv_img_example_1.py b/examples/widgets/lv_img/lv_img_example_1.py deleted file mode 100644 index 75325ccc7e..0000000000 --- a/examples/widgets/lv_img/lv_img_example_1.py +++ /dev/null @@ -1,29 +0,0 @@ -from imagetools import get_png_info, open_png - -# Register PNG image decoder -decoder = lv.img.decoder_create() -decoder.info_cb = get_png_info -decoder.open_cb = open_png - -# Create a screen with a draggable image - -with open('cogwheel.png','rb') as f: - png_data = f.read() - -png_img_dsc = lv.img_dsc_t({ - 'data_size': len(png_data), - 'data': png_data -}) - -scr = lv.scr_act() - -# Create an image on the left using the decoder - -# lv.img.cache_set_size(2) -img1 = lv.img(scr) -img1.align(scr, lv.ALIGN.CENTER, 0, -20) -img1.set_src(png_img_dsc) - -img2 = lv.img(scr) -img2.set_src(lv.SYMBOL.OK + "Accept") -img2.align(img1, lv.ALIGN.OUT_BOTTOM_MID, 0, 20) \ No newline at end of file diff --git a/examples/widgets/lv_img/lv_img_example_2.c b/examples/widgets/lv_img/lv_img_example_2.c deleted file mode 100644 index 45212ebefb..0000000000 --- a/examples/widgets/lv_img/lv_img_example_2.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_IMG - -static lv_obj_t * create_slider(lv_color_t color); -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); - -static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider; -static lv_obj_t * img1; - - -/** - * Demonstrate runtime image re-coloring - */ -void lv_ex_img_2(void) -{ - /*Create 4 sliders to adjust RGB color and re-color intensity*/ - red_slider = create_slider(LV_COLOR_RED); - green_slider = create_slider(LV_COLOR_LIME); - blue_slider = create_slider(LV_COLOR_BLUE); - intense_slider = create_slider(LV_COLOR_GRAY); - - lv_slider_set_value(red_slider, LV_OPA_20, LV_ANIM_OFF); - lv_slider_set_value(green_slider, LV_OPA_90, LV_ANIM_OFF); - lv_slider_set_value(blue_slider, LV_OPA_60, LV_ANIM_OFF); - lv_slider_set_value(intense_slider, LV_OPA_50, LV_ANIM_OFF); - - lv_obj_align(red_slider, NULL, LV_ALIGN_IN_LEFT_MID, 25, 0); - lv_obj_align(green_slider, red_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0); - lv_obj_align(blue_slider, green_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0); - lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0); - - /* Now create the actual image */ - LV_IMG_DECLARE(img_cogwheel_argb); - img1 = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(img1, &img_cogwheel_argb); - lv_obj_align(img1, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0); - - lv_event_send(intense_slider, LV_EVENT_VALUE_CHANGED, NULL); -} - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - /* Recolor the image based on the sliders' values */ - lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); - lv_opa_t intense = lv_slider_get_value(intense_slider); - lv_obj_set_style_img_recolor_opa(img1, LV_PART_MAIN, LV_STATE_DEFAULT, intense); - lv_obj_set_style_img_recolor(img1, LV_PART_MAIN, LV_STATE_DEFAULT, color); - } -} - -static lv_obj_t * create_slider(lv_color_t color) -{ - lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL); - lv_slider_set_range(slider, 0, 255); - lv_obj_set_size(slider, 10, 200); - lv_obj_set_style_bg_color(slider, LV_PART_KNOB, LV_STATE_DEFAULT, color); - lv_obj_set_style_bg_color(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, lv_color_darken(color, LV_OPA_40)); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); - return slider; - -} - -#endif diff --git a/examples/widgets/lv_img/lv_img_example_3.c b/examples/widgets/lv_img/lv_img_example_3.c deleted file mode 100644 index e2891df379..0000000000 --- a/examples/widgets/lv_img/lv_img_example_3.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_IMG - -LV_IMG_DECLARE(img_cogwheel_argb); - -/** - * Show transformations (zoom and rotation) using a pivot point. - */ -void lv_ex_img_3(void) -{ - /* Now create the actual image */ - lv_obj_t * img = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(img, &img_cogwheel_argb); - lv_obj_align(img, NULL, LV_ALIGN_CENTER, 50, 50); - lv_img_set_pivot(img, 0, 0); /*Rotate around the top left corner*/ - - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_var(&a, img); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_img_set_angle); - lv_anim_set_values(&a, 0, 3600); - lv_anim_set_time(&a, 5000); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_start(&a); - - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_img_set_zoom); - lv_anim_set_values(&a, 128, 256); - lv_anim_set_playback_time(&a, 3000); - lv_anim_start(&a); - -} - -#endif diff --git a/examples/widgets/lv_img/lv_img_example_4.c b/examples/widgets/lv_img/lv_img_example_4.c deleted file mode 100644 index b3cb896489..0000000000 --- a/examples/widgets/lv_img/lv_img_example_4.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_IMG - -LV_IMG_DECLARE(img_skew_strip); - -/** - * Image styling and offset - */ -void lv_ex_img_4(void) -{ - static lv_style_t style; - lv_style_init(&style); - lv_style_set_bg_color(&style, LV_COLOR_YELLOW); - lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_img_recolor_opa(&style, LV_OPA_COVER); - lv_style_set_img_recolor(&style, LV_COLOR_BLACK); - - lv_obj_t * img = lv_img_create(lv_scr_act(), NULL); - lv_obj_add_style(img, LV_PART_MAIN, LV_STATE_DEFAULT, &style); - lv_img_set_src(img, &img_skew_strip); - lv_obj_set_size(img, 150, 100); - lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_var(&a, img); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_img_set_offset_y); - lv_anim_set_values(&a, 0, 100); - lv_anim_set_time(&a, 3000); - lv_anim_set_playback_time(&a, 500); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_start(&a); - -} - -#endif diff --git a/examples/widgets/lv_widgets_example.h b/examples/widgets/lv_widgets_example.h deleted file mode 100644 index ba2f10862e..0000000000 --- a/examples/widgets/lv_widgets_example.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file lv_ex_widgets.h - * - */ - -#ifndef LV_EX_WIDGETS_H -#define LV_EX_WIDGETS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -void lv_ex_arc_1(void); -void lv_ex_arc_2(void); -void lv_ex_bar_1(void); -void lv_ex_btn_1(void); -void lv_ex_btn_2(void); -void lv_ex_btnmatrix_1(void); -void lv_ex_calendar_1(void); -void lv_ex_canvas_1(void); -void lv_ex_canvas_2(void); -void lv_ex_checkbox_1(void); -void lv_ex_chart_1(void); -void lv_ex_chart_2(void); -void lv_ex_dropdown_1(void); -void lv_ex_dropdown_2(void); -void lv_ex_gauge_1(void); -void lv_ex_gauge_2(void); -void lv_ex_img_1(void); -void lv_ex_img_2(void); -void lv_ex_img_3(void); -void lv_ex_imgbtn_1(void); -void lv_ex_keyboard_1(void); -void lv_ex_label_1(void); -void lv_ex_label_2(void); -void lv_ex_label_3(void); -void lv_ex_led_1(void); -void lv_ex_line_1(void); -void lv_ex_list_1(void); -void lv_ex_linemeter_1(void); -void lv_ex_msgbox_1(void); -void lv_ex_msgbox_2(void); -void lv_ex_obj_1(void); -void lv_ex_spinner_1(void); -void lv_ex_roller_1(void); -void lv_ex_slider_1(void); -void lv_ex_slider_2(void); -void lv_ex_switch_1(void); -void lv_ex_textarea_1(void); -void lv_ex_objmask_1(void); -void lv_ex_objmask_2(void); -void lv_ex_table_1(void); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_EX_WIDGETS_H*/ diff --git a/examples/widgets/meter/lv_meter_example_1.c b/examples/widgets/meter/lv_meter_example_1.c deleted file mode 100644 index 8a0decae4e..0000000000 --- a/examples/widgets/meter/lv_meter_example_1.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_METER - -static lv_obj_t * meter; - -static void set_value(lv_meter_indicator_t * indic, int32_t v) -{ - lv_meter_set_indicator_value(meter, indic, v); -} - -/** - * A simple meter - */ -void lv_ex_meter_1(void) -{ - meter = lv_meter_create(lv_scr_act(), NULL); - lv_obj_align(meter, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Add a scale first*/ - lv_meter_scale_t * scale = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale, 51, 2, 10, LV_COLOR_GRAY); - lv_meter_set_scale_major_ticks(meter, scale, 10, 4, 15, LV_COLOR_BLACK, 10); - - lv_meter_indicator_t * indic; - - /*Add a red arc to the end */ - indic = lv_meter_add_arc(meter, scale, 3, LV_COLOR_RED, 1); - lv_meter_set_indicator_start_value(meter, indic, 80); - lv_meter_set_indicator_end_value(meter, indic, 100); - - /*Make the tick lines red at the end of the scale*/ - indic = lv_meter_add_scale_lines(meter, scale, LV_COLOR_RED, LV_COLOR_RED, false, 0); - lv_meter_set_indicator_start_value(meter, indic, 80); - lv_meter_set_indicator_end_value(meter, indic, 100); - - /*Add a needle line indicator*/ - indic = lv_meter_add_needle_line(meter, scale, 4, LV_COLOR_GRAY, -10); - - /*Create an animation to set the value*/ - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) set_value); - lv_anim_set_var(&a, indic); - lv_anim_set_values(&a, 0, 100); - lv_anim_set_time(&a, 2000); - lv_anim_set_repeat_delay(&a, 100); - lv_anim_set_playback_time(&a, 500); - lv_anim_set_playback_delay(&a, 100); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_start(&a); -} - -#endif diff --git a/examples/widgets/meter/lv_meter_example_2.c b/examples/widgets/meter/lv_meter_example_2.c deleted file mode 100644 index f674ea58b8..0000000000 --- a/examples/widgets/meter/lv_meter_example_2.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_METER - -static lv_obj_t * meter; - -static void set_value(lv_meter_indicator_t * indic, int32_t v) -{ - lv_meter_set_indicator_end_value(meter, indic, v); -} - - -/** - * A meter with multiple arcs - */ -void lv_ex_meter_2(void) -{ - meter = lv_meter_create(lv_scr_act(), NULL); - lv_obj_align(meter, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Remove the circle from the middle*/ - lv_obj_remove_style(meter, LV_PART_INDICATOR, LV_STATE_ANY, NULL); - - /*Add a scale first*/ - lv_meter_scale_t * scale = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, LV_COLOR_GRAY); - lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10); - lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90); - - /*Add a three arc indicator */ - lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_RED, 0); - lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_GREEN, -10); - lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_BLUE, -20); - - /*Create an animation to set the value*/ - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) set_value); - lv_anim_set_values(&a, 0, 100); - lv_anim_set_repeat_delay(&a, 100); - lv_anim_set_playback_delay(&a, 100); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - - lv_anim_set_time(&a, 2000); - lv_anim_set_playback_time(&a, 500); - lv_anim_set_var(&a, indic1); - lv_anim_start(&a); - - lv_anim_set_time(&a, 1000); - lv_anim_set_playback_time(&a, 1000); - lv_anim_set_var(&a, indic2); - lv_anim_start(&a); - - lv_anim_set_time(&a, 1000); - lv_anim_set_playback_time(&a, 2000); - lv_anim_set_var(&a, indic3); - lv_anim_start(&a); -} - -#endif diff --git a/examples/widgets/meter/lv_meter_example_3.c b/examples/widgets/meter/lv_meter_example_3.c deleted file mode 100644 index 9b9aecd0b6..0000000000 --- a/examples/widgets/meter/lv_meter_example_3.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_METER - -static lv_obj_t * meter; - -static void set_value(lv_meter_indicator_t * indic, int32_t v) -{ - lv_meter_set_indicator_end_value(meter, indic, v); -} - - -/** - * A clock from a meter - */ -void lv_ex_meter_3(void) -{ - meter = lv_meter_create(lv_scr_act(), NULL); - lv_obj_align(meter, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Create a scale for the minutes*/ - /*61 ticks in a 360 degrees range (the last and the first line overlaps)*/ - lv_meter_scale_t * scale_min = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, LV_COLOR_GRAY); - lv_meter_set_scale_range(meter, scale_min, 0, 60, 360, 270); - - /*Create an other scale for the hours. It's only visual and contains only major ticks*/ - lv_meter_scale_t * scale_hour = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, LV_COLOR_GRAY); /*12 ticks*/ - lv_meter_set_scale_major_ticks(meter, scale_hour, 1, 2, 20, LV_COLOR_BLACK, 10); /*Every tick is major*/ - lv_meter_set_scale_range(meter, scale_hour, 1, 12, 330, 300); /*[1..12] values in an almost full circle*/ - - LV_IMG_DECLARE(img_hand) - - /*Add a the hands from images */ - lv_meter_indicator_t * indic_min = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5); - lv_meter_indicator_t * indic_hour = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5); - - /*Create an animation to set the value*/ - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) set_value); - lv_anim_set_values(&a, 0, 60); - lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_set_time(&a, 2000); /*2 sec for 1 turn of the minute hand (1 hour)*/ - lv_anim_set_var(&a, indic_min); - lv_anim_start(&a); - - lv_anim_set_var(&a, indic_hour); - lv_anim_set_time(&a, 24000); /*24 sec for 1 turn of the hour hand*/ - lv_anim_set_values(&a, 0, 60); - lv_anim_start(&a); -} - -#endif diff --git a/examples/widgets/meter/lv_meter_example_4.c b/examples/widgets/meter/lv_meter_example_4.c deleted file mode 100644 index 534f1d0cb2..0000000000 --- a/examples/widgets/meter/lv_meter_example_4.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_METER - -/** - * Create a pie chart - */ -void lv_ex_meter_4(void) -{ - lv_obj_t * meter = lv_meter_create(lv_scr_act(), NULL); - lv_obj_align(meter, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Remove the background and the circle from the middle*/ - lv_obj_remove_style(meter, LV_PART_MAIN, LV_STATE_ANY, NULL); - lv_obj_remove_style(meter, LV_PART_INDICATOR, LV_STATE_ANY, NULL); - - /*Add a scale first with no ticks.*/ - lv_meter_scale_t * scale = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, LV_COLOR_BLACK); - lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0); - - /*Add a three arc indicator */ - lv_coord_t indic_w = lv_obj_get_width(meter) / 2; - lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_ORANGE, 0); - lv_meter_set_indicator_start_value(meter, indic1, 0); - lv_meter_set_indicator_end_value(meter, indic1, 40); - - lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_GREEN, 0); - lv_meter_set_indicator_start_value(meter, indic2, 40); /*Start from the previous*/ - lv_meter_set_indicator_end_value(meter, indic2, 80); - - lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_BLUE, 0); - lv_meter_set_indicator_start_value(meter, indic3, 80); /*Start from the previous*/ - lv_meter_set_indicator_end_value(meter, indic3, 100); -} - -#endif diff --git a/examples/widgets/msgbox/lv_msgbox_example_1.c b/examples/widgets/msgbox/lv_msgbox_example_1.c deleted file mode 100644 index c13a797408..0000000000 --- a/examples/widgets/msgbox/lv_msgbox_example_1.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_MSGBOX - -static void event_cb(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - printf("Button: %s\n", lv_msgbox_get_active_btn_text(obj)); - } -} - -void lv_ex_msgbox_1(void) -{ -// static lv_style_t style; -// lv_style_init(&style); -// lv_style_set_radius(&style, LV_STATE_DEFAULT, 30); - - static const char * btns[] ={"Apply", "Close", ""}; - - lv_obj_t * mbox1 = lv_msgbox_create("Hello", "This is a message box with two buttons.", btns, true); -// lv_obj_set_width(mbox1, 300); - lv_obj_add_event_cb(mbox1, event_cb, NULL); - lv_obj_align(mbox1, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the corner*/ -} - -#endif diff --git a/examples/widgets/msgbox/lv_msgbox_example_1.py b/examples/widgets/msgbox/lv_msgbox_example_1.py deleted file mode 100644 index 31c59f534d..0000000000 --- a/examples/widgets/msgbox/lv_msgbox_example_1.py +++ /dev/null @@ -1,12 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("Button: %s" % lv.mbox.get_active_btn_text(obj)) - -btns = ["Apply", "Close", ""] - -mbox1 = lv.mbox(lv.scr_act()) -mbox1.set_text("A message box with two buttons."); -mbox1.add_btns(btns) -mbox1.set_width(200) -mbox1.set_event_cb(event_handler) -mbox1.align(None, lv.ALIGN.CENTER, 0, 0) # Align to the corner \ No newline at end of file diff --git a/examples/widgets/msgbox/lv_msgbox_example_2.c b/examples/widgets/msgbox/lv_msgbox_example_2.c deleted file mode 100644 index 80ba7242b5..0000000000 --- a/examples/widgets/msgbox/lv_msgbox_example_2.c +++ /dev/null @@ -1,94 +0,0 @@ -//#include "../../../lvgl.h" -//#if LV_USE_MSGBOX -// -//static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt); -//static void btn_event_cb(lv_obj_t *btn, lv_event_t evt); -//static void opa_anim(void * bg, lv_anim_value_t v); -// -//static lv_obj_t *mbox, *info; -//static lv_style_t style_modal; -// -//static const char welcome_info[] = "Welcome to the modal message box demo!\n" -// "Press the button to display a message box."; -// -//static const char in_msg_info[] = "Notice that you cannot touch " -// "the button again while the message box is open."; -// -//void lv_ex_msgbox_2(void) -//{ -// lv_style_init(&style_modal); -// lv_style_set_bg_color(&style_modal, LV_STATE_DEFAULT, LV_COLOR_BLACK); -// -// /* Create a button, then set its position and event callback */ -// lv_obj_t *btn = lv_btn_create(lv_scr_act(), NULL); -// lv_obj_set_size(btn, 200, 60); -// lv_obj_set_event_cb(btn, btn_event_cb); -// lv_obj_align(btn, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 20); -// -// /* Create a label on the button */ -// lv_obj_t *label = lv_label_create(btn, NULL); -// lv_label_set_text(label, "Display a message box!"); -// -// /* Create an informative label on the screen */ -// info = lv_label_create(lv_scr_act(), NULL); -// lv_label_set_text(info, welcome_info); -// lv_label_set_long_mode(info, LV_LABEL_LONG_BREAK); /* Make sure text will wrap */ -// lv_obj_set_width(info, LV_HOR_RES - 10); -// lv_obj_align(info, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 5, -5); -// -//} -// -//static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt) -//{ -// if(evt == LV_EVENT_DELETE && obj == mbox) { -// /* Delete the parent modal background */ -// lv_obj_del_async(lv_obj_get_parent(mbox)); -// mbox = NULL; /* happens before object is actually deleted! */ -// lv_label_set_text(info, welcome_info); -// } else if(evt == LV_EVENT_VALUE_CHANGED) { -// /* A button was clicked */ -// lv_msgbox_start_auto_close(mbox, 0); -// } -//} -// -//static void btn_event_cb(lv_obj_t *btn, lv_event_t evt) -//{ -// if(evt == LV_EVENT_CLICKED) { -// /* Create a full-screen background */ -// -// /* Create a base object for the modal background */ -// lv_obj_t *obj = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN); -// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style_modal); -// lv_obj_set_pos(obj, 0, 0); -// lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); -// -// static const char * btns2[] = {"Ok", "Cancel", ""}; -// -// /* Create the message box as a child of the modal background */ -// mbox = lv_msgbox_create(obj, NULL); -// lv_msgbox_add_btns(mbox, btns2); -// lv_msgbox_set_text(mbox, "Hello world!"); -// lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_set_event_cb(mbox, mbox_event_cb); -// -// /* Fade the message box in with an animation */ -// lv_anim_t a; -// lv_anim_init(&a); -// lv_anim_set_var(&a, obj); -// lv_anim_set_time(&a, 500); -// lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_50); -// lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_anim); -// lv_anim_start(&a); -// -// lv_label_set_text(info, in_msg_info); -// lv_obj_align(info, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 5, -5); -// } -//} -// -//static void opa_anim(void * bg, lv_anim_value_t v) -//{ -// lv_obj_set_style_local_bg_opa(bg, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v); -//} -// -//#endif diff --git a/examples/widgets/msgbox/lv_msgbox_example_2.py b/examples/widgets/msgbox/lv_msgbox_example_2.py deleted file mode 100644 index ed6c05335e..0000000000 --- a/examples/widgets/msgbox/lv_msgbox_example_2.py +++ /dev/null @@ -1,86 +0,0 @@ -welcome_info = "Welcome to the modal message box demo!\nPress the button to display a message box." -in_msg_info = "Notice that you cannot touch the button again while the message box is open." - -class Modal(lv.mbox): - """mbox with semi-transparent background""" - def __init__(self, parent, *args, **kwargs): - # Create a full-screen background - modal_style = lv.style_t() - lv.style_copy(modal_style, lv.style_plain_color) - # Set the background's style - modal_style.body.main_color = modal_style.body.grad_color = lv.color_make(0,0,0) - modal_style.body.opa = lv.OPA._50 - - # Create a base object for the modal background - self.bg = lv.obj(parent) - self.bg.set_style(modal_style) - self.bg.set_pos(0, 0) - self.bg.set_size(parent.get_width(), parent.get_height()) - self.bg.set_opa_scale_enable(True) # Enable opacity scaling for the animation - - super().__init__(self.bg, *args, **kwargs) - self.align(None, lv.ALIGN.CENTER, 0, 0) - - # Fade the message box in with an animation - a = lv.anim_t() - lv.anim_init(a) - lv.anim_set_time(a, 500, 0) - lv.anim_set_values(a, lv.OPA.TRANSP, lv.OPA.COVER) - lv.anim_set_exec_cb(a, self.bg, lv.obj.set_opa_scale) - lv.anim_create(a) - super().set_event_cb(self.default_callback) - - def set_event_cb(self, callback): - self.callback = callback - - def get_event_cb(self): - return self.callback - - def default_callback(self, obj, evt): - if evt == lv.EVENT.DELETE:# and obj == self: - # Delete the parent modal background - self.get_parent().del_async() - elif evt == lv.EVENT.VALUE_CHANGED: - # A button was clicked - self.start_auto_close(0) - # Call user-defined callback - if self.callback is not None: - self.callback(obj, evt) - -def mbox_event_cb(obj, evt): - if evt == lv.EVENT.DELETE: - info.set_text(welcome_info) - -def btn_event_cb(btn, evt): - if evt == lv.EVENT.CLICKED: - - btns2 = ["Ok", "Cancel", ""] - - # Create the message box as a child of the modal background - mbox = Modal(lv.scr_act()) - mbox.add_btns(btns2) - mbox.set_text("Hello world!") - mbox.set_event_cb(mbox_event_cb) - - info.set_text(in_msg_info) - info.align(None, lv.ALIGN.IN_BOTTOM_LEFT, 5, -5) - -# Get active screen -scr = lv.scr_act() - -# Create a button, then set its position and event callback -btn = lv.btn(scr) -btn.set_size(200, 60) -btn.set_event_cb(btn_event_cb) -btn.align(None, lv.ALIGN.IN_TOP_LEFT, 20, 20) - -# Create a label on the button -label = lv.label(btn) -label.set_text("Display a message box!") - -# Create an informative label on the screen -info = lv.label(scr) -info.set_text(welcome_info) -info.set_long_mode(lv.label.LONG.BREAK) # Make sure text will wrap -info.set_width(scr.get_width() - 10) -info.align(None, lv.ALIGN.IN_BOTTOM_LEFT, 5, -5) \ No newline at end of file diff --git a/examples/widgets/obj/lv_obj_example_1.c b/examples/widgets/obj/lv_obj_example_1.c deleted file mode 100644 index 22115cb230..0000000000 --- a/examples/widgets/obj/lv_obj_example_1.c +++ /dev/null @@ -1,21 +0,0 @@ -//#include "../../../lvgl.h" -// -//void lv_ex_obj_1(void) -//{ -// lv_obj_t * obj1; -// obj1 = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_set_size(obj1, 100, 50); -// lv_obj_align(obj1, NULL, LV_ALIGN_CENTER, -60, -30); -// -// static lv_style_t style_shadow; -// lv_style_init(&style_shadow); -// lv_style_set_shadow_width(&style_shadow, LV_STATE_DEFAULT, 10); -// lv_style_set_shadow_spread(&style_shadow, LV_STATE_DEFAULT, 5); -// lv_style_set_shadow_color(&style_shadow, LV_STATE_DEFAULT, LV_COLOR_BLUE); -// -// /*Copy the previous object (drag is already enabled)*/ -// lv_obj_t * obj3; -// obj3 = lv_obj_create(lv_scr_act(), NULL); -// lv_obj_add_style(obj3, LV_OBJ_PART_MAIN, &style_shadow); -// lv_obj_align(obj3, NULL, LV_ALIGN_CENTER, 60, 30); -//} diff --git a/examples/widgets/obj/lv_obj_example_1.py b/examples/widgets/obj/lv_obj_example_1.py deleted file mode 100644 index 3a22ab74c6..0000000000 --- a/examples/widgets/obj/lv_obj_example_1.py +++ /dev/null @@ -1,20 +0,0 @@ -obj1 = lv.obj(lv.scr_act()) -obj1.set_size(100, 50) -obj1.set_style(lv.style_plain_color) -obj1.align(None, lv.ALIGN.CENTER, -60, -30) - -# Copy the previous object and enable drag -obj2 = lv.obj(lv.scr_act(), obj1) -obj2.set_style(lv.style_pretty_color) -obj2.align(None, lv.ALIGN.CENTER, 0, 0) -obj2.set_drag(True) - -style_shadow = lv.style_t() -lv.style_copy(style_shadow, lv.style_pretty) -style_shadow.body.shadow.width = 6 -style_shadow.body.radius = 800 # large enough to make it round - -# Copy the previous object (drag is already enabled) -obj3 = lv.obj(lv.scr_act(), obj2) -obj3.set_style(style_shadow) -obj3.align(None, lv.ALIGN.CENTER, 60, 30) \ No newline at end of file diff --git a/examples/widgets/roller/lv_roller_example_1.c b/examples/widgets/roller/lv_roller_example_1.c deleted file mode 100644 index de32568e98..0000000000 --- a/examples/widgets/roller/lv_roller_example_1.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_ROLLER - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - char buf[32]; - lv_roller_get_selected_str(obj, buf, sizeof(buf)); - printf("Selected month: %s\n", buf); - } -} - -/** - * An infinite roller with the name of the months - */ -void lv_ex_roller_1(void) -{ - lv_obj_t *roller1 = lv_roller_create(lv_scr_act(), NULL); - lv_roller_set_options(roller1, - "January\n" - "February\n" - "March\n" - "April\n" - "May\n" - "June\n" - "July\n" - "August\n" - "September\n" - "October\n" - "November\n" - "December", - LV_ROLLER_MODE_INFINITE); - - lv_roller_set_visible_row_count(roller1, 4); - lv_obj_align(roller1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(roller1, event_handler, NULL); -} - -#endif diff --git a/examples/widgets/roller/lv_roller_example_1.py b/examples/widgets/roller/lv_roller_example_1.py deleted file mode 100644 index f99015778e..0000000000 --- a/examples/widgets/roller/lv_roller_example_1.py +++ /dev/null @@ -1,24 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - option = " "*10 - obj.get_selected_str(option, len(option)) - print("Selected month: %s" % option.strip()) - -roller1 = lv.roller(lv.scr_act()) -roller1.set_options("\n".join([ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"]), lv.roller.MODE.INIFINITE) - -roller1.set_visible_row_count(4) -roller1.align(None, lv.ALIGN.CENTER, 0, 0) -roller1.set_event_cb(event_handler) diff --git a/examples/widgets/roller/lv_roller_example_2.c b/examples/widgets/roller/lv_roller_example_2.c index 93a4069466..db3cf308fc 100644 --- a/examples/widgets/roller/lv_roller_example_2.c +++ b/examples/widgets/roller/lv_roller_example_2.c @@ -14,7 +14,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) /** * Roller with various alignments and larger text in the selected area */ -void lv_ex_roller_2(void) +void lv_example_roller_2(void) { /*A style to make the selected option larger*/ static lv_style_t style_sel; diff --git a/examples/widgets/slider/lv_slider_example_1.c b/examples/widgets/slider/lv_slider_example_1.c deleted file mode 100644 index f3bf1024e7..0000000000 --- a/examples/widgets/slider/lv_slider_example_1.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_SLIDER - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); -static lv_obj_t * slider_label; - -/** - * A default slider with a label displaying the current value - */ -void lv_ex_slider_1(void) -{ - /* Create a slider in the center of the display */ - lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); - - /* Create a label below the slider */ - slider_label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(slider_label, "0%"); - - lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); -} - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - char buf[8]; - lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); - lv_label_set_text(slider_label, buf); - lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - } -} - -#endif diff --git a/examples/widgets/slider/lv_slider_example_1.py b/examples/widgets/slider/lv_slider_example_1.py deleted file mode 100644 index 655fbd1452..0000000000 --- a/examples/widgets/slider/lv_slider_example_1.py +++ /dev/null @@ -1,37 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("Value: %d" % obj.get_value()) - -# Create styles -style_bg = lv.style_t() -style_indic = lv.style_t() -style_knob = lv.style_t() - -lv.style_copy(style_bg, lv.style_pretty) -style_bg.body.main_color = lv.color_make(0,0,0) -style_bg.body.grad_color = lv.color_make(0x80, 0x80, 0x80) -style_bg.body.radius = 800 # large enough to make a circle -style_bg.body.border.color = lv.color_make(0xff,0xff,0xff) - -lv.style_copy(style_indic, lv.style_pretty_color) -style_indic.body.radius = 800 -style_indic.body.shadow.width = 8 -style_indic.body.shadow.color = style_indic.body.main_color -style_indic.body.padding.left = 3 -style_indic.body.padding.right = 3 -style_indic.body.padding.top = 3 -style_indic.body.padding.bottom = 3 - -lv.style_copy(style_knob, lv.style_pretty) -style_knob.body.radius = 800 -style_knob.body.opa = lv.OPA._70 -style_knob.body.padding.top = 10 -style_knob.body.padding.bottom = 10 - -# Create a slider -slider = lv.slider(lv.scr_act()) -slider.set_style(lv.slider.STYLE.BG, style_bg) -slider.set_style(lv.slider.STYLE.INDIC, style_indic) -slider.set_style(lv.slider.STYLE.KNOB, style_knob) -slider.align(None, lv.ALIGN.CENTER, 0, 0) -slider.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/slider/lv_slider_example_2.c b/examples/widgets/slider/lv_slider_example_2.c deleted file mode 100644 index 448a0d6b5a..0000000000 --- a/examples/widgets/slider/lv_slider_example_2.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_SLIDER - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); - -static lv_style_t style_pr; -static lv_style_t style_def; - -/** - * Show the current value when the slider if pressed (using only styles). - * - */ -void lv_ex_slider_2(void) -{ - lv_style_init(&style_def); - lv_style_set_content_opa(&style_def, LV_OPA_TRANSP); - lv_style_set_content_align(&style_def, LV_ALIGN_OUT_TOP_MID); - - lv_style_init(&style_pr); - lv_style_set_content_opa(&style_pr, LV_OPA_COVER); - lv_style_set_content_ofs_y(&style_pr, -15); - - /* Create a slider in the center of the display */ - lv_obj_t * slider; - slider = lv_slider_create(lv_scr_act(), NULL); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); - - lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_DEFAULT, &style_def); - lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style_pr); -} - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - static char buf[8]; - lv_snprintf(buf, sizeof(buf), "%u", lv_slider_get_value(slider)); - lv_obj_set_style_content_text(slider, LV_PART_KNOB, LV_STATE_DEFAULT, buf); - } -} - -#endif diff --git a/examples/widgets/slider/lv_slider_example_2.py b/examples/widgets/slider/lv_slider_example_2.py deleted file mode 100644 index be6c67591e..0000000000 --- a/examples/widgets/slider/lv_slider_example_2.py +++ /dev/null @@ -1,23 +0,0 @@ -def slider_event_cb(slider, event): - if event == lv.EVENT.VALUE_CHANGED: - slider_label.set_text("%u" % slider.get_value()) - -# Create a slider in the center of the display -slider = lv.slider(lv.scr_act()) -slider.set_width(200) -slider.align(None, lv.ALIGN.CENTER, 0, 0) -slider.set_event_cb(slider_event_cb) -slider.set_range(0, 100) - -# Create a label below the slider -slider_label = lv.label(lv.scr_act()) -slider_label.set_text("0") -slider_label.set_auto_realign(True) -slider_label.align(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10) - -# Create an informative label -info = lv.label(lv.scr_act()) -info.set_text("""Welcome to the slider+label demo! -Move the slider and see that the label -updates to match it.""") -info.align(None, lv.ALIGN.IN_TOP_LEFT, 10, 10) diff --git a/examples/widgets/slider/lv_slider_example_3.c b/examples/widgets/slider/lv_slider_example_3.c deleted file mode 100644 index 2bb0fc6b08..0000000000 --- a/examples/widgets/slider/lv_slider_example_3.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_SLIDER - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); - -/** - * Show the current value when the slider if pressed (using only styles). - * - */ -void lv_ex_slider_3(void) -{ - /* Create a slider in the center of the display */ - lv_obj_t * slider; - slider = lv_slider_create(lv_scr_act(), NULL); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); - lv_slider_set_type(slider, LV_SLIDER_TYPE_RANGE); - - lv_slider_set_value(slider, 70, LV_ANIM_OFF); - lv_slider_set_left_value(slider, 20, LV_ANIM_OFF); - - /*Now use only a local style.*/ - lv_obj_set_style_content_ofs_y(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, -20); - - /*To update the avlue text*/ - lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL); -} - -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - static char buf[8]; - lv_snprintf(buf, sizeof(buf), "%d - %d", lv_slider_get_value(slider), lv_slider_get_left_value(slider)); - lv_obj_set_style_content_text(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, buf); - } -} - -#endif diff --git a/examples/widgets/spinbox/lv_spinbox_example_1.c b/examples/widgets/spinbox/lv_spinbox_example_1.c deleted file mode 100644 index d3d191c3a8..0000000000 --- a/examples/widgets/spinbox/lv_spinbox_example_1.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_SPINBOX - -static lv_obj_t * spinbox; - - -static void lv_spinbox_increment_event_cb(lv_obj_t * btn, lv_event_t e) -{ - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { - lv_spinbox_increment(spinbox); - } -} - -static void lv_spinbox_decrement_event_cb(lv_obj_t * btn, lv_event_t e) -{ - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { - lv_spinbox_decrement(spinbox); - } -} - - -void lv_ex_spinbox_1(void) -{ - spinbox = lv_spinbox_create(lv_scr_act()); - lv_spinbox_set_range(spinbox, -1000, 25000); - lv_spinbox_set_digit_format(spinbox, 5, 2); - lv_spinbox_step_prev(spinbox); - lv_obj_set_width(spinbox, 100); - lv_obj_align(spinbox, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_coord_t h = lv_obj_get_height(spinbox); - - lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); - lv_obj_set_size(btn, h, h); - lv_obj_align(btn, spinbox, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - lv_obj_set_style_content_text(btn, LV_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_PLUS); - lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, NULL); - - btn = lv_btn_create(lv_scr_act(), NULL); - lv_obj_set_size(btn, h, h); - lv_obj_align(btn, spinbox, LV_ALIGN_OUT_LEFT_MID, -5, 0); - lv_obj_set_style_content_text(btn, LV_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_MINUS); - lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, NULL); -} - -#endif diff --git a/examples/widgets/spinbox/lv_spinbox_example_1.py b/examples/widgets/spinbox/lv_spinbox_example_1.py deleted file mode 100644 index 052ab77790..0000000000 --- a/examples/widgets/spinbox/lv_spinbox_example_1.py +++ /dev/null @@ -1,13 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("Value: %d" % obj.get_value()) - elif event == lv.EVENT.CLICKED: - # For simple test: Click the spinbox to increment its value - obj.increment() - -spinbox = lv.spinbox(lv.scr_act()) -spinbox.set_digit_format(5, 3) -spinbox.step_prev() -spinbox.set_width(100) -spinbox.align(None, lv.ALIGN.CENTER, 0, 0) -spinbox.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/spinner/lv_spinner_example_1.c b/examples/widgets/spinner/lv_spinner_example_1.c deleted file mode 100644 index 7fb2005804..0000000000 --- a/examples/widgets/spinner/lv_spinner_example_1.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_SPINNER - -void lv_ex_spinner_1(void) -{ - /*Create a spinner*/ - lv_obj_t * spinner = lv_spinner_create(lv_scr_act(), 1000, 60); - lv_obj_set_size(spinner, 100, 100); - lv_obj_align(spinner, NULL, LV_ALIGN_CENTER, 0, 0); -} - -#endif diff --git a/examples/widgets/spinner/lv_spinner_example_1.py b/examples/widgets/spinner/lv_spinner_example_1.py deleted file mode 100644 index b2e187cc06..0000000000 --- a/examples/widgets/spinner/lv_spinner_example_1.py +++ /dev/null @@ -1,15 +0,0 @@ -# Create a style for the Preloader -style = lv.style_t() -lv.style_copy(style, lv.style_plain) -style.line.width = 10 # 10 px thick arc -style.line.color = lv.color_hex3(0x258) # Blueish arc color - -style.body.border.color = lv.color_hex3(0xBBB) # Gray background color -style.body.border.width = 10 -style.body.padding.left = 0 - -# Create a Preloader object -preload = lv.preload(lv.scr_act()) -preload.set_size(100, 100) -preload.align(None, lv.ALIGN.CENTER, 0, 0) -preload.set_style(lv.preload.STYLE.MAIN, style) \ No newline at end of file diff --git a/examples/widgets/switch/lv_switch_example_1.c b/examples/widgets/switch/lv_switch_example_1.c deleted file mode 100644 index 5e011f1efb..0000000000 --- a/examples/widgets/switch/lv_switch_example_1.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_SWITCH - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - printf("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off"); - } -} - -void lv_ex_switch_1(void) -{ - lv_obj_set_layout(lv_scr_act(), &lv_flex_center_column); - - lv_obj_t * sw; - - sw = lv_switch_create(lv_scr_act(), NULL); - lv_obj_align(sw, NULL, LV_ALIGN_CENTER, 0, -50); - lv_obj_add_event_cb(sw, event_handler, NULL); - - sw = lv_switch_create(lv_scr_act(), NULL); - lv_obj_add_state(sw, LV_STATE_CHECKED); - lv_obj_align(sw, NULL, LV_ALIGN_CENTER, 0, 50); - lv_obj_add_event_cb(sw, event_handler, NULL); - - sw = lv_switch_create(lv_scr_act(), NULL); - lv_obj_add_state(sw, LV_STATE_DISABLED); - lv_obj_align(sw, NULL, LV_ALIGN_CENTER, 0, 50); - lv_obj_add_event_cb(sw, event_handler, NULL); - - sw = lv_switch_create(lv_scr_act(), NULL); - lv_obj_add_state(sw, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_obj_align(sw, NULL, LV_ALIGN_CENTER, 0, 50); - lv_obj_add_event_cb(sw, event_handler, NULL); - - -} - -#endif diff --git a/examples/widgets/switch/lv_switch_example_1.py b/examples/widgets/switch/lv_switch_example_1.py deleted file mode 100644 index 39fb3744df..0000000000 --- a/examples/widgets/switch/lv_switch_example_1.py +++ /dev/null @@ -1,48 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("State: %s" % ("On" if obj.get_state() else "Off")) - -# Create styles for the switch -bg_style = lv.style_t() -indic_style = lv.style_t() -knob_on_style = lv.style_t() -knob_off_style = lv.style_t() - -lv.style_copy(bg_style, lv.style_pretty) -bg_style.body.radius = 800 -bg_style.body.padding.top = 6 -bg_style.body.padding.bottom = 6 - -lv.style_copy(indic_style, lv.style_pretty_color) -indic_style.body.radius = 800 -indic_style.body.main_color = lv.color_hex(0x9fc8ef) -indic_style.body.grad_color = lv.color_hex(0x9fc8ef) -indic_style.body.padding.left = 0 -indic_style.body.padding.right = 0 -indic_style.body.padding.top = 0 -indic_style.body.padding.bottom = 0 - -lv.style_copy(knob_off_style, lv.style_pretty) -knob_off_style.body.radius = 800 -knob_off_style.body.shadow.width = 4 -knob_off_style.body.shadow.type = lv.SHADOW.BOTTOM - -lv.style_copy(knob_on_style, lv.style_pretty_color) -knob_on_style.body.radius = 800 -knob_on_style.body.shadow.width = 4 -knob_on_style.body.shadow.type = lv.SHADOW.BOTTOM - -# Create a switch and apply the styles -sw1 = lv.sw(lv.scr_act()) -sw1.set_style(lv.sw.STYLE.BG, bg_style) -sw1.set_style(lv.sw.STYLE.INDIC, indic_style) -sw1.set_style(lv.sw.STYLE.KNOB_ON, knob_on_style) -sw1.set_style(lv.sw.STYLE.KNOB_OFF, knob_off_style) -sw1.align(None, lv.ALIGN.CENTER, 0, -50) -sw1.set_event_cb(event_handler) - -# Copy the first switch and turn it ON -sw2 = lv.sw(lv.scr_act(), sw1) -sw2.on(lv.ANIM.ON) -sw2.align(None, lv.ALIGN.CENTER, 0, 50) -sw2.set_event_cb(lambda o,e: None) \ No newline at end of file diff --git a/examples/widgets/table/lv_table_example_1.c b/examples/widgets/table/lv_table_example_1.c deleted file mode 100644 index e956f4bb0f..0000000000 --- a/examples/widgets/table/lv_table_example_1.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_TABLE - -static void event_cb(lv_obj_t * obj, lv_event_t e) -{ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_hook_dsc_t * hook_dsc = lv_event_get_param(); - /*If the cells are drawn...*/ - if(hook_dsc->part == LV_PART_ITEMS) { - uint32_t row = hook_dsc->id / lv_table_get_col_cnt(obj); - uint32_t col = hook_dsc->id - row * lv_table_get_col_cnt(obj); - - /*Make the texts in the first cell center aligned*/ - if(row == 0) { - hook_dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; - hook_dsc->rect_dsc->bg_color = lv_color_mix(LV_COLOR_BLUE, hook_dsc->rect_dsc->bg_color, LV_OPA_20); - hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } - /*In the first column align the texts to the right*/ - else if(col == 0) { - hook_dsc->label_dsc->flag = LV_TEXT_ALIGN_RIGHT; - } - - /*MAke every 2nd row grayish*/ - if((row != 0 && row % 2) == 0) { - hook_dsc->rect_dsc->bg_color = lv_color_mix(LV_COLOR_GRAY, hook_dsc->rect_dsc->bg_color, LV_OPA_10); - hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } - } - } -} - - -void lv_ex_table_1(void) -{ - lv_obj_t * table = lv_table_create(lv_scr_act(), NULL); - - /*Fill the first column*/ - lv_table_set_cell_value(table, 0, 0, "Name"); - lv_table_set_cell_value(table, 1, 0, "Apple"); - lv_table_set_cell_value(table, 2, 0, "Banana"); - lv_table_set_cell_value(table, 3, 0, "Lemon"); - lv_table_set_cell_value(table, 4, 0, "Grape"); - lv_table_set_cell_value(table, 5, 0, "Melon"); - lv_table_set_cell_value(table, 6, 0, "Peach"); - lv_table_set_cell_value(table, 7, 0, "Nuts"); - - /*Fill the second column*/ - lv_table_set_cell_value(table, 0, 1, "Price"); - lv_table_set_cell_value(table, 1, 1, "$7"); - lv_table_set_cell_value(table, 2, 1, "$4"); - lv_table_set_cell_value(table, 3, 1, "$6"); - lv_table_set_cell_value(table, 4, 1, "$2"); - lv_table_set_cell_value(table, 5, 1, "$5"); - lv_table_set_cell_value(table, 6, 1, "$1"); - lv_table_set_cell_value(table, 7, 1, "$9"); - - /*Set a smaller height to the table. It'll make it scrollable*/ - lv_obj_set_height(table, 200); - lv_obj_align(table, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, event_cb, NULL); -} - -#endif diff --git a/examples/widgets/table/lv_table_example_1.py b/examples/widgets/table/lv_table_example_1.py deleted file mode 100644 index e0959943fc..0000000000 --- a/examples/widgets/table/lv_table_example_1.py +++ /dev/null @@ -1,41 +0,0 @@ -# Create a normal cell style -style_cell1 = lv.style_t() -lv.style_copy(style_cell1, lv.style_plain) -style_cell1.body.border.width = 1 -style_cell1.body.border.color = lv.color_make(0,0,0) - -# Crealte a header cell style -style_cell2 = lv.style_t() -lv.style_copy(style_cell2, lv.style_plain) -style_cell2.body.border.width = 1 -style_cell2.body.border.color = lv.color_make(0,0,0) -style_cell2.body.main_color = lv.color_make(0xC0, 0xC0, 0xC0) -style_cell2.body.grad_color = lv.color_make(0xC0, 0xC0, 0xC0) - -table = lv.table(lv.scr_act()) -table.set_style(lv.table.STYLE.CELL1, style_cell1) -table.set_style(lv.table.STYLE.CELL2, style_cell2) -table.set_style(lv.table.STYLE.BG, lv.style_transp_tight) -table.set_col_cnt(2) -table.set_row_cnt(4) -table.align(None, lv.ALIGN.CENTER, 0, 0) - -# Make the cells of the first row center aligned -table.set_cell_align(0, 0, lv.label.ALIGN.CENTER) -table.set_cell_align(0, 1, lv.label.ALIGN.CENTER) - -# Make the cells of the first row TYPE = 2 (use `style_cell2`) -table.set_cell_type(0, 0, 2) -table.set_cell_type(0, 1, 2) - -# Fill the first column -table.set_cell_value(0, 0, "Name") -table.set_cell_value(1, 0, "Apple") -table.set_cell_value(2, 0, "Banana") -table.set_cell_value(3, 0, "Citron") - -# Fill the second column -table.set_cell_value(0, 1, "Price") -table.set_cell_value(1, 1, "$7") -table.set_cell_value(2, 1, "$4") -table.set_cell_value(3, 1, "$6") \ No newline at end of file diff --git a/examples/widgets/tabview/lv_tabview_example_1.c b/examples/widgets/tabview/lv_tabview_example_1.c deleted file mode 100644 index 82483f9c8e..0000000000 --- a/examples/widgets/tabview/lv_tabview_example_1.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_TABVIEW - -void lv_ex_tabview_1(void) -{ - /*Create a Tab view object*/ - lv_obj_t *tabview; - tabview = lv_tabview_create(lv_scr_act(), LV_DIR_RIGHT, 50); - - /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ - lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); - lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); - lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); - - /*Add content to the tabs*/ - lv_obj_t * label = lv_label_create(tab1, NULL); - lv_label_set_text(label, "This the first tab\n\n" - "If the content\n" - "of a tab\n" - "becomes too\n" - "longer\n" - "than the\n" - "container\n" - "then it\n" - "automatically\n" - "becomes\n" - "scrollable.\n" - "\n" - "\n" - "\n" - "Can you see it?"); - - label = lv_label_create(tab2, NULL); - lv_label_set_text(label, "Second tab"); - - label = lv_label_create(tab3, NULL); - lv_label_set_text(label, "Third tab"); - - lv_obj_scroll_to_view_recursive(label, LV_ANIM_ON); -} -#endif diff --git a/examples/widgets/tabview/lv_tabview_example_1.py b/examples/widgets/tabview/lv_tabview_example_1.py deleted file mode 100644 index 5dc3025178..0000000000 --- a/examples/widgets/tabview/lv_tabview_example_1.py +++ /dev/null @@ -1,25 +0,0 @@ -# Create a Tab view object -tabview = lv.tabview(lv.scr_act()) - -# Add 3 tabs (the tabs are page (lv_page) and can be scrolled -tab1 = tabview.add_tab("Tab 1") -tab2 = tabview.add_tab("Tab 2") -tab3 = tabview.add_tab("Tab 3") - -# Add content to the tabs -label = lv.label(tab1) -label.set_text("""This the first tab - -If the content -of a tab -become too long -the it -automatically -become -scrollable.""") - -label = lv.label(tab2) -label.set_text("Second tab") - -label = lv.label(tab3) -label.set_text("Third tab") \ No newline at end of file diff --git a/examples/widgets/textarea/lv_textarea_example_1.c b/examples/widgets/textarea/lv_textarea_example_1.c deleted file mode 100644 index f39c8703ed..0000000000 --- a/examples/widgets/textarea/lv_textarea_example_1.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_TEXTAREA - -lv_obj_t * ta1; -lv_obj_t * ta2; - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - printf("Value: %s\n", lv_textarea_get_text(obj)); - } - else if(event == LV_EVENT_LONG_PRESSED_REPEAT) { - /*For simple test: Long press the Text are to add the text below*/ - const char * txt = "\n\nYou can scroll it if the text is long enough.\n"; - static uint16_t i = 0; - if(txt[i] != '\0') { - lv_textarea_add_char(ta1, txt[i]); - i++; - } - } -} - -void lv_ex_textarea_1(void) -{ - ta1 = lv_textarea_create(lv_scr_act(), NULL); - lv_obj_align(ta1, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); - lv_textarea_set_text(ta1, "A text in a Text Area"); /*Set an initial text*/ - lv_obj_add_event_cb(ta1, event_handler, NULL); -} - -#endif diff --git a/examples/widgets/textarea/lv_textarea_example_1.py b/examples/widgets/textarea/lv_textarea_example_1.py deleted file mode 100644 index 079b7f973e..0000000000 --- a/examples/widgets/textarea/lv_textarea_example_1.py +++ /dev/null @@ -1,13 +0,0 @@ -def event_handler(obj, event): - if event == lv.EVENT.VALUE_CHANGED: - print("Value: %s" % obj.get_text()) - elif event == lv.EVENT.LONG_PRESSED_REPEAT: - # For simple test: Long press the Text are to add the text below - ta1.add_text("\n\nYou can scroll it if the text is long enough.\n") - -ta1 = lv.ta(lv.scr_act()) -ta1.set_size(200, 100) -ta1.align(None, lv.ALIGN.CENTER, 0, 0) -ta1.set_cursor_type(lv.CURSOR.BLOCK) -ta1.set_text("A text in a Text Area") # Set an initial text -ta1.set_event_cb(event_handler) \ No newline at end of file diff --git a/examples/widgets/textarea/lv_textarea_example_2.c b/examples/widgets/textarea/lv_textarea_example_2.c deleted file mode 100644 index bb1c5e5c16..0000000000 --- a/examples/widgets/textarea/lv_textarea_example_2.c +++ /dev/null @@ -1,62 +0,0 @@ -//#include "../../../lvgl.h" -//#include -//#if LV_USE_TEXTAREA && LV_USE_KEYBOARD -// -//static void ta_event_cb(lv_obj_t * ta, lv_event_t event); -// -//static lv_obj_t * kb; -// -//void lv_ex_textarea_2(void) -//{ -// /* Create the password box */ -// lv_obj_t * pwd_ta = lv_textarea_create(lv_scr_act(), NULL); -// lv_textarea_set_text(pwd_ta, ""); -// lv_textarea_set_pwd_mode(pwd_ta, true); -// lv_textarea_set_one_line(pwd_ta, true); -// lv_textarea_set_cursor_hidden(pwd_ta, true); -// lv_obj_set_width(pwd_ta, LV_HOR_RES / 2 - 20); -// lv_obj_set_pos(pwd_ta, 5, 20); -// lv_obj_set_event_cb(pwd_ta, ta_event_cb); -// -// /* Create a label and position it above the text box */ -// lv_obj_t * pwd_label = lv_label_create(lv_scr_act(), NULL); -// lv_label_set_text(pwd_label, "Password:"); -// lv_obj_align(pwd_label, pwd_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0); -// -// /* Create the one-line mode text area */ -// lv_obj_t * oneline_ta = lv_textarea_create(lv_scr_act(), pwd_ta); -// lv_textarea_set_pwd_mode(oneline_ta, false); -// lv_textarea_set_cursor_hidden(oneline_ta, true); -// lv_obj_align(oneline_ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20); -// -// -// /* Create a label and position it above the text box */ -// lv_obj_t * oneline_label = lv_label_create(lv_scr_act(), NULL); -// lv_label_set_text(oneline_label, "Text:"); -// lv_obj_align(oneline_label, oneline_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0); -// -// /* Create a keyboard */ -// kb = lv_keyboard_create(lv_scr_act(), NULL); -// lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2); -// -// lv_keyboard_set_textarea(kb, pwd_ta); /* Focus it on one of the text areas to start */ -// lv_keyboard_set_cursor_manage(kb, true); /* Automatically show/hide cursors on text areas */ -//} -// -//static void ta_event_cb(lv_obj_t * ta, lv_event_t event) -//{ -// if(event == LV_EVENT_CLICKED) { -// /* Focus on the clicked text area */ -// if(kb != NULL) -// lv_keyboard_set_textarea(kb, ta); -// } -// -// else if(event == LV_EVENT_INSERT) { -// const char * str = lv_event_get_data(); -// if(str[0] == '\n') { -// printf("Ready\n"); -// } -// } -//} -// -//#endif diff --git a/examples/widgets/textarea/lv_textarea_example_2.py b/examples/widgets/textarea/lv_textarea_example_2.py deleted file mode 100644 index 554f87f15c..0000000000 --- a/examples/widgets/textarea/lv_textarea_example_2.py +++ /dev/null @@ -1,51 +0,0 @@ -HOR_RES = lv.disp_get_hor_res(lv.disp_get_default()) - -def kb_event_cb(event_kb, event): - # Just call the regular event handler - event_kb.def_event_cb(event) - -def ta_event_cb(ta, event): - if event == lv.EVENT.INSERT: - # get inserted value - ptr = lv.C_Pointer() - ptr.ptr_val = lv.event_get_data() - if ptr.str_val == "\n": - print("Ready") - elif event == lv.EVENT.CLICKED: - # Focus on the clicked text area - kb.set_ta(ta) - -# Create the password box -pwd_ta = lv.ta(lv.scr_act()) -pwd_ta.set_text(""); -pwd_ta.set_pwd_mode(True) -pwd_ta.set_one_line(True) -pwd_ta.set_width(HOR_RES // 2 - 20) -pwd_ta.set_pos(5, 20) -pwd_ta.set_event_cb(ta_event_cb) - -# Create a label and position it above the text box -pwd_label = lv.label(lv.scr_act()) -pwd_label.set_text("Password:") -pwd_label.align(pwd_ta, lv.ALIGN.OUT_TOP_LEFT, 0, 0) - -# Create the one-line mode text area -oneline_ta = lv.ta(lv.scr_act(), pwd_ta) -oneline_ta.set_pwd_mode(False) -oneline_ta.set_cursor_type(lv.CURSOR.LINE | lv.CURSOR.HIDDEN) -oneline_ta.align(None, lv.ALIGN.IN_TOP_RIGHT, -5, 20) -oneline_ta.set_event_cb(ta_event_cb) - -# Create a label and position it above the text box -oneline_label = lv.label(lv.scr_act()) -oneline_label.set_text("Text:") -oneline_label.align(oneline_ta, lv.ALIGN.OUT_TOP_LEFT, 0, 0) - -# Create a keyboard and make it fill the width of the above text areas -kb = lv.kb(lv.scr_act()) -kb.set_pos(5, 90) -kb.set_event_cb(kb_event_cb) # Setting a custom event handler stops the keyboard from closing automatically -kb.set_size(HOR_RES - 10, 140) - -kb.set_ta(pwd_ta) # Focus it on one of the text areas to start -kb.set_cursor_manage(True) # Automatically show/hide cursors on text areas \ No newline at end of file diff --git a/examples/widgets/textarea/lv_textarea_example_3.c b/examples/widgets/textarea/lv_textarea_example_3.c deleted file mode 100644 index b1d66af914..0000000000 --- a/examples/widgets/textarea/lv_textarea_example_3.c +++ /dev/null @@ -1,44 +0,0 @@ -//#include "../../../lvgl.h" -//#include -//#if LV_USE_TEXTAREA && LV_USE_KEYBOARD -// -//static void ta_event_cb(lv_obj_t * ta, lv_event_t event); -// -//static lv_obj_t * kb; -// -///** -// * Automatically format text like a clock. E.g. "12:34" -// * Add the ':' automatically. -// */ -//void lv_ex_textarea_3(void) -//{ -// /* Create the text area */ -// lv_obj_t * ta = lv_textarea_create(lv_scr_act(), NULL); -// lv_obj_set_event_cb(ta, ta_event_cb); -// lv_textarea_set_accepted_chars(ta, "0123456789:"); -// lv_textarea_set_max_length(ta, 5); -// lv_textarea_set_one_line(ta, true); -// lv_textarea_set_text(ta, ""); -// -// /* Create a keyboard*/ -// kb = lv_keyboard_create(lv_scr_act(), NULL); -// lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2); -// lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUM); -// lv_keyboard_set_textarea(kb, ta); -//} -// -//static void ta_event_cb(lv_obj_t * ta, lv_event_t event) -//{ -// if(event == LV_EVENT_VALUE_CHANGED) { -// const char * txt = lv_textarea_get_text(ta); -// if(txt[0] >= '0' && txt[0] <= '9' && -// txt[1] >= '0' && txt[1] <= '9' && -// txt[2] != ':') -// { -// lv_textarea_set_cursor_pos(ta, 2); -// lv_textarea_add_char(ta, ':'); -// } -// } -//} -// -//#endif diff --git a/examples/widgets/tileview/lv_tileview_example_1.c b/examples/widgets/tileview/lv_tileview_example_1.c deleted file mode 100644 index d59c1aeb2e..0000000000 --- a/examples/widgets/tileview/lv_tileview_example_1.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "../../../lvgl.h" -#if LV_USE_TILEVIEW - -/** - * Create a 2x2 tile view and allow scrolling only in an "L" shape. - * Demonstrate scroll chaining with a long list that - * scrolls the tile view when it cant't be scrolled further. - */ -void lv_ex_tileview_1(void) -{ - lv_obj_t *tv = lv_tileview_create(lv_scr_act()); - - /*Tile1: just a label*/ - lv_obj_t * tile1 = lv_tileview_add_tile(tv, 0, 0, LV_DIR_BOTTOM); - lv_obj_t * label = lv_label_create(tile1, NULL); - lv_label_set_text(label, "Scroll down"); - lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); - - - /*Tile2: a button*/ - lv_obj_t * tile2 = lv_tileview_add_tile(tv, 0, 1, LV_DIR_TOP | LV_DIR_RIGHT); - - lv_obj_t * btn = lv_btn_create(tile2, NULL); - - label = lv_label_create(btn, NULL); - lv_label_set_text(label, "Scroll up or right"); - - lv_obj_set_size(btn, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0); - - /*Tile3: a list*/ - lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT); - lv_obj_t * list = lv_list_create(tile3); - lv_obj_set_size(list, LV_COORD_PCT(100), LV_COORD_PCT(100)); - - lv_list_add_btn(list, NULL, "One", NULL); - lv_list_add_btn(list, NULL, "Two", NULL); - lv_list_add_btn(list, NULL, "Three", NULL); - lv_list_add_btn(list, NULL, "Four", NULL); - lv_list_add_btn(list, NULL, "Five", NULL); - lv_list_add_btn(list, NULL, "Six", NULL); - lv_list_add_btn(list, NULL, "Seven", NULL); - lv_list_add_btn(list, NULL, "Eight", NULL); - lv_list_add_btn(list, NULL, "Nine", NULL); - lv_list_add_btn(list, NULL, "Ten", NULL); - -} - -#endif diff --git a/examples/widgets/tileview/lv_tileview_example_1.py b/examples/widgets/tileview/lv_tileview_example_1.py deleted file mode 100644 index 520490814b..0000000000 --- a/examples/widgets/tileview/lv_tileview_example_1.py +++ /dev/null @@ -1,62 +0,0 @@ -valid_pos = [{"x":0, "y": 0}, {"x": 0, "y": 1}, {"x": 1,"y": 1}] - -# resolution of the screen -HOR_RES = lv.disp_get_hor_res(lv.disp_get_default()) -VER_RES = lv.disp_get_ver_res(lv.disp_get_default()) - -tileview = lv.tileview(lv.scr_act()) -tileview.set_valid_positions(valid_pos, len(valid_pos)) -tileview.set_edge_flash(True) - -tile1 = lv.obj(tileview) -tile1.set_size(HOR_RES, VER_RES) -tile1.set_style(lv.style_pretty) -tileview.add_element(tile1) - -# Tile1: just a label -label = lv.label(tile1) -label.set_text("Tile 1") -label.align(None, lv.ALIGN.CENTER, 0, 0) - -# Tile2: a list -lst = lv.list(tileview) -lst.set_size(HOR_RES, VER_RES) -lst.set_pos(0, VER_RES) -lst.set_scroll_propagation(True) -lst.set_sb_mode(lv.SB_MODE.OFF) -tileview.add_element(lst) - -list_btn = lst.add_btn(None, "One") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Two") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Three") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Four") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Five") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Six") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Seven") -tileview.add_element(list_btn) - -list_btn = lst.add_btn(None, "Eight") -tileview.add_element(list_btn) - -# Tile3: a button -tile3 = lv.obj(tileview, tile1) -tile3.set_pos(HOR_RES, VER_RES) -tileview.add_element(tile3) - -btn = lv.btn(tile3) -btn.align(None, lv.ALIGN.CENTER, 0, 0) - -label = lv.label(btn) -label.set_text("Button") \ No newline at end of file diff --git a/examples/widgets/win/lv_win_example_1.c b/examples/widgets/win/lv_win_example_1.c deleted file mode 100644 index c70b0a4b7f..0000000000 --- a/examples/widgets/win/lv_win_example_1.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "../../../lvgl.h" -#include -#if LV_USE_WIN - - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - if(event == LV_EVENT_CLICKED) { - printf("Button: %d\n", lv_obj_get_child_id(obj)); - } -} - -void lv_ex_win_1(void) -{ - lv_obj_t * win = lv_win_create(lv_scr_act(), 60); - lv_win_add_btn(win, LV_SYMBOL_LEFT, 40, event_handler); - lv_win_add_title(win, "A title"); - lv_win_add_btn(win, LV_SYMBOL_RIGHT, 40, event_handler); - lv_win_add_btn(win, LV_SYMBOL_CLOSE, 60, event_handler); - - lv_obj_t * cont = lv_win_get_content(win); /*Content can be aded here*/ - lv_obj_t * label = lv_label_create(cont, NULL); - lv_label_set_text(label, "This is\n" - "a pretty\n" - "long text\n" - "to see how\n" - "the window\n" - "becomes\n" - "scrollable.\n" - "\n" - "\n" - "Some more\n" - "text to be\n" - "sure it\n" - "overflows. :)"); - - -} - -#endif diff --git a/lvgl.h b/lvgl.h index fc6a727920..4e6bb3325d 100644 --- a/lvgl.h +++ b/lvgl.h @@ -67,22 +67,10 @@ extern "C" { /*----------------- * EXTRAS *----------------*/ +#include "src/extra/widgets/lv_widgets.h" /* WIDGETS */ -#include "src/extra/widgets/calendar/lv_calendar.h" -#include "src/extra/widgets/calendar/lv_calendar_header_arrow.h" -#include "src/extra/widgets/keyboard/lv_keyboard.h" -#include "src/extra/widgets/list/lv_list.h" -#include "src/extra/widgets/msgbox/lv_msgbox.h" -#include "src/extra/widgets/spinbox/lv_spinbox.h" -#include "src/extra/widgets/spinner/lv_spinner.h" -#include "src/extra/widgets/tabview/lv_tabview.h" -#include "src/extra/widgets/tileview/lv_tileview.h" -#include "src/extra/widgets/win/lv_win.h" - /* LAYOUTS */ -#include "src/extra/layouts/flex/lv_flex.h" -#include "src/extra/layouts/grid/lv_grid.h" /* THEMES */ #include "src/extra/themes/lv_themes.h" diff --git a/examples/layouts/flex/lv_flex_example.h b/src/extra/layouts/lv_layouts.h similarity index 73% rename from examples/layouts/flex/lv_flex_example.h rename to src/extra/layouts/lv_layouts.h index 162cb1d3fb..cf65a91f75 100644 --- a/examples/layouts/flex/lv_flex_example.h +++ b/src/extra/layouts/lv_layouts.h @@ -1,10 +1,10 @@ /** - * @file lv_ex_flex.h + * @file lv_layouts.h * */ -#ifndef LV_EX_FLEX_H -#define LV_EX_FLEX_H +#ifndef LV_LAYOUTS_H +#define LV_LAYOUTS_H #ifdef __cplusplus extern "C" { @@ -13,6 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ +#include "layouts/flex/lv_flex.h" +#include "layouts/grid/lv_grid.h" + /********************* * DEFINES @@ -34,4 +37,4 @@ extern "C" { } /* extern "C" */ #endif -#endif /*LV_EX_FLEX_H*/ +#endif /*LV_LAYOUTS_H*/ diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 6a5dc80f1d..547e23774c 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -490,17 +490,17 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) return; } - if(lv_obj_check_type(obj, &lv_obj)) { + if(lv_obj_check_type(obj, &lv_obj_class)) { #if LV_USE_TABVIEW lv_obj_t * parent = lv_obj_get_parent(obj); /*Tabview content area*/ - if(lv_obj_check_type(parent, &lv_tabview)) { + if(lv_obj_check_type(parent, &lv_tabview_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_gap); return; } /*Tabview pages*/ - else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview)) { + else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->scr); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_normal); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); @@ -511,14 +511,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #if LV_USE_WIN /*Header*/ - if(lv_obj_get_child_id(obj) == 0 && lv_obj_check_type(lv_obj_get_parent(obj), &lv_win)) { + if(lv_obj_get_child_id(obj) == 0 && lv_obj_check_type(lv_obj_get_parent(obj), &lv_win_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_normal); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->text_align_center); return; } /*Content*/ - else if(lv_obj_get_child_id(obj) == 1 && lv_obj_check_type(lv_obj_get_parent(obj), &lv_win)) { + else if(lv_obj_get_child_id(obj) == 1 && lv_obj_check_type(lv_obj_get_parent(obj), &lv_win_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->scr); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_normal); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); @@ -531,10 +531,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_SCROLLED, &styles->scrollbar_scrolled); } #if LV_USE_BTN - else if(lv_obj_check_type(obj, &lv_btn)) { + else if(lv_obj_check_type(obj, &lv_btn_class)) { #if LV_USE_LIST /*Add different buttons to the lists*/ - if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_list)) { + if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_list_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_panel); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->list_btn); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->list_item_grow); @@ -554,9 +554,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_BTNMATRIX - else if(lv_obj_check_type(obj, &lv_btnmatrix)) { + else if(lv_obj_check_type(obj, &lv_btnmatrix_class)) { #if LV_USE_MSGBOX - if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_msgbox)) { + if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_msgbox_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_gap); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_DEFAULT, &styles->btn); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_PRESSED, &styles->pressed); @@ -565,7 +565,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) } #endif #if LV_USE_TABVIEW - if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_tabview)) { + if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_tabview_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_panel); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_PRESSED, &styles->pressed); @@ -581,7 +581,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_BAR - else if(lv_obj_check_type(obj, &lv_bar)) { + else if(lv_obj_check_type(obj, &lv_bar_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary); @@ -590,7 +590,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_SLIDER - else if(lv_obj_check_type(obj, &lv_slider)) { + else if(lv_obj_check_type(obj, &lv_slider_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed); @@ -605,7 +605,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_TABLE - else if(lv_obj_check_type(obj, &lv_table)) { + else if(lv_obj_check_type(obj, &lv_table_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_zero); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->no_radius); @@ -618,7 +618,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_CHECKBOX - else if(lv_obj_check_type(obj, &lv_checkbox)) { + else if(lv_obj_check_type(obj, &lv_checkbox_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_gap); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DISABLED, &styles->disabled); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->cb_marker); @@ -632,7 +632,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_SWITCH - else if(lv_obj_check_type(obj, &lv_switch)) { + else if(lv_obj_check_type(obj, &lv_switch_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DISABLED, &styles->disabled); @@ -647,7 +647,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_CHART - else if(lv_obj_check_type(obj, &lv_chart)) { + else if(lv_obj_check_type(obj, &lv_chart_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->chart_bg); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_small); @@ -660,7 +660,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_ROLLER - else if(lv_obj_check_type(obj, &lv_roller)) { + else if(lv_obj_check_type(obj, &lv_roller_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->anim); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->line_space_large); @@ -670,7 +670,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_DROPDOWN - else if(lv_obj_check_type(obj, &lv_dropdown)) { + else if(lv_obj_check_type(obj, &lv_dropdown_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_normal); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed); @@ -680,7 +680,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->ddlist_flip); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_normal); } - else if(lv_obj_check_type(obj, &lv_dropdown_list)) { + else if(lv_obj_check_type(obj, &lv_dropdown_list_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->line_space_large); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); @@ -691,9 +691,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_LABEL - else if(lv_obj_check_type(obj, &lv_label)) { + else if(lv_obj_check_type(obj, &lv_label_class)) { #if LV_USE_LIST - if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_list)) { + if(lv_obj_check_type(lv_obj_get_parent(obj), &lv_list_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->list_item_grow); } @@ -702,7 +702,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_ARC - else if(lv_obj_check_type(obj, &lv_arc)) { + else if(lv_obj_check_type(obj, &lv_arc_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->arc_indic); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->arc_indic); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->arc_indic_primary); @@ -711,7 +711,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_METER - else if(lv_obj_check_type(obj, &lv_meter)) { + else if(lv_obj_check_type(obj, &lv_meter_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->meter_indic); @@ -719,7 +719,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_TEXTAREA - else if(lv_obj_check_type(obj, &lv_textarea)) { + else if(lv_obj_check_type(obj, &lv_textarea_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_SCROLLED, &styles->scrollbar_scrolled); @@ -729,7 +729,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_CALENDAR - else if(lv_obj_check_type(obj, &lv_calendar)) { + else if(lv_obj_check_type(obj, &lv_calendar_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_small); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_DEFAULT, &styles->calendar_day); @@ -739,7 +739,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #endif #if LV_USE_KEYBOARD - else if(lv_obj_check_type(obj, &lv_keyboard)) { + else if(lv_obj_check_type(obj, &lv_keyboard_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->scr); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_small); lv_obj_add_style(obj, LV_PART_ITEMS, LV_STATE_DEFAULT, &styles->btn); @@ -749,7 +749,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) } #endif #if LV_USE_LIST - else if(lv_obj_check_type(obj, &lv_list)) { + else if(lv_obj_check_type(obj, &lv_list_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->list_bg); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); @@ -758,24 +758,24 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) } #endif #if LV_USE_MSGBOX - else if(lv_obj_check_type(obj, &lv_msgbox)) { + else if(lv_obj_check_type(obj, &lv_msgbox_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); return; } #endif #if LV_USE_SPINBOX - else if(lv_obj_check_type(obj, &lv_spinbox)) { + else if(lv_obj_check_type(obj, &lv_spinbox_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->bg_color_gray); } #endif #if LV_USE_TILEVIEW - else if(lv_obj_check_type(obj, &lv_tileview)) { + else if(lv_obj_check_type(obj, &lv_tileview_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->scr); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_SCROLLED, &styles->scrollbar_scrolled); } - else if(lv_obj_check_type(obj, &lv_tileview_tile)) { + else if(lv_obj_check_type(obj, &lv_tileview_tile_class)) { lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_DEFAULT, &styles->scrollbar); lv_obj_add_style(obj, LV_PART_SCROLLBAR, LV_STATE_SCROLLED, &styles->scrollbar_scrolled); } diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index e6be7738ea..9a65699f9f 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -34,10 +34,10 @@ static void highlight_update(lv_obj_t * calendar); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_calendar = { +const lv_obj_class_t lv_calendar_class = { .constructor_cb = my_constructor, .instance_size = sizeof(lv_calendar_t), - .base_class = &lv_btnmatrix + .base_class = &lv_btnmatrix_class }; @@ -53,7 +53,7 @@ static const char * day_names_def[7] = LV_CALENDAR_DEFAULT_MONTH_NAMES; lv_obj_t * lv_calendar_create(lv_obj_t * parent) { - lv_obj_t * obj = lv_obj_create_from_class(&lv_calendar, parent, NULL); + lv_obj_t * obj = lv_obj_create_from_class(&lv_calendar_class, parent, NULL); return obj; } diff --git a/src/extra/widgets/calendar/lv_calendar.h b/src/extra/widgets/calendar/lv_calendar.h index cd14897a69..ef03d852e4 100644 --- a/src/extra/widgets/calendar/lv_calendar.h +++ b/src/extra/widgets/calendar/lv_calendar.h @@ -46,7 +46,7 @@ typedef struct { char nums [7 * 6][4]; } lv_calendar_t; -extern const lv_obj_class_t lv_calendar; +extern const lv_obj_class_t lv_calendar_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index 81b93a3eff..f5593f5015 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -30,11 +30,11 @@ static void lv_keyboard_update_map(lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_keyboard = { +const lv_obj_class_t lv_keyboard_class = { .constructor_cb = my_constructor, .instance_size = sizeof(lv_keyboard_t), .editable = 1, - .base_class = &lv_btnmatrix + .base_class = &lv_btnmatrix_class }; static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n", @@ -120,7 +120,7 @@ static const lv_btnmatrix_ctrl_t * kb_ctrl[5] = { */ lv_obj_t * lv_keyboard_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_keyboard, parent, NULL); + return lv_obj_create_from_class(&lv_keyboard_class, parent, NULL); } /*===================== diff --git a/src/extra/widgets/keyboard/lv_keyboard.h b/src/extra/widgets/keyboard/lv_keyboard.h index 38d6d672ca..8d0b8bf085 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.h +++ b/src/extra/widgets/keyboard/lv_keyboard.h @@ -52,7 +52,7 @@ typedef struct { lv_keyboard_mode_t mode; /*Key map type*/ } lv_keyboard_t; -extern const lv_obj_class_t lv_keyboard; +extern const lv_obj_class_t lv_keyboard_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index cb4bd55e7c..6fefa25295 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -27,8 +27,8 @@ * STATIC PROTOTYPES **********************/ -const lv_obj_class_t lv_list = { - .base_class = &lv_obj, +const lv_obj_class_t lv_list_class = { + .base_class = &lv_obj_class, }; /********************** @@ -45,7 +45,7 @@ const lv_obj_class_t lv_list = { lv_obj_t * lv_list_create(lv_obj_t * parent) { - lv_obj_t * list = lv_obj_create_from_class(&lv_list, parent, NULL); + lv_obj_t * list = lv_obj_create_from_class(&lv_list_class, parent, NULL); lv_obj_set_size(list, LV_DPX(200), LV_DPX(300)); lv_obj_set_layout(list, &lv_flex_stacked); @@ -88,7 +88,7 @@ const char * lv_list_get_btn_text(lv_obj_t * btn) uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(btn); i++) { lv_obj_t * child = lv_obj_get_child(btn, i); - if(lv_obj_check_type(child, &lv_label)) { + if(lv_obj_check_type(child, &lv_label_class)) { return lv_label_get_text(child); } diff --git a/src/extra/widgets/list/lv_list.h b/src/extra/widgets/list/lv_list.h index 47abe62043..eebfa00aea 100644 --- a/src/extra/widgets/list/lv_list.h +++ b/src/extra/widgets/list/lv_list.h @@ -26,7 +26,7 @@ extern "C" { * TYPEDEFS **********************/ -extern const lv_obj_class_t lv_list; +extern const lv_obj_class_t lv_list_class; /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/examples/get_started/lv_get_started_example.h b/src/extra/widgets/lv_widgets.h similarity index 51% rename from examples/get_started/lv_get_started_example.h rename to src/extra/widgets/lv_widgets.h index e5b4a7c947..60fac6d377 100644 --- a/examples/get_started/lv_get_started_example.h +++ b/src/extra/widgets/lv_widgets.h @@ -1,10 +1,10 @@ /** - * @file lv_ex_get_started.h + * @file lv_widgets.h * */ -#ifndef LV_EX_GET_STARTED_H -#define LV_EX_GET_STARTED_H +#ifndef LV_WIDGETS_H +#define LV_WIDGETS_H #ifdef __cplusplus extern "C" { @@ -13,6 +13,17 @@ extern "C" { /********************* * INCLUDES *********************/ +#include "calendar/lv_calendar.h" +#include "calendar/lv_calendar_header_arrow.h" +#include "keyboard/lv_keyboard.h" +#include "list/lv_list.h" +#include "msgbox/lv_msgbox.h" +#include "spinbox/lv_spinbox.h" +#include "spinner/lv_spinner.h" +#include "tabview/lv_tabview.h" +#include "tileview/lv_tileview.h" +#include "win/lv_win.h" + /********************* * DEFINES @@ -25,9 +36,6 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ -void lv_ex_get_started_1(void); -void lv_ex_get_started_2(void); -void lv_ex_get_started_3(void); /********************** * MACROS @@ -37,4 +45,4 @@ void lv_ex_get_started_3(void); } /* extern "C" */ #endif -#endif /*LV_EX_GET_STARTED_H*/ +#endif /*LV_WIDGETS_H*/ diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 994846f271..0411b68bfe 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -26,7 +26,7 @@ static void msgbox_close_event_cb(lv_obj_t * btn, lv_event_t e); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_msgbox = {.base_class = &lv_obj}; +const lv_obj_class_t lv_msgbox_class = {.base_class = &lv_obj_class}; /********************** * MACROS @@ -49,7 +49,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b lv_obj_set_size(parent, LV_COORD_PCT(100), LV_COORD_PCT(100)); lv_obj_remove_style(parent, LV_PART_ANY, LV_STATE_ANY, NULL); - lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox, parent, NULL); + lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox_class, parent, NULL); LV_ASSERT_MEM(mbox); if(mbox == NULL) return NULL; @@ -106,7 +106,7 @@ lv_obj_t * lv_msgbox_get_title(lv_obj_t * mbox) lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * mbox) { lv_obj_t * obj = lv_obj_get_child(mbox, 1); - if(lv_obj_check_type(obj, &lv_btn)) return obj; + if(lv_obj_check_type(obj, &lv_btn_class)) return obj; else return NULL; } diff --git a/src/extra/widgets/msgbox/lv_msgbox.h b/src/extra/widgets/msgbox/lv_msgbox.h index c5c3c464f1..d340aa65d9 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.h +++ b/src/extra/widgets/msgbox/lv_msgbox.h @@ -33,7 +33,7 @@ extern "C" { /********************** * TYPEDEFS **********************/ -extern const lv_obj_class_t lv_msgbox; +extern const lv_obj_class_t lv_msgbox_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/spinbox/lv_spinbox.c b/src/extra/widgets/spinbox/lv_spinbox.c index eba53fe065..02ce41f55d 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.c +++ b/src/extra/widgets/spinbox/lv_spinbox.c @@ -12,7 +12,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_spinbox +#define MY_CLASS &lv_spinbox_class /********************** * TYPEDEFS @@ -30,12 +30,12 @@ static void lv_spinbox_updatevalue(lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_spinbox = { +const lv_obj_class_t lv_spinbox_class = { .constructor_cb = lv_spinbox_constructor, .destructor_cb = lv_spinbox_destructor, .signal_cb = lv_spinbox_signal, .instance_size = sizeof(lv_spinbox_t), - .base_class = &lv_textarea + .base_class = &lv_textarea_class }; /********************** * MACROS @@ -53,7 +53,7 @@ const lv_obj_class_t lv_spinbox = { */ lv_obj_t * lv_spinbox_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_spinbox, parent, NULL); + return lv_obj_create_from_class(&lv_spinbox_class, parent, NULL); } /*===================== diff --git a/src/extra/widgets/spinbox/lv_spinbox.h b/src/extra/widgets/spinbox/lv_spinbox.h index 0aa710c483..54708bab89 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.h +++ b/src/extra/widgets/spinbox/lv_spinbox.h @@ -44,7 +44,7 @@ typedef struct { uint16_t rollover : 1; // Set to true for rollover functionality } lv_spinbox_t; -extern const lv_obj_class_t lv_spinbox; +extern const lv_obj_class_t lv_spinbox_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/spinner/lv_spinner.c b/src/extra/widgets/spinner/lv_spinner.c index a66f2a6457..1329ecda4b 100644 --- a/src/extra/widgets/spinner/lv_spinner.c +++ b/src/extra/widgets/spinner/lv_spinner.c @@ -20,7 +20,6 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_spinner_angle_anim_cb(void * ptr, lv_anim_value_t val); /********************** * STATIC VARIABLES @@ -59,16 +58,19 @@ lv_obj_t * lv_spinner_create(lv_obj_t * par, uint32_t time, uint32_t arc_length) lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, spinner); - lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_spinner_angle_anim_cb); - lv_anim_set_path(&a, &path); + lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_arc_set_end_angle); lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); lv_anim_set_time(&a, time); - lv_anim_set_values(&a, 0, 360); + lv_anim_set_values(&a, arc_length, 360 + arc_length); + lv_anim_start(&a); + + lv_anim_set_path(&a, &path); + lv_anim_set_values(&a, 0, 360); + lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_arc_set_start_angle); lv_anim_start(&a); - lv_arc_set_angles(spinner, 0, arc_length); lv_arc_set_bg_angles(spinner, 0, 360); - lv_arc_set_rotation(spinner, 270 - arc_length / 2); + lv_arc_set_rotation(spinner, 270); return spinner; } @@ -79,20 +81,4 @@ lv_obj_t * lv_spinner_create(lv_obj_t * par, uint32_t time, uint32_t arc_length) * STATIC FUNCTIONS **********************/ -/** - * Animator function (exec_cb) to rotate the arc of the spinner. - * @param ptr pointer to spinner - * @param val the current desired value [0..360] - */ -static void lv_spinner_angle_anim_cb(void * ptr, lv_anim_value_t val) -{ - lv_obj_t * spinner = ptr; - - uint16_t s = lv_arc_get_angle_start(spinner); - uint16_t e = lv_arc_get_angle_end(spinner); - int16_t d = e - s; - - lv_arc_set_angles(spinner, val, val + d); -} - #endif /*LV_USE_SPINNER*/ diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index f041608344..ed501e7bea 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -27,9 +27,9 @@ static void cont_event_cb(lv_obj_t * cont, lv_event_t e); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_tabview = { +const lv_obj_class_t lv_tabview_class = { .constructor_cb = lv_tabview_constructor, - .base_class = &lv_obj, + .base_class = &lv_obj_class, .instance_size = sizeof(lv_tabview_t)}; static lv_dir_t tabpos_create; @@ -47,7 +47,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab { tabpos_create = tab_pos; tabsize_create = tab_size; - return lv_obj_create_from_class(&lv_tabview, parent, NULL); + return lv_obj_create_from_class(&lv_tabview_class, parent, NULL); } lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name) diff --git a/src/extra/widgets/tabview/lv_tabview.h b/src/extra/widgets/tabview/lv_tabview.h index 975b6c0754..a08914a25a 100644 --- a/src/extra/widgets/tabview/lv_tabview.h +++ b/src/extra/widgets/tabview/lv_tabview.h @@ -34,7 +34,7 @@ typedef struct lv_dir_t tab_pos; }lv_tabview_t; -extern const lv_obj_class_t lv_tabview; +extern const lv_obj_class_t lv_tabview_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index 165524da13..1fc5d43273 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -28,12 +28,12 @@ static void tileview_event_cb(lv_obj_t * tv, lv_event_t e); * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_tileview = {.constructor_cb = lv_tileview_constructor, - .base_class = &lv_obj, +const lv_obj_class_t lv_tileview_class = {.constructor_cb = lv_tileview_constructor, + .base_class = &lv_obj_class, .instance_size = sizeof(lv_tileview_t)}; -const lv_obj_class_t lv_tileview_tile = {.constructor_cb = lv_tileview_tile_constructor, - .base_class = &lv_obj, +const lv_obj_class_t lv_tileview_tile_class = {.constructor_cb = lv_tileview_tile_constructor, + .base_class = &lv_obj_class, .instance_size = sizeof(lv_tileview_tile_t)}; static lv_dir_t create_dir; @@ -56,7 +56,7 @@ static uint32_t create_row_id; */ lv_obj_t * lv_tileview_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_tileview, parent, NULL); + return lv_obj_create_from_class(&lv_tileview_class, parent, NULL); } /*====================== @@ -68,7 +68,7 @@ lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, l create_dir = dir; create_col_id = col_id; create_row_id = row_id; - return lv_obj_create_from_class(&lv_tileview_tile, tv, NULL); + return lv_obj_create_from_class(&lv_tileview_tile_class, tv, NULL); } void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en) diff --git a/src/extra/widgets/tileview/lv_tileview.h b/src/extra/widgets/tileview/lv_tileview.h index f46b1ba47e..e3ad58d9be 100644 --- a/src/extra/widgets/tileview/lv_tileview.h +++ b/src/extra/widgets/tileview/lv_tileview.h @@ -33,8 +33,8 @@ typedef struct { lv_dir_t dir; }lv_tileview_tile_t; -extern const lv_obj_class_t lv_tileview; -extern const lv_obj_class_t lv_tileview_tile; +extern const lv_obj_class_t lv_tileview_class; +extern const lv_obj_class_t lv_tileview_tile_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index 495a5e441c..2cdce99720 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -26,7 +26,7 @@ static void lv_win_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_win = {.constructor_cb = lv_win_constructor, .base_class = &lv_obj, .instance_size = sizeof(lv_win_t)}; +const lv_obj_class_t lv_win_class = {.constructor_cb = lv_win_constructor, .base_class = &lv_obj_class, .instance_size = sizeof(lv_win_t)}; static lv_coord_t create_header_height; /********************** * MACROS @@ -39,7 +39,7 @@ static lv_coord_t create_header_height; lv_obj_t * lv_win_create(lv_obj_t * parent, lv_coord_t header_height) { create_header_height = header_height; - return lv_obj_create_from_class(&lv_win, parent, NULL); + return lv_obj_create_from_class(&lv_win_class, parent, NULL); } lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt) diff --git a/src/extra/widgets/win/lv_win.h b/src/extra/widgets/win/lv_win.h index 82db11c8f5..8b1a0db6ca 100644 --- a/src/extra/widgets/win/lv_win.h +++ b/src/extra/widgets/win/lv_win.h @@ -26,7 +26,7 @@ typedef struct { lv_obj_t obj; }lv_win_t; -extern const lv_obj_class_t lv_win; +extern const lv_obj_class_t lv_win_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 26de1da749..a6dddacdb9 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -34,7 +34,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class #define LV_OBJ_DEF_WIDTH (LV_DPX(100)) #define LV_OBJ_DEF_HEIGHT (LV_DPX(50)) #define GRID_DEBUG 0 /*Draw rectangles on grid cells*/ @@ -86,7 +86,7 @@ static bool lv_initialized = false; static lv_event_temp_data_t * event_temp_data_head; static void * event_act_param; static void * event_act_user_data_cb; -const lv_obj_class_t lv_obj = { +const lv_obj_class_t lv_obj_class = { .constructor_cb = lv_obj_constructor, .destructor_cb = lv_obj_destructor, .signal_cb = lv_obj_signal, @@ -176,7 +176,7 @@ void lv_deinit(void) lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_obj, parent, copy); + return lv_obj_create_from_class(&lv_obj_class, parent, copy); } /*--------------------- diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 8700f94ea2..bdba8b7612 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -228,7 +228,7 @@ typedef uint32_t lv_obj_flag_t; /** * Make the base object's class publicly available. */ -extern const lv_obj_class_t lv_obj; +extern const lv_obj_class_t lv_obj_class; /** * Special, rarely used attributes. diff --git a/src/lv_core/lv_obj_class.c b/src/lv_core/lv_obj_class.c index dcf4349a62..2a084cfbef 100644 --- a/src/lv_core/lv_obj_class.c +++ b/src/lv_core/lv_obj_class.c @@ -11,7 +11,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class /********************** * TYPEDEFS diff --git a/src/lv_core/lv_obj_draw.c b/src/lv_core/lv_obj_draw.c index de5f15fd49..fc2e72603c 100644 --- a/src/lv_core/lv_obj_draw.c +++ b/src/lv_core/lv_obj_draw.c @@ -14,7 +14,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class /********************** * TYPEDEFS diff --git a/src/lv_core/lv_obj_pos.c b/src/lv_core/lv_obj_pos.c index c8cf2350b5..18bd84fb74 100644 --- a/src/lv_core/lv_obj_pos.c +++ b/src/lv_core/lv_obj_pos.c @@ -11,7 +11,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class /********************** * TYPEDEFS diff --git a/src/lv_core/lv_obj_scroll.c b/src/lv_core/lv_obj_scroll.c index 93d64d0807..8a6461208d 100644 --- a/src/lv_core/lv_obj_scroll.c +++ b/src/lv_core/lv_obj_scroll.c @@ -12,7 +12,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class #define SCROLL_ANIM_TIME_MIN 200 /*ms*/ #define SCROLL_ANIM_TIME_MAX 400 /*ms*/ diff --git a/src/lv_core/lv_obj_style.c b/src/lv_core/lv_obj_style.c index a35a050f7c..9b010b46ff 100644 --- a/src/lv_core/lv_obj_style.c +++ b/src/lv_core/lv_obj_style.c @@ -17,7 +17,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class /********************** * TYPEDEFS diff --git a/src/lv_core/lv_obj_tree.c b/src/lv_core/lv_obj_tree.c index a71c9b11e8..7e18d41f50 100644 --- a/src/lv_core/lv_obj_tree.c +++ b/src/lv_core/lv_obj_tree.c @@ -15,7 +15,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_obj +#define MY_CLASS &lv_obj_class #if defined(LV_USER_DATA_FREE_INCLUDE) #include LV_USER_DATA_FREE_INCLUDE diff --git a/src/lv_widgets/lv_arc.c b/src/lv_widgets/lv_arc.c index 4a4b69f71f..37f01c56f9 100644 --- a/src/lv_widgets/lv_arc.c +++ b/src/lv_widgets/lv_arc.c @@ -18,7 +18,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_arc +#define MY_CLASS &lv_arc_class #define VALUE_UNSET INT16_MIN @@ -42,14 +42,14 @@ static void value_update(lv_obj_t * arc); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_arc = { +const lv_obj_class_t lv_arc_class = { .constructor_cb = lv_arc_constructor, .destructor_cb = lv_arc_destructor, .signal_cb = lv_arc_signal, .draw_cb = lv_arc_draw, .instance_size = sizeof(lv_arc_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -68,7 +68,7 @@ const lv_obj_class_t lv_arc = { */ lv_obj_t * lv_arc_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_arc, parent, copy); + return lv_obj_create_from_class(&lv_arc_class, parent, copy); } /*====================== diff --git a/src/lv_widgets/lv_arc.h b/src/lv_widgets/lv_arc.h index b62e413d2a..0bcc83d317 100644 --- a/src/lv_widgets/lv_arc.h +++ b/src/lv_widgets/lv_arc.h @@ -52,7 +52,7 @@ typedef struct { int16_t last_angle; /*Last dragging angle of the arc*/ }lv_arc_t; -extern const lv_obj_class_t lv_arc; +extern const lv_obj_class_t lv_arc_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_bar.c b/src/lv_widgets/lv_bar.c index 2be6976d21..8a7c100640 100644 --- a/src/lv_widgets/lv_bar.c +++ b/src/lv_widgets/lv_bar.c @@ -18,7 +18,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_bar +#define MY_CLASS &lv_bar_class /** hor. pad and ver. pad cannot make the indicator smaller then this [px]*/ #define LV_BAR_SIZE_MIN 4 @@ -59,13 +59,13 @@ static void lv_bar_anim_ready(lv_anim_t * a); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_bar = { +const lv_obj_class_t lv_bar_class = { .constructor_cb = lv_bar_constructor, .destructor_cb = lv_bar_destructor, .signal_cb = lv_bar_signal, .draw_cb = lv_bar_draw, .instance_size = sizeof(lv_bar_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -78,7 +78,7 @@ const lv_obj_class_t lv_bar = { lv_obj_t * lv_bar_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_bar, parent, copy); + return lv_obj_create_from_class(&lv_bar_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_bar.h b/src/lv_widgets/lv_bar.h index d8bb73031b..8d377e4b4f 100644 --- a/src/lv_widgets/lv_bar.h +++ b/src/lv_widgets/lv_bar.h @@ -56,7 +56,7 @@ typedef struct { lv_bar_type_t type : 2; /**< Type of bar*/ }lv_bar_t; -extern const lv_obj_class_t lv_bar; +extern const lv_obj_class_t lv_bar_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_btn.c b/src/lv_widgets/lv_btn.c index 662d874904..13018eddf0 100644 --- a/src/lv_widgets/lv_btn.c +++ b/src/lv_widgets/lv_btn.c @@ -13,7 +13,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_btn +#define MY_CLASS &lv_btn_class /********************** * TYPEDEFS @@ -27,10 +27,10 @@ static void lv_btn_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_btn = { +const lv_obj_class_t lv_btn_class = { .constructor_cb = lv_btn_constructor, .instance_size = sizeof(lv_btn_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -43,7 +43,7 @@ const lv_obj_class_t lv_btn = { lv_obj_t * lv_btn_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_btn, parent, copy); + return lv_obj_create_from_class(&lv_btn_class, parent, copy); } /********************** diff --git a/src/lv_widgets/lv_btn.h b/src/lv_widgets/lv_btn.h index 0c27573e72..ea11b9aa76 100644 --- a/src/lv_widgets/lv_btn.h +++ b/src/lv_widgets/lv_btn.h @@ -30,7 +30,7 @@ typedef struct { lv_obj_t obj; }lv_btn_t; -extern const lv_obj_class_t lv_btn; +extern const lv_obj_class_t lv_btn_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_btnmatrix.c b/src/lv_widgets/lv_btnmatrix.c index bbf2855d29..5286600a0c 100644 --- a/src/lv_widgets/lv_btnmatrix.c +++ b/src/lv_widgets/lv_btnmatrix.c @@ -20,7 +20,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_btnmatrix +#define MY_CLASS &lv_btnmatrix_class #define BTN_EXTRA_CLICK_AREA_MAX (LV_DPI_DEF / 4) #define LV_BTNMATRIX_WIDTH_MASK 0x0007 @@ -55,14 +55,14 @@ static void make_one_button_checked(lv_obj_t * obj, uint16_t btn_idx); **********************/ static const char * lv_btnmatrix_def_map[] = {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}; -const lv_obj_class_t lv_btnmatrix = { +const lv_obj_class_t lv_btnmatrix_class = { .constructor_cb = lv_btnmatrix_constructor, .destructor_cb = lv_btnmatrix_destructor, .signal_cb = lv_btnmatrix_signal, .draw_cb = lv_btnmatrix_draw, .instance_size = sizeof(lv_btnmatrix_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -75,7 +75,7 @@ const lv_obj_class_t lv_btnmatrix = { lv_obj_t * lv_btnmatrix_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_btnmatrix, parent, copy); + return lv_obj_create_from_class(&lv_btnmatrix_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_btnmatrix.h b/src/lv_widgets/lv_btnmatrix.h index 0d29f2c291..afa165aa66 100644 --- a/src/lv_widgets/lv_btnmatrix.h +++ b/src/lv_widgets/lv_btnmatrix.h @@ -66,7 +66,7 @@ typedef struct { } lv_btnmatrix_t; -extern const lv_obj_class_t lv_btnmatrix; +extern const lv_obj_class_t lv_btnmatrix_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_canvas.c b/src/lv_widgets/lv_canvas.c index cf190d74fb..490f13e9ea 100644 --- a/src/lv_widgets/lv_canvas.c +++ b/src/lv_widgets/lv_canvas.c @@ -18,7 +18,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_canvas +#define MY_CLASS &lv_canvas_class /********************** * TYPEDEFS @@ -52,11 +52,11 @@ static void set_px_alpha_generic(lv_img_dsc_t * d, lv_coord_t x, lv_coord_t y, l /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_canvas = { +const lv_obj_class_t lv_canvas_class = { .constructor_cb = lv_canvas_constructor, .destructor_cb = lv_canvas_destructor, .instance_size = sizeof(lv_canvas_t), - .base_class = &lv_img + .base_class = &lv_img_class }; /********************** @@ -69,7 +69,7 @@ const lv_obj_class_t lv_canvas = { lv_obj_t * lv_canvas_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_canvas, parent, copy); + return lv_obj_create_from_class(&lv_canvas_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index 33457a3748..1c74a1075d 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -19,7 +19,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_chart +#define MY_CLASS &lv_chart_class #define LV_CHART_YMIN_DEF 0 #define LV_CHART_YMAX_DEF 100 @@ -51,13 +51,13 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_chart = { +const lv_obj_class_t lv_chart_class = { .constructor_cb = lv_chart_constructor, .destructor_cb = lv_chart_destructor, .signal_cb = lv_chart_signal, .draw_cb = lv_chart_draw, .instance_size = sizeof(lv_chart_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -70,7 +70,7 @@ const lv_obj_class_t lv_chart = { lv_obj_t * lv_chart_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_chart, parent, copy); + return lv_obj_create_from_class(&lv_chart_class, parent, copy); } void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type) diff --git a/src/lv_widgets/lv_chart.h b/src/lv_widgets/lv_chart.h index e1fed86671..d929a71f9a 100644 --- a/src/lv_widgets/lv_chart.h +++ b/src/lv_widgets/lv_chart.h @@ -100,7 +100,7 @@ typedef struct { lv_chart_update_mode_t update_mode : 1; }lv_chart_t; -extern const lv_obj_class_t lv_chart; +extern const lv_obj_class_t lv_chart_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_checkbox.c b/src/lv_widgets/lv_checkbox.c index 67dc574435..2a0fc026b0 100644 --- a/src/lv_widgets/lv_checkbox.c +++ b/src/lv_widgets/lv_checkbox.c @@ -16,7 +16,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_checkbox +#define MY_CLASS &lv_checkbox_class /********************** * TYPEDEFS @@ -33,13 +33,13 @@ static lv_res_t lv_checkbox_signal(lv_obj_t * obj, lv_signal_t sign, void * para /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_checkbox = { +const lv_obj_class_t lv_checkbox_class = { .constructor_cb = lv_checkbox_constructor, .destructor_cb = lv_checkbox_destructor, .signal_cb = lv_checkbox_signal, .draw_cb = lv_checkbox_draw, .instance_size = sizeof(lv_checkbox_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -52,7 +52,7 @@ const lv_obj_class_t lv_checkbox = { lv_obj_t * lv_checkbox_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_checkbox, parent, copy); + return lv_obj_create_from_class(&lv_checkbox_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_checkbox.h b/src/lv_widgets/lv_checkbox.h index ab1dd47450..17c3638b6b 100644 --- a/src/lv_widgets/lv_checkbox.h +++ b/src/lv_widgets/lv_checkbox.h @@ -32,7 +32,7 @@ typedef struct { uint32_t static_txt :1; }lv_checkbox_t; -extern const lv_obj_class_t lv_checkbox; +extern const lv_obj_class_t lv_checkbox_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index 180c05b7ee..488ccc9fe8 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -23,8 +23,8 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_dropdown -#define MY_CLASS_LIST &lv_dropdown_list +#define MY_CLASS &lv_dropdown_class +#define MY_CLASS_LIST &lv_dropdown_list_class #define LV_DROPDOWN_PR_NONE 0xFFFF @@ -55,22 +55,22 @@ static lv_obj_t * get_label(const lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_dropdown = { +const lv_obj_class_t lv_dropdown_class = { .constructor_cb = lv_dropdown_constructor, .destructor_cb = lv_dropdown_destructor, .signal_cb = lv_dropdown_signal, .draw_cb = lv_dropdown_draw, .instance_size = sizeof(lv_dropdown_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, - .base_class = &lv_obj + .base_class = &lv_obj_class }; -const lv_obj_class_t lv_dropdown_list = { +const lv_obj_class_t lv_dropdown_list_class = { .constructor_cb = lv_dropdown_list_constructor, .signal_cb = lv_dropdown_list_signal, .draw_cb = lv_dropdown_list_draw, .instance_size = sizeof(lv_dropdown_list_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; @@ -84,7 +84,7 @@ const lv_obj_class_t lv_dropdown_list = { lv_obj_t * lv_dropdown_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_dropdown, parent, copy); + return lv_obj_create_from_class(&lv_dropdown_class, parent, copy); } /*===================== @@ -517,7 +517,7 @@ void lv_dropdown_close(lv_obj_t * obj) */ lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_dropdown_list, parent, copy); + return lv_obj_create_from_class(&lv_dropdown_list_class, parent, copy); } static void lv_dropdown_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy) diff --git a/src/lv_widgets/lv_dropdown.h b/src/lv_widgets/lv_dropdown.h index d7bd05f6fa..6229900771 100644 --- a/src/lv_widgets/lv_dropdown.h +++ b/src/lv_widgets/lv_dropdown.h @@ -55,8 +55,8 @@ typedef struct { lv_obj_t * dropdown; }lv_dropdown_list_t; -extern const lv_obj_class_t lv_dropdown; -extern const lv_obj_class_t lv_dropdown_list; +extern const lv_obj_class_t lv_dropdown_class; +extern const lv_obj_class_t lv_dropdown_list_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_img.c b/src/lv_widgets/lv_img.c index 1d625cf5f9..12a6eef80d 100644 --- a/src/lv_widgets/lv_img.c +++ b/src/lv_widgets/lv_img.c @@ -19,7 +19,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_img +#define MY_CLASS &lv_img_class /********************** * TYPEDEFS @@ -36,13 +36,13 @@ static lv_res_t lv_img_signal(lv_obj_t * obj, lv_signal_t sign, void * param); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_img = { +const lv_obj_class_t lv_img_class = { .constructor_cb = lv_img_constructor, .destructor_cb = lv_img_destructor, .signal_cb = lv_img_signal, .draw_cb = lv_img_draw, .instance_size = sizeof(lv_img_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -55,7 +55,7 @@ const lv_obj_class_t lv_img = { lv_obj_t * lv_img_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_img, parent, copy); + return lv_obj_create_from_class(&lv_img_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_img.h b/src/lv_widgets/lv_img.h index b44b5081ef..b818ab1db9 100644 --- a/src/lv_widgets/lv_img.h +++ b/src/lv_widgets/lv_img.h @@ -43,7 +43,7 @@ typedef struct { uint8_t antialias : 1; /*Apply anti-aliasing in transformations (rotate, zoom)*/ } lv_img_t; -extern const lv_obj_class_t lv_img; +extern const lv_obj_class_t lv_img_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_label.c b/src/lv_widgets/lv_label.c index 64d1965223..1b6a85fe38 100644 --- a/src/lv_widgets/lv_label.c +++ b/src/lv_widgets/lv_label.c @@ -21,7 +21,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_label +#define MY_CLASS &lv_label_class #define LV_LABEL_DEF_SCROLL_SPEED 25 #define LV_LABEL_DOT_END_INV 0xFFFFFFFF @@ -53,13 +53,13 @@ static void get_txt_coords(const lv_obj_t * label, lv_area_t * area); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_label = { +const lv_obj_class_t lv_label_class = { .constructor_cb = lv_label_constructor, .destructor_cb = lv_label_destructor, .signal_cb = lv_label_signal, .draw_cb = lv_label_draw, .instance_size = sizeof(lv_label_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -72,7 +72,7 @@ const lv_obj_class_t lv_label = { lv_obj_t * lv_label_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_label, parent, copy); + return lv_obj_create_from_class(&lv_label_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_label.h b/src/lv_widgets/lv_label.h index d9f640bb3e..69b0059583 100644 --- a/src/lv_widgets/lv_label.h +++ b/src/lv_widgets/lv_label.h @@ -76,7 +76,7 @@ typedef struct { uint8_t dot_tmp_alloc : 1; /*1: dot_tmp has been allocated;.0: dot_tmp directly holds up to 4 bytes of characters */ }lv_label_t; -extern const lv_obj_class_t lv_label; +extern const lv_obj_class_t lv_label_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_line.c b/src/lv_widgets/lv_line.c index e9a5b0a584..ff8b7851bb 100644 --- a/src/lv_widgets/lv_line.c +++ b/src/lv_widgets/lv_line.c @@ -19,7 +19,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_line +#define MY_CLASS &lv_line_class /********************** * TYPEDEFS @@ -36,13 +36,13 @@ static lv_res_t lv_line_signal(lv_obj_t * obj, lv_signal_t sign, void * param); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_line = { +const lv_obj_class_t lv_line_class = { .constructor_cb = lv_line_constructor, .destructor_cb = lv_line_destructor, .signal_cb = lv_line_signal, .draw_cb = lv_line_draw, .instance_size = sizeof(lv_line_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -55,7 +55,7 @@ const lv_obj_class_t lv_line = { lv_obj_t * lv_line_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_line, parent, copy); + return lv_obj_create_from_class(&lv_line_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_line.h b/src/lv_widgets/lv_line.h index a99ce68cac..898a46b639 100644 --- a/src/lv_widgets/lv_line.h +++ b/src/lv_widgets/lv_line.h @@ -35,7 +35,7 @@ typedef struct { uint8_t y_inv : 1; /**< 1: y == 0 will be on the bottom*/ } lv_line_t; -extern const lv_obj_class_t lv_line; +extern const lv_obj_class_t lv_line_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_meter.c b/src/lv_widgets/lv_meter.c index 3f3716757c..ec5dea4de6 100644 --- a/src/lv_widgets/lv_meter.c +++ b/src/lv_widgets/lv_meter.c @@ -18,7 +18,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_meter +#define MY_CLASS &lv_meter_class /********************** * TYPEDEFS @@ -37,12 +37,12 @@ static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_a /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_meter = { +const lv_obj_class_t lv_meter_class = { .constructor_cb = lv_meter_constructor, .destructor_cb = lv_meter_destructor, .draw_cb = lv_meter_draw, .instance_size = sizeof(lv_meter_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -55,7 +55,7 @@ const lv_obj_class_t lv_meter = { lv_obj_t * lv_meter_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_meter, parent, copy); + return lv_obj_create_from_class(&lv_meter_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_meter.h b/src/lv_widgets/lv_meter.h index c46554ffa9..cfa3f3cdd3 100644 --- a/src/lv_widgets/lv_meter.h +++ b/src/lv_widgets/lv_meter.h @@ -93,7 +93,7 @@ typedef struct { lv_ll_t scale_ll; } lv_meter_t; -extern const lv_obj_class_t lv_meter; +extern const lv_obj_class_t lv_meter_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_objx_templ.c b/src/lv_widgets/lv_objx_templ.c index a08d77ffbf..ff71ba280a 100644 --- a/src/lv_widgets/lv_objx_templ.c +++ b/src/lv_widgets/lv_objx_templ.c @@ -23,7 +23,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_templ +#define MY_CLASS &lv_templ_class /********************** * TYPEDEFS diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index c0ab5e2008..5f144e5268 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -18,8 +18,8 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_roller -#define MY_CLASS_LABEL &lv_roller_label +#define MY_CLASS &lv_roller_class +#define MY_CLASS_LABEL &lv_roller_label_class /********************** * TYPEDEFS @@ -43,19 +43,19 @@ static void scroll_anim_ready_cb(lv_anim_t * a); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_roller = { +const lv_obj_class_t lv_roller_class = { .constructor_cb = lv_roller_constructor, .signal_cb = lv_roller_signal, .draw_cb = lv_roller_draw, .instance_size = sizeof(lv_roller_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; -const lv_obj_class_t lv_roller_label = { +const lv_obj_class_t lv_roller_label_class = { .signal_cb = lv_roller_label_signal, .draw_cb = lv_roller_label_draw, .instance_size = sizeof(lv_label_t), - .base_class = &lv_label + .base_class = &lv_label_class };; /********************** @@ -74,7 +74,7 @@ const lv_obj_class_t lv_roller_label = { */ lv_obj_t * lv_roller_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_roller, parent, copy); + return lv_obj_create_from_class(&lv_roller_class, parent, copy); } /*===================== @@ -297,12 +297,12 @@ static void lv_roller_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_ob lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); lv_obj_set_width(obj, LV_SIZE_CONTENT); - lv_obj_create_from_class(&lv_roller_label, obj, NULL); + lv_obj_create_from_class(&lv_roller_label_class, obj, NULL); lv_roller_set_options(obj, "Option 1\nOption 2\nOption 3\nOption 4\nOption 5", LV_ROLLER_MODE_NORMAL); lv_roller_set_visible_row_count(obj, 3); } else { - lv_obj_create_from_class(&lv_roller_label, obj, NULL); + lv_obj_create_from_class(&lv_roller_label_class, obj, NULL); lv_roller_t * copy_roller = (lv_roller_t *) copy; roller->mode = copy_roller->mode; roller->option_cnt = copy_roller->option_cnt; diff --git a/src/lv_widgets/lv_roller.h b/src/lv_widgets/lv_roller.h index f7130202c9..627d21d849 100644 --- a/src/lv_widgets/lv_roller.h +++ b/src/lv_widgets/lv_roller.h @@ -45,7 +45,7 @@ typedef struct { uint32_t moved : 1; }lv_roller_t; -extern const lv_obj_class_t lv_roller; +extern const lv_obj_class_t lv_roller_class; /********************** diff --git a/src/lv_widgets/lv_slider.c b/src/lv_widgets/lv_slider.c index 9044620ae0..4713308011 100644 --- a/src/lv_widgets/lv_slider.c +++ b/src/lv_widgets/lv_slider.c @@ -21,7 +21,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_slider +#define MY_CLASS &lv_slider_class #define LV_SLIDER_KNOB_COORD(hor, is_rtl, area) (hor ? (is_rtl ? area.x1 : area.x2) : (is_rtl ? area.y1 : area.y2)) @@ -42,14 +42,14 @@ static void draw_knob(lv_obj_t * obj, const lv_area_t * clip_area); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_slider = { +const lv_obj_class_t lv_slider_class = { .constructor_cb = lv_slider_constructor, .destructor_cb = lv_slider_destructor, .signal_cb = lv_slider_signal, .draw_cb = lv_slider_draw, .editable = LV_OBJ_CLASS_EDITABLE_TRUE, .instance_size = sizeof(lv_slider_t), - .base_class = &lv_bar + .base_class = &lv_bar_class }; /********************** @@ -63,7 +63,7 @@ const lv_obj_class_t lv_slider = { lv_obj_t * lv_slider_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_slider, parent, copy); + return lv_obj_create_from_class(&lv_slider_class, parent, copy); } bool lv_slider_is_dragged(const lv_obj_t * obj) diff --git a/src/lv_widgets/lv_slider.h b/src/lv_widgets/lv_slider.h index e7faeb85ba..9fbbac7d64 100644 --- a/src/lv_widgets/lv_slider.h +++ b/src/lv_widgets/lv_slider.h @@ -49,7 +49,7 @@ typedef struct { uint8_t left_knob_focus : 1; /*1: with encoder now the right knob can be adjusted*/ }lv_slider_t; -extern const lv_obj_class_t lv_slider; +extern const lv_obj_class_t lv_slider_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_switch.c b/src/lv_widgets/lv_switch.c index bfb539c92d..a686325a2d 100644 --- a/src/lv_widgets/lv_switch.c +++ b/src/lv_widgets/lv_switch.c @@ -24,7 +24,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_switch +#define MY_CLASS &lv_switch_class /********************** * TYPEDEFS @@ -41,13 +41,13 @@ static lv_draw_res_t lv_switch_draw(lv_obj_t * sw, const lv_area_t * clip_area, /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_switch = { +const lv_obj_class_t lv_switch_class = { .constructor_cb = lv_switch_constructor, .destructor_cb = lv_switch_destructor, .signal_cb = lv_switch_signal, .draw_cb = lv_switch_draw, .instance_size = sizeof(lv_switch_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; /********************** @@ -67,7 +67,7 @@ const lv_obj_class_t lv_switch = { */ lv_obj_t * lv_switch_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_switch, parent, copy); + return lv_obj_create_from_class(&lv_switch_class, parent, copy); } /********************** diff --git a/src/lv_widgets/lv_switch.h b/src/lv_widgets/lv_switch.h index d845377fda..a61c65c7a6 100644 --- a/src/lv_widgets/lv_switch.h +++ b/src/lv_widgets/lv_switch.h @@ -37,7 +37,7 @@ typedef struct { }lv_switch_t; -extern const lv_obj_class_t lv_switch; +extern const lv_obj_class_t lv_switch_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_table.c b/src/lv_widgets/lv_table.c index a5a7a934bd..bcbe8371a1 100644 --- a/src/lv_widgets/lv_table.c +++ b/src/lv_widgets/lv_table.c @@ -20,7 +20,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_table +#define MY_CLASS &lv_table_class /********************** * TYPEDEFS @@ -41,12 +41,12 @@ static void refr_size(lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_table = { +const lv_obj_class_t lv_table_class = { .constructor_cb = lv_table_constructor, .destructor_cb = lv_table_destructor, .signal_cb = lv_table_signal, .draw_cb = lv_table_draw, - .base_class = &lv_obj, + .base_class = &lv_obj_class, .instance_size = sizeof(lv_table_t), }; /********************** @@ -65,7 +65,7 @@ const lv_obj_class_t lv_table = { */ lv_obj_t * lv_table_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_table, parent, copy); + return lv_obj_create_from_class(&lv_table_class, parent, copy); } /*===================== diff --git a/src/lv_widgets/lv_table.h b/src/lv_widgets/lv_table.h index cf707d3fb0..6925a02662 100644 --- a/src/lv_widgets/lv_table.h +++ b/src/lv_widgets/lv_table.h @@ -58,7 +58,7 @@ typedef struct { lv_coord_t * col_w; } lv_table_t; -extern const lv_obj_class_t lv_table; +extern const lv_obj_class_t lv_table_class; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index 86f89df2a5..3c67883785 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -22,7 +22,7 @@ /********************* * DEFINES *********************/ -#define MY_CLASS &lv_textarea +#define MY_CLASS &lv_textarea_class /*Test configuration*/ #ifndef LV_TEXTAREA_DEF_CURSOR_BLINK_TIME @@ -64,14 +64,14 @@ static void draw_cursor(lv_obj_t * obj, const lv_area_t * clip_area); /********************** * STATIC VARIABLES **********************/ -const lv_obj_class_t lv_textarea = { +const lv_obj_class_t lv_textarea_class = { .constructor_cb = lv_textarea_constructor, .destructor_cb = lv_textarea_destructor, .signal_cb = lv_textarea_signal, .draw_cb = lv_textarea_draw, .editable = LV_OBJ_CLASS_EDITABLE_TRUE, .instance_size = sizeof(lv_textarea_t), - .base_class = &lv_obj + .base_class = &lv_obj_class }; static const char * ta_insert_replace; @@ -92,7 +92,7 @@ static const char * ta_insert_replace; */ lv_obj_t * lv_textarea_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_textarea, parent, copy); + return lv_obj_create_from_class(&lv_textarea_class, parent, copy); } /*====================== diff --git a/src/lv_widgets/lv_textarea.h b/src/lv_widgets/lv_textarea.h index f30d984d2c..f79534c6d2 100644 --- a/src/lv_widgets/lv_textarea.h +++ b/src/lv_widgets/lv_textarea.h @@ -65,7 +65,7 @@ typedef struct { uint8_t one_line : 1; /*One line mode (ignore line breaks)*/ } lv_textarea_t; -extern const lv_obj_class_t lv_textarea; +extern const lv_obj_class_t lv_textarea_class; enum { LV_PART_TEXTAREA_PLACEHOLDER = LV_PART_CUSTOM_1,