init Files
This commit is contained in:
7
libraries/lvgl/examples/widgets/animimg/index.rst
Normal file
7
libraries/lvgl/examples/widgets/animimg/index.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
Simple Animation Image
|
||||
----------------------
|
||||
|
||||
.. lv_example:: widgets/animimg/lv_example_animimg_1
|
||||
:language: c
|
||||
:description: A simple example to demonstrate the use of an animation image.
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_ANIMIMG && LV_BUILD_EXAMPLES
|
||||
LV_IMAGE_DECLARE(animimg001);
|
||||
LV_IMAGE_DECLARE(animimg002);
|
||||
LV_IMAGE_DECLARE(animimg003);
|
||||
|
||||
static const lv_image_dsc_t * anim_imgs[3] = {
|
||||
&animimg001,
|
||||
& animimg002,
|
||||
& animimg003,
|
||||
};
|
||||
|
||||
void lv_example_animimg_1(void)
|
||||
{
|
||||
lv_obj_t * animimg0 = lv_animimg_create(lv_screen_active());
|
||||
lv_obj_center(animimg0);
|
||||
lv_animimg_set_src(animimg0, (const void **) anim_imgs, 3);
|
||||
lv_animimg_set_duration(animimg0, 1000);
|
||||
lv_animimg_set_repeat_count(animimg0, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_animimg_start(animimg0);
|
||||
}
|
||||
|
||||
#endif
|
||||
14
libraries/lvgl/examples/widgets/arc/index.rst
Normal file
14
libraries/lvgl/examples/widgets/arc/index.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
Simple Arc
|
||||
----------
|
||||
|
||||
.. lv_example:: widgets/arc/lv_example_arc_1
|
||||
:language: c
|
||||
:description: A simple example to demonstrate the use of an arc.
|
||||
|
||||
Loader with Arc
|
||||
---------------
|
||||
|
||||
.. lv_example:: widgets/arc/lv_example_arc_2
|
||||
:language: c
|
||||
|
||||
35
libraries/lvgl/examples/widgets/arc/lv_example_arc_1.c
Normal file
35
libraries/lvgl/examples/widgets/arc/lv_example_arc_1.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_ARC && LV_BUILD_EXAMPLES
|
||||
|
||||
static void value_changed_event_cb(lv_event_t * e);
|
||||
|
||||
void lv_example_arc_1(void)
|
||||
{
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
|
||||
/*Create an Arc*/
|
||||
lv_obj_t * arc = lv_arc_create(lv_screen_active());
|
||||
lv_obj_set_size(arc, 150, 150);
|
||||
lv_arc_set_rotation(arc, 135);
|
||||
lv_arc_set_bg_angles(arc, 0, 270);
|
||||
lv_arc_set_value(arc, 10);
|
||||
lv_obj_center(arc);
|
||||
lv_obj_add_event_cb(arc, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, label);
|
||||
|
||||
/*Manually update the label for the first time*/
|
||||
lv_obj_send_event(arc, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
}
|
||||
|
||||
static void value_changed_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * arc = lv_event_get_target(e);
|
||||
lv_obj_t * label = lv_event_get_user_data(e);
|
||||
|
||||
lv_label_set_text_fmt(label, "%" LV_PRId32 "%%", lv_arc_get_value(arc));
|
||||
|
||||
/*Rotate the label to the current position of the arc*/
|
||||
lv_arc_rotate_obj_to_angle(arc, label, 25);
|
||||
}
|
||||
|
||||
#endif
|
||||
35
libraries/lvgl/examples/widgets/arc/lv_example_arc_2.c
Normal file
35
libraries/lvgl/examples/widgets/arc/lv_example_arc_2.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_ARC && LV_BUILD_EXAMPLES
|
||||
|
||||
static void set_angle(void * obj, int32_t v)
|
||||
{
|
||||
lv_arc_set_value(obj, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an arc which acts as a loader.
|
||||
*/
|
||||
void lv_example_arc_2(void)
|
||||
{
|
||||
/*Create an Arc*/
|
||||
lv_obj_t * arc = lv_arc_create(lv_screen_active());
|
||||
lv_arc_set_rotation(arc, 270);
|
||||
lv_arc_set_bg_angles(arc, 0, 360);
|
||||
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
||||
lv_obj_center(arc);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, arc);
|
||||
lv_anim_set_exec_cb(&a, set_angle);
|
||||
lv_anim_set_duration(&a, 1000);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
|
||||
lv_anim_set_repeat_delay(&a, 500);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_start(&a);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
42
libraries/lvgl/examples/widgets/bar/index.rst
Normal file
42
libraries/lvgl/examples/widgets/bar/index.rst
Normal file
@@ -0,0 +1,42 @@
|
||||
Simple Bar
|
||||
----------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_1
|
||||
:language: c
|
||||
|
||||
Styling a bar
|
||||
-------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_2
|
||||
:language: c
|
||||
|
||||
Temperature meter
|
||||
-----------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_3
|
||||
:language: c
|
||||
|
||||
Stripe pattern and range value
|
||||
------------------------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_4
|
||||
:language: c
|
||||
|
||||
Bar with LTR and RTL base direction
|
||||
-----------------------------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_5
|
||||
:language: c
|
||||
|
||||
Custom drawer to show the current value
|
||||
---------------------------------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_6
|
||||
:language: c
|
||||
|
||||
Bar with opposite direction
|
||||
---------------------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_7
|
||||
:language: c
|
||||
|
||||
12
libraries/lvgl/examples/widgets/bar/lv_example_bar_1.c
Normal file
12
libraries/lvgl/examples/widgets/bar/lv_example_bar_1.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_bar_1(void)
|
||||
{
|
||||
lv_obj_t * bar1 = lv_bar_create(lv_screen_active());
|
||||
lv_obj_set_size(bar1, 200, 20);
|
||||
lv_obj_center(bar1);
|
||||
lv_bar_set_value(bar1, 70, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
#endif
|
||||
34
libraries/lvgl/examples/widgets/bar/lv_example_bar_2.c
Normal file
34
libraries/lvgl/examples/widgets/bar/lv_example_bar_2.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Example of styling the bar
|
||||
*/
|
||||
void lv_example_bar_2(void)
|
||||
{
|
||||
static lv_style_t style_bg;
|
||||
static lv_style_t style_indic;
|
||||
|
||||
lv_style_init(&style_bg);
|
||||
lv_style_set_border_color(&style_bg, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_border_width(&style_bg, 2);
|
||||
lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/
|
||||
lv_style_set_radius(&style_bg, 6);
|
||||
lv_style_set_anim_duration(&style_bg, 1000);
|
||||
|
||||
lv_style_init(&style_indic);
|
||||
lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_radius(&style_indic, 3);
|
||||
|
||||
lv_obj_t * bar = lv_bar_create(lv_screen_active());
|
||||
lv_obj_remove_style_all(bar); /*To have a clean start*/
|
||||
lv_obj_add_style(bar, &style_bg, 0);
|
||||
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
|
||||
|
||||
lv_obj_set_size(bar, 200, 20);
|
||||
lv_obj_center(bar);
|
||||
lv_bar_set_value(bar, 100, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
#endif
|
||||
39
libraries/lvgl/examples/widgets/bar/lv_example_bar_3.c
Normal file
39
libraries/lvgl/examples/widgets/bar/lv_example_bar_3.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
static void set_temp(void * bar, int32_t temp)
|
||||
{
|
||||
lv_bar_set_value(bar, temp, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* A temperature meter example
|
||||
*/
|
||||
void lv_example_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_palette_main(LV_PALETTE_RED));
|
||||
lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER);
|
||||
|
||||
lv_obj_t * bar = lv_bar_create(lv_screen_active());
|
||||
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
|
||||
lv_obj_set_size(bar, 20, 200);
|
||||
lv_obj_center(bar);
|
||||
lv_bar_set_range(bar, -20, 40);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_exec_cb(&a, set_temp);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_set_var(&a, bar);
|
||||
lv_anim_set_values(&a, -20, 40);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
#endif
|
||||
27
libraries/lvgl/examples/widgets/bar/lv_example_bar_4.c
Normal file
27
libraries/lvgl/examples/widgets/bar/lv_example_bar_4.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Bar with stripe pattern and ranged value
|
||||
*/
|
||||
void lv_example_bar_4(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_skew_strip);
|
||||
static lv_style_t style_indic;
|
||||
|
||||
lv_style_init(&style_indic);
|
||||
lv_style_set_bg_image_src(&style_indic, &img_skew_strip);
|
||||
lv_style_set_bg_image_tiled(&style_indic, true);
|
||||
lv_style_set_bg_image_opa(&style_indic, LV_OPA_30);
|
||||
|
||||
lv_obj_t * bar = lv_bar_create(lv_screen_active());
|
||||
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
|
||||
|
||||
lv_obj_set_size(bar, 260, 20);
|
||||
lv_obj_center(bar);
|
||||
lv_bar_set_mode(bar, LV_BAR_MODE_RANGE);
|
||||
lv_bar_set_value(bar, 90, LV_ANIM_OFF);
|
||||
lv_bar_set_start_value(bar, 20, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
#endif
|
||||
31
libraries/lvgl/examples/widgets/bar/lv_example_bar_5.c
Normal file
31
libraries/lvgl/examples/widgets/bar/lv_example_bar_5.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Bar with LTR and RTL base direction
|
||||
*/
|
||||
void lv_example_bar_5(void)
|
||||
{
|
||||
lv_obj_t * label;
|
||||
|
||||
lv_obj_t * bar_ltr = lv_bar_create(lv_screen_active());
|
||||
lv_obj_set_size(bar_ltr, 200, 20);
|
||||
lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF);
|
||||
lv_obj_align(bar_ltr, LV_ALIGN_CENTER, 0, -30);
|
||||
|
||||
label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Left to Right base direction");
|
||||
lv_obj_align_to(label, bar_ltr, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
|
||||
lv_obj_t * bar_rtl = lv_bar_create(lv_screen_active());
|
||||
lv_obj_set_style_base_dir(bar_rtl, LV_BASE_DIR_RTL, 0);
|
||||
lv_obj_set_size(bar_rtl, 200, 20);
|
||||
lv_bar_set_value(bar_rtl, 70, LV_ANIM_OFF);
|
||||
lv_obj_align(bar_rtl, LV_ALIGN_CENTER, 0, 30);
|
||||
|
||||
label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Right to Left base direction");
|
||||
lv_obj_align_to(label, bar_rtl, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
}
|
||||
|
||||
#endif
|
||||
76
libraries/lvgl/examples/widgets/bar/lv_example_bar_6.c
Normal file
76
libraries/lvgl/examples/widgets/bar/lv_example_bar_6.c
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
#define MAX_VALUE 100
|
||||
#define MIN_VALUE 0
|
||||
|
||||
static void set_value(void * bar, int32_t v)
|
||||
{
|
||||
lv_bar_set_value(bar, v, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
label_dsc.font = LV_FONT_DEFAULT;
|
||||
|
||||
char buf[8];
|
||||
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
|
||||
|
||||
lv_point_t txt_size;
|
||||
lv_text_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||
label_dsc.flag);
|
||||
|
||||
lv_area_t txt_area;
|
||||
txt_area.x1 = 0;
|
||||
txt_area.x2 = txt_size.x - 1;
|
||||
txt_area.y1 = 0;
|
||||
txt_area.y2 = txt_size.y - 1;
|
||||
|
||||
lv_area_t indic_area;
|
||||
lv_obj_get_coords(obj, &indic_area);
|
||||
lv_area_set_width(&indic_area, lv_area_get_width(&indic_area) * lv_bar_get_value(obj) / MAX_VALUE);
|
||||
|
||||
/*If the indicator is long enough put the text inside on the right*/
|
||||
if(lv_area_get_width(&indic_area) > txt_size.x + 20) {
|
||||
lv_area_align(&indic_area, &txt_area, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
label_dsc.color = lv_color_white();
|
||||
}
|
||||
/*If the indicator is still short put the text out of it on the right*/
|
||||
else {
|
||||
lv_area_align(&indic_area, &txt_area, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
||||
label_dsc.color = lv_color_black();
|
||||
}
|
||||
label_dsc.text = buf;
|
||||
label_dsc.text_local = true;
|
||||
lv_layer_t * layer = lv_event_get_layer(e);
|
||||
lv_draw_label(layer, &label_dsc, &txt_area);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom drawer on the bar to display the current value
|
||||
*/
|
||||
void lv_example_bar_6(void)
|
||||
{
|
||||
lv_obj_t * bar = lv_bar_create(lv_screen_active());
|
||||
lv_bar_set_range(bar, MIN_VALUE, MAX_VALUE);
|
||||
lv_obj_set_size(bar, 200, 20);
|
||||
lv_obj_center(bar);
|
||||
lv_obj_add_event_cb(bar, event_cb, LV_EVENT_DRAW_MAIN_END, NULL);
|
||||
|
||||
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, set_value);
|
||||
lv_anim_set_duration(&a, 4000);
|
||||
lv_anim_set_playback_duration(&a, 4000);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
22
libraries/lvgl/examples/widgets/bar/lv_example_bar_7.c
Normal file
22
libraries/lvgl/examples/widgets/bar/lv_example_bar_7.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Bar with opposite direction
|
||||
*/
|
||||
void lv_example_bar_7(void)
|
||||
{
|
||||
lv_obj_t * label;
|
||||
|
||||
lv_obj_t * bar_tob = lv_bar_create(lv_screen_active());
|
||||
lv_obj_set_size(bar_tob, 20, 200);
|
||||
lv_bar_set_range(bar_tob, 100, 0);
|
||||
lv_bar_set_value(bar_tob, 70, LV_ANIM_OFF);
|
||||
lv_obj_align(bar_tob, LV_ALIGN_CENTER, 0, -30);
|
||||
|
||||
label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "From top to bottom");
|
||||
lv_obj_align_to(label, bar_tob, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
}
|
||||
|
||||
#endif
|
||||
20
libraries/lvgl/examples/widgets/button/index.rst
Normal file
20
libraries/lvgl/examples/widgets/button/index.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Simple Buttons
|
||||
--------------
|
||||
|
||||
.. lv_example:: widgets/button/lv_example_button_1
|
||||
:language: c
|
||||
|
||||
|
||||
Styling buttons
|
||||
---------------
|
||||
|
||||
.. lv_example:: widgets/button/lv_example_button_2
|
||||
:language: c
|
||||
|
||||
Gummy button
|
||||
------------
|
||||
|
||||
.. lv_example:: widgets/button/lv_example_button_3
|
||||
:language: c
|
||||
|
||||
40
libraries/lvgl/examples/widgets/button/lv_example_button_1.c
Normal file
40
libraries/lvgl/examples/widgets/button/lv_example_button_1.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BUTTON && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
LV_LOG_USER("Clicked");
|
||||
}
|
||||
else if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
LV_LOG_USER("Toggled");
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_button_1(void)
|
||||
{
|
||||
lv_obj_t * label;
|
||||
|
||||
lv_obj_t * btn1 = lv_button_create(lv_screen_active());
|
||||
lv_obj_add_event_cb(btn1, event_handler, LV_EVENT_ALL, NULL);
|
||||
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -40);
|
||||
lv_obj_remove_flag(btn1, LV_OBJ_FLAG_PRESS_LOCK);
|
||||
|
||||
label = lv_label_create(btn1);
|
||||
lv_label_set_text(label, "Button");
|
||||
lv_obj_center(label);
|
||||
|
||||
lv_obj_t * btn2 = lv_button_create(lv_screen_active());
|
||||
lv_obj_add_event_cb(btn2, event_handler, LV_EVENT_ALL, NULL);
|
||||
lv_obj_align(btn2, 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);
|
||||
lv_label_set_text(label, "Toggle");
|
||||
lv_obj_center(label);
|
||||
|
||||
}
|
||||
#endif
|
||||
65
libraries/lvgl/examples/widgets/button/lv_example_button_2.c
Normal file
65
libraries/lvgl/examples/widgets/button/lv_example_button_2.c
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BUTTON && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Style a button from scratch
|
||||
*/
|
||||
void lv_example_button_2(void)
|
||||
{
|
||||
/*Init the style for the default state*/
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
|
||||
lv_style_set_radius(&style, 3);
|
||||
|
||||
lv_style_set_bg_opa(&style, LV_OPA_100);
|
||||
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_bg_grad_color(&style, lv_palette_darken(LV_PALETTE_BLUE, 2));
|
||||
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_palette_main(LV_PALETTE_GREY));
|
||||
|
||||
lv_style_set_shadow_width(&style, 8);
|
||||
lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_style_set_shadow_offset_y(&style, 8);
|
||||
|
||||
lv_style_set_outline_opa(&style, LV_OPA_COVER);
|
||||
lv_style_set_outline_color(&style, lv_palette_main(LV_PALETTE_BLUE));
|
||||
|
||||
lv_style_set_text_color(&style, lv_color_white());
|
||||
lv_style_set_pad_all(&style, 10);
|
||||
|
||||
/*Init the pressed style*/
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
|
||||
/*Add a large outline when pressed*/
|
||||
lv_style_set_outline_width(&style_pr, 30);
|
||||
lv_style_set_outline_opa(&style_pr, LV_OPA_TRANSP);
|
||||
|
||||
lv_style_set_translate_y(&style_pr, 5);
|
||||
lv_style_set_shadow_offset_y(&style_pr, 3);
|
||||
lv_style_set_bg_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 2));
|
||||
lv_style_set_bg_grad_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 4));
|
||||
|
||||
/*Add a transition to the outline*/
|
||||
static lv_style_transition_dsc_t trans;
|
||||
static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0};
|
||||
lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, 300, 0, NULL);
|
||||
|
||||
lv_style_set_transition(&style_pr, &trans);
|
||||
|
||||
lv_obj_t * btn1 = lv_button_create(lv_screen_active());
|
||||
lv_obj_remove_style_all(btn1); /*Remove the style coming from the theme*/
|
||||
lv_obj_add_style(btn1, &style, 0);
|
||||
lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED);
|
||||
lv_obj_set_size(btn1, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_center(btn1);
|
||||
|
||||
lv_obj_t * label = lv_label_create(btn1);
|
||||
lv_label_set_text(label, "Button");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
#endif
|
||||
45
libraries/lvgl/examples/widgets/button/lv_example_button_3.c
Normal file
45
libraries/lvgl/examples/widgets/button/lv_example_button_3.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_BUTTON
|
||||
|
||||
/**
|
||||
* Create a style transition on a button to act like a gum when clicked
|
||||
*/
|
||||
void lv_example_button_3(void)
|
||||
{
|
||||
/*Properties to transition*/
|
||||
static lv_style_prop_t props[] = {
|
||||
LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0
|
||||
};
|
||||
|
||||
/*Transition descriptor when going back to the default state.
|
||||
*Add some delay to be sure the press transition is visible even if the press was very short*/
|
||||
static lv_style_transition_dsc_t transition_dsc_def;
|
||||
lv_style_transition_dsc_init(&transition_dsc_def, props, lv_anim_path_overshoot, 250, 100, NULL);
|
||||
|
||||
/*Transition descriptor when going to pressed state.
|
||||
*No delay, go to presses state immediately*/
|
||||
static lv_style_transition_dsc_t transition_dsc_pr;
|
||||
lv_style_transition_dsc_init(&transition_dsc_pr, props, lv_anim_path_ease_in_out, 250, 0, NULL);
|
||||
|
||||
/*Add only the new transition to he default state*/
|
||||
static lv_style_t style_def;
|
||||
lv_style_init(&style_def);
|
||||
lv_style_set_transition(&style_def, &transition_dsc_def);
|
||||
|
||||
/*Add the transition and some transformation to the presses state.*/
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
lv_style_set_transform_width(&style_pr, 10);
|
||||
lv_style_set_transform_height(&style_pr, -10);
|
||||
lv_style_set_text_letter_space(&style_pr, 10);
|
||||
lv_style_set_transition(&style_pr, &transition_dsc_pr);
|
||||
|
||||
lv_obj_t * btn1 = lv_button_create(lv_screen_active());
|
||||
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -80);
|
||||
lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(btn1, &style_def, 0);
|
||||
|
||||
lv_obj_t * label = lv_label_create(btn1);
|
||||
lv_label_set_text(label, "Gum");
|
||||
}
|
||||
#endif
|
||||
22
libraries/lvgl/examples/widgets/buttonmatrix/index.rst
Normal file
22
libraries/lvgl/examples/widgets/buttonmatrix/index.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Simple Button matrix
|
||||
--------------------
|
||||
|
||||
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_1
|
||||
:language: c
|
||||
|
||||
|
||||
Custom buttons
|
||||
--------------
|
||||
|
||||
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_2
|
||||
:language: c
|
||||
|
||||
|
||||
Pagination
|
||||
----------
|
||||
|
||||
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_3
|
||||
:language: c
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
uint32_t id = lv_buttonmatrix_get_selected_button(obj);
|
||||
const char * txt = lv_buttonmatrix_get_button_text(obj, id);
|
||||
LV_UNUSED(txt);
|
||||
LV_LOG_USER("%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_example_buttonmatrix_1(void)
|
||||
{
|
||||
lv_obj_t * btnm1 = lv_buttonmatrix_create(lv_screen_active());
|
||||
lv_buttonmatrix_set_map(btnm1, btnm_map);
|
||||
lv_buttonmatrix_set_button_width(btnm1, 10, 2); /*Make "Action1" twice as wide as "Action2"*/
|
||||
lv_buttonmatrix_set_button_ctrl(btnm1, 10, LV_BUTTONMATRIX_CTRL_CHECKABLE);
|
||||
lv_buttonmatrix_set_button_ctrl(btnm1, 11, LV_BUTTONMATRIX_CTRL_CHECKED);
|
||||
lv_obj_align(btnm1, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_event_cb(btnm1, event_handler, LV_EVENT_ALL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
/*When the button matrix draws the buttons...*/
|
||||
if(base_dsc->part == LV_PART_ITEMS) {
|
||||
bool pressed = false;
|
||||
if(lv_buttonmatrix_get_selected_button(obj) == base_dsc->id1 && lv_obj_has_state(obj, LV_STATE_PRESSED)) {
|
||||
pressed = true;
|
||||
}
|
||||
|
||||
/*Change the draw descriptor of the 2nd button*/
|
||||
if(base_dsc->id1 == 1) {
|
||||
lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
|
||||
if(fill_draw_dsc) {
|
||||
fill_draw_dsc->radius = 0;
|
||||
if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_BLUE, 3);
|
||||
else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_BLUE);
|
||||
}
|
||||
lv_draw_box_shadow_dsc_t * box_shadow_draw_dsc = lv_draw_task_get_box_shadow_dsc(draw_task);
|
||||
if(box_shadow_draw_dsc) {
|
||||
box_shadow_draw_dsc->width = 6;
|
||||
box_shadow_draw_dsc->ofs_x = 3;
|
||||
box_shadow_draw_dsc->ofs_y = 3;
|
||||
}
|
||||
lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
|
||||
if(label_draw_dsc) {
|
||||
label_draw_dsc->color = lv_color_white();
|
||||
}
|
||||
|
||||
}
|
||||
/*Change the draw descriptor of the 3rd button*/
|
||||
else if(base_dsc->id1 == 2) {
|
||||
lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
|
||||
if(fill_draw_dsc) {
|
||||
fill_draw_dsc->radius = LV_RADIUS_CIRCLE;
|
||||
if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_RED, 3);
|
||||
else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_RED);
|
||||
}
|
||||
}
|
||||
else if(base_dsc->id1 == 3) {
|
||||
lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
|
||||
if(label_draw_dsc) {
|
||||
label_draw_dsc->opa = 0;
|
||||
}
|
||||
if(lv_draw_task_get_type(draw_task) == LV_DRAW_TASK_TYPE_FILL) {
|
||||
LV_IMAGE_DECLARE(img_star);
|
||||
lv_image_header_t header;
|
||||
lv_result_t res = lv_image_decoder_get_info(&img_star, &header);
|
||||
if(res != LV_RESULT_OK) return;
|
||||
|
||||
lv_area_t a;
|
||||
a.x1 = 0;
|
||||
a.x2 = header.w - 1;
|
||||
a.y1 = 0;
|
||||
a.y2 = header.h - 1;
|
||||
lv_area_t draw_task_area;
|
||||
lv_draw_task_get_area(draw_task, &draw_task_area);
|
||||
lv_area_align(&draw_task_area, &a, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
lv_draw_image_dsc_t img_draw_dsc;
|
||||
lv_draw_image_dsc_init(&img_draw_dsc);
|
||||
img_draw_dsc.src = &img_star;
|
||||
img_draw_dsc.recolor = lv_color_black();
|
||||
if(pressed) img_draw_dsc.recolor_opa = LV_OPA_30;
|
||||
|
||||
lv_draw_image(base_dsc->layer, &img_draw_dsc, &a);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom drawer to the button matrix to customize buttons one by one
|
||||
*/
|
||||
void lv_example_buttonmatrix_2(void)
|
||||
{
|
||||
lv_obj_t * btnm = lv_buttonmatrix_create(lv_screen_active());
|
||||
lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||
lv_obj_add_flag(btnm, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
||||
lv_obj_center(btnm);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
uint32_t id = lv_buttonmatrix_get_selected_button(obj);
|
||||
bool prev = id == 0;
|
||||
bool next = id == 6;
|
||||
if(prev || next) {
|
||||
/*Find the checked button*/
|
||||
uint32_t i;
|
||||
for(i = 1; i < 7; i++) {
|
||||
if(lv_buttonmatrix_has_button_ctrl(obj, i, LV_BUTTONMATRIX_CTRL_CHECKED)) break;
|
||||
}
|
||||
|
||||
if(prev && i > 1) i--;
|
||||
else if(next && i < 5) i++;
|
||||
|
||||
lv_buttonmatrix_set_button_ctrl(obj, i, LV_BUTTONMATRIX_CTRL_CHECKED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a button group (pagination)
|
||||
*/
|
||||
void lv_example_buttonmatrix_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_palette_main(LV_PALETTE_GREY));
|
||||
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_buttonmatrix_create(lv_screen_active());
|
||||
lv_buttonmatrix_set_map(btnm, map);
|
||||
lv_obj_add_style(btnm, &style_bg, 0);
|
||||
lv_obj_add_style(btnm, &style_btn, LV_PART_ITEMS);
|
||||
lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
lv_obj_set_size(btnm, 225, 35);
|
||||
|
||||
/*Allow selecting on one number at time*/
|
||||
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
|
||||
lv_buttonmatrix_clear_button_ctrl(btnm, 0, LV_BUTTONMATRIX_CTRL_CHECKABLE);
|
||||
lv_buttonmatrix_clear_button_ctrl(btnm, 6, LV_BUTTONMATRIX_CTRL_CHECKABLE);
|
||||
|
||||
lv_buttonmatrix_set_one_checked(btnm, true);
|
||||
lv_buttonmatrix_set_button_ctrl(btnm, 1, LV_BUTTONMATRIX_CTRL_CHECKED);
|
||||
|
||||
lv_obj_center(btnm);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
12
libraries/lvgl/examples/widgets/calendar/index.rst
Normal file
12
libraries/lvgl/examples/widgets/calendar/index.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
Calendar with header
|
||||
--------------------
|
||||
|
||||
.. lv_example:: widgets/calendar/lv_example_calendar_1
|
||||
:language: c
|
||||
|
||||
Chinese calendar
|
||||
-------------------------------------
|
||||
|
||||
.. lv_example:: widgets/calendar/lv_example_calendar_2
|
||||
:language: c
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CALENDAR && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_current_target(e);
|
||||
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
lv_calendar_date_t date;
|
||||
if(lv_calendar_get_pressed_date(obj, &date)) {
|
||||
LV_LOG_USER("Clicked date: %02d.%02d.%d", date.day, date.month, date.year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_calendar_1(void)
|
||||
{
|
||||
lv_obj_t * calendar = lv_calendar_create(lv_screen_active());
|
||||
lv_obj_set_size(calendar, 185, 230);
|
||||
lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 27);
|
||||
lv_obj_add_event_cb(calendar, event_handler, LV_EVENT_ALL, NULL);
|
||||
|
||||
lv_calendar_set_today_date(calendar, 2021, 02, 23);
|
||||
lv_calendar_set_showed_date(calendar, 2021, 02);
|
||||
|
||||
/*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 = 2021;
|
||||
highlighted_days[0].month = 02;
|
||||
highlighted_days[0].day = 6;
|
||||
|
||||
highlighted_days[1].year = 2021;
|
||||
highlighted_days[1].month = 02;
|
||||
highlighted_days[1].day = 11;
|
||||
|
||||
highlighted_days[2].year = 2022;
|
||||
highlighted_days[2].month = 02;
|
||||
highlighted_days[2].day = 22;
|
||||
|
||||
lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3);
|
||||
|
||||
#if LV_USE_CALENDAR_HEADER_DROPDOWN
|
||||
lv_calendar_header_dropdown_create(calendar);
|
||||
#elif LV_USE_CALENDAR_HEADER_ARROW
|
||||
lv_calendar_header_arrow_create(calendar);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_calendar_2(void)
|
||||
{
|
||||
lv_obj_t * calendar = lv_calendar_create(lv_screen_active());
|
||||
lv_obj_set_size(calendar, 300, 300);
|
||||
lv_obj_align(calendar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
lv_calendar_set_today_date(calendar, 2024, 03, 22);
|
||||
lv_calendar_set_showed_date(calendar, 2024, 03);
|
||||
|
||||
#if LV_USE_CALENDAR_HEADER_DROPDOWN
|
||||
lv_calendar_header_dropdown_create(calendar);
|
||||
#elif LV_USE_CALENDAR_HEADER_ARROW
|
||||
lv_calendar_header_arrow_create(calendar);
|
||||
#endif
|
||||
|
||||
lv_calendar_set_chinese_mode(calendar, true);
|
||||
lv_obj_set_style_text_font(calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void lv_example_calendar_2(void)
|
||||
{
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "chinese calendar is not enabled");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif
|
||||
53
libraries/lvgl/examples/widgets/canvas/index.rst
Normal file
53
libraries/lvgl/examples/widgets/canvas/index.rst
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
Drawing on the Canvas and rotate
|
||||
--------------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_1
|
||||
:language: c
|
||||
|
||||
Transparent Canvas with chroma keying
|
||||
-------------------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_2
|
||||
:language: c
|
||||
|
||||
|
||||
Draw a rectangle to the canvas
|
||||
------------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_3
|
||||
:language: c
|
||||
|
||||
|
||||
Draw a label to the canvas
|
||||
--------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_4
|
||||
:language: c
|
||||
|
||||
|
||||
Draw an arc to the canvas
|
||||
-------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_5
|
||||
:language: c
|
||||
|
||||
|
||||
Draw an image to the canvas
|
||||
---------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_6
|
||||
:language: c
|
||||
|
||||
|
||||
Draw a line to the canvas
|
||||
-------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_7
|
||||
:language: c
|
||||
|
||||
Draw a vector graphic to the canvas
|
||||
-------------------------
|
||||
|
||||
.. lv_example:: widgets/canvas/lv_example_canvas_8
|
||||
:language: c
|
||||
78
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_1.c
Normal file
78
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_1.c
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 200
|
||||
#define CANVAS_HEIGHT 150
|
||||
|
||||
void lv_example_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_VER;
|
||||
rect_dsc.bg_grad.stops[0].color = lv_palette_main(LV_PALETTE_RED);
|
||||
rect_dsc.bg_grad.stops[0].opa = LV_OPA_100;
|
||||
rect_dsc.bg_grad.stops[1].color = lv_palette_main(LV_PALETTE_BLUE);
|
||||
rect_dsc.bg_grad.stops[1].opa = LV_OPA_50;
|
||||
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_offset_x = 5;
|
||||
rect_dsc.shadow_offset_y = 5;
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
label_dsc.color = lv_palette_main(LV_PALETTE_ORANGE);
|
||||
label_dsc.text = "Some text on text canvas";
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf_16bpp, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_RGB565);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf_16bpp);
|
||||
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf_16bpp);
|
||||
lv_obj_center(canvas);
|
||||
lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_area_t coords_rect = {30, 20, 100, 70};
|
||||
lv_draw_rect(&layer, &rect_dsc, &coords_rect);
|
||||
|
||||
lv_area_t coords_text = {40, 80, 100, 120};
|
||||
lv_draw_label(&layer, &label_dsc, &coords_text);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
/*Test the rotation. It requires another buffer where the original image is stored.
|
||||
*So use previous canvas as image and rotate it to the new canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf_32bpp, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf_32bpp);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf_32bpp);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 1), LV_OPA_COVER);
|
||||
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
lv_image_dsc_t img;
|
||||
lv_draw_buf_to_image(&draw_buf_16bpp, &img);
|
||||
lv_draw_image_dsc_t img_dsc;
|
||||
lv_draw_image_dsc_init(&img_dsc);
|
||||
img_dsc.rotation = 120;
|
||||
img_dsc.src = &img;
|
||||
img_dsc.pivot.x = CANVAS_WIDTH / 2;
|
||||
img_dsc.pivot.y = CANVAS_HEIGHT / 2;
|
||||
|
||||
lv_area_t coords_img = {0, 0, CANVAS_WIDTH - 1, CANVAS_HEIGHT - 1};
|
||||
lv_draw_image(&layer, &img_dsc, &coords_img);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
}
|
||||
|
||||
#endif
|
||||
47
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_2.c
Normal file
47
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_2.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 80
|
||||
#define CANVAS_HEIGHT 40
|
||||
|
||||
/**
|
||||
* Create a transparent canvas with transparency
|
||||
*/
|
||||
void lv_example_canvas_2(void)
|
||||
{
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_palette_lighten(LV_PALETTE_RED, 5), 0);
|
||||
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
/*Red background (There is no dedicated alpha channel in indexed images so LV_OPA_COVER is ignored)*/
|
||||
lv_canvas_fill_bg(canvas, lv_palette_main(LV_PALETTE_BLUE), LV_OPA_COVER);
|
||||
|
||||
/*Create hole on the canvas*/
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
for(y = 10; y < 20; y++) {
|
||||
for(x = 5; x < 75; x++) {
|
||||
lv_canvas_set_px(canvas, x, y, lv_palette_main(LV_PALETTE_BLUE), LV_OPA_50);
|
||||
}
|
||||
}
|
||||
|
||||
for(y = 20; y < 30; y++) {
|
||||
for(x = 5; x < 75; x++) {
|
||||
lv_canvas_set_px(canvas, x, y, lv_palette_main(LV_PALETTE_BLUE), LV_OPA_20);
|
||||
}
|
||||
}
|
||||
|
||||
for(y = 30; y < 40; y++) {
|
||||
for(x = 5; x < 75; x++) {
|
||||
lv_canvas_set_px(canvas, x, y, lv_palette_main(LV_PALETTE_BLUE), LV_OPA_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
44
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_3.c
Normal file
44
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_3.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 50
|
||||
#define CANVAS_HEIGHT 50
|
||||
|
||||
/**
|
||||
* Draw a rectangle to the canvas
|
||||
*/
|
||||
void lv_example_canvas_3(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_draw_rect_dsc_t dsc;
|
||||
lv_draw_rect_dsc_init(&dsc);
|
||||
dsc.bg_color = lv_palette_main(LV_PALETTE_RED);
|
||||
dsc.border_color = lv_palette_main(LV_PALETTE_BLUE);
|
||||
dsc.border_width = 3;
|
||||
dsc.outline_color = lv_palette_main(LV_PALETTE_GREEN);
|
||||
dsc.outline_width = 2;
|
||||
dsc.outline_pad = 2;
|
||||
dsc.outline_opa = LV_OPA_50;
|
||||
dsc.radius = 5;
|
||||
dsc.border_width = 3;
|
||||
|
||||
lv_area_t coords = {10, 10, 40, 30};
|
||||
|
||||
lv_draw_rect(&layer, &dsc, &coords);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
}
|
||||
#endif
|
||||
39
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_4.c
Normal file
39
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_4.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_FONT_MONTSERRAT_18 && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 50
|
||||
#define CANVAS_HEIGHT 50
|
||||
|
||||
/**
|
||||
* Draw a text to the canvas
|
||||
*/
|
||||
void lv_example_canvas_4(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_draw_label_dsc_t dsc;
|
||||
lv_draw_label_dsc_init(&dsc);
|
||||
dsc.color = lv_palette_main(LV_PALETTE_RED);
|
||||
dsc.font = &lv_font_montserrat_18;
|
||||
dsc.decor = LV_TEXT_DECOR_UNDERLINE;
|
||||
dsc.text = "Hello";
|
||||
|
||||
lv_area_t coords = {10, 10, 30, 60};
|
||||
|
||||
lv_draw_label(&layer, &dsc, &coords);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
}
|
||||
#endif
|
||||
41
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_5.c
Normal file
41
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_5.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 50
|
||||
#define CANVAS_HEIGHT 50
|
||||
|
||||
/**
|
||||
* Draw an arc to the canvas
|
||||
*/
|
||||
void lv_example_canvas_5(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_draw_arc_dsc_t dsc;
|
||||
lv_draw_arc_dsc_init(&dsc);
|
||||
dsc.color = lv_palette_main(LV_PALETTE_RED);
|
||||
dsc.width = 5;
|
||||
dsc.center.x = 25;
|
||||
dsc.center.y = 25;
|
||||
dsc.width = 10;
|
||||
dsc.radius = 15;
|
||||
dsc.start_angle = 0;
|
||||
dsc.end_angle = 220;
|
||||
|
||||
lv_draw_arc(&layer, &dsc);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
}
|
||||
#endif
|
||||
35
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_6.c
Normal file
35
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_6.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 50
|
||||
#define CANVAS_HEIGHT 50
|
||||
|
||||
/**
|
||||
* Draw an image to the canvas
|
||||
*/
|
||||
void lv_example_canvas_6(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
static uint8_t cbuf[LV_CANVAS_BUF_SIZE(CANVAS_WIDTH, CANVAS_HEIGHT, 32, LV_DRAW_BUF_STRIDE_ALIGN)];
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
LV_IMAGE_DECLARE(img_star);
|
||||
lv_draw_image_dsc_t dsc;
|
||||
lv_draw_image_dsc_init(&dsc);
|
||||
dsc.src = &img_star;
|
||||
|
||||
lv_area_t coords = {10, 10, 10 + img_star.header.w - 1, 10 + img_star.header.h - 1};
|
||||
|
||||
lv_draw_image(&layer, &dsc, &coords);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
}
|
||||
#endif
|
||||
40
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_7.c
Normal file
40
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_7.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS&& LV_BUILD_EXAMPLES
|
||||
|
||||
#define CANVAS_WIDTH 50
|
||||
#define CANVAS_HEIGHT 50
|
||||
|
||||
/**
|
||||
* Draw a line to the canvas
|
||||
*/
|
||||
void lv_example_canvas_7(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_draw_line_dsc_t dsc;
|
||||
lv_draw_line_dsc_init(&dsc);
|
||||
dsc.color = lv_palette_main(LV_PALETTE_RED);
|
||||
dsc.width = 4;
|
||||
dsc.round_end = 1;
|
||||
dsc.round_start = 1;
|
||||
dsc.p1.x = 15;
|
||||
dsc.p1.y = 15;
|
||||
dsc.p2.x = 35;
|
||||
dsc.p2.y = 10;
|
||||
lv_draw_line(&layer, &dsc);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
}
|
||||
#endif
|
||||
57
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_8.c
Normal file
57
libraries/lvgl/examples/widgets/canvas/lv_example_canvas_8.c
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
||||
|
||||
#if LV_USE_VECTOR_GRAPHIC
|
||||
|
||||
#define CANVAS_WIDTH 150
|
||||
#define CANVAS_HEIGHT 150
|
||||
|
||||
/**
|
||||
* Draw a path to the canvas
|
||||
*/
|
||||
void lv_example_canvas_8(void)
|
||||
{
|
||||
/*Create a buffer for the canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_ARGB8888);
|
||||
LV_DRAW_BUF_INIT_STATIC(draw_buf);
|
||||
|
||||
/*Create a canvas and initialize its palette*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, &draw_buf);
|
||||
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
||||
lv_obj_center(canvas);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
lv_vector_dsc_t * dsc = lv_vector_dsc_create(&layer);
|
||||
lv_vector_path_t * path = lv_vector_path_create(LV_VECTOR_PATH_QUALITY_MEDIUM);
|
||||
|
||||
lv_fpoint_t pts[] = {{10, 10}, {130, 130}, {10, 130}};
|
||||
lv_vector_path_move_to(path, &pts[0]);
|
||||
lv_vector_path_line_to(path, &pts[1]);
|
||||
lv_vector_path_line_to(path, &pts[2]);
|
||||
lv_vector_path_close(path);
|
||||
|
||||
lv_vector_dsc_set_fill_color(dsc, lv_color_make(0x00, 0x80, 0xff));
|
||||
lv_vector_dsc_add_path(dsc, path);
|
||||
|
||||
lv_draw_vector(dsc);
|
||||
lv_vector_path_delete(path);
|
||||
lv_vector_dsc_delete(dsc);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
}
|
||||
#else
|
||||
|
||||
void lv_example_canvas_8(void)
|
||||
{
|
||||
/*fallback for online examples*/
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Vector graphics is not enabled");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_VECTOR_GRAPHIC*/
|
||||
|
||||
#endif
|
||||
49
libraries/lvgl/examples/widgets/chart/index.rst
Normal file
49
libraries/lvgl/examples/widgets/chart/index.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
Line Chart
|
||||
----------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_1
|
||||
:language: c
|
||||
|
||||
|
||||
Axis ticks and labels with scrolling
|
||||
------------------------------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_2
|
||||
:language: c
|
||||
|
||||
Show the value of the pressed points
|
||||
------------------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_3
|
||||
:language: c
|
||||
|
||||
Recolor bars based on their value
|
||||
------------------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_4
|
||||
:language: c
|
||||
|
||||
Faded area line chart with custom division lines
|
||||
---------------------------------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_5
|
||||
:language: c
|
||||
|
||||
Show cursor on the clicked point
|
||||
--------------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_6
|
||||
:language: c
|
||||
|
||||
Scatter chart
|
||||
-------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_7
|
||||
:language: c
|
||||
|
||||
Circular line chart with gap
|
||||
----------------------------
|
||||
|
||||
.. lv_example:: widgets/chart/lv_example_chart_8
|
||||
:language: c
|
||||
33
libraries/lvgl/examples/widgets/chart/lv_example_chart_1.c
Normal file
33
libraries/lvgl/examples/widgets/chart/lv_example_chart_1.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* A very basic line chart
|
||||
*/
|
||||
void lv_example_chart_1(void)
|
||||
{
|
||||
/*Create a chart*/
|
||||
lv_obj_t * chart;
|
||||
chart = lv_chart_create(lv_screen_active());
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_center(chart);
|
||||
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_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_PRIMARY_Y);
|
||||
lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_SECONDARY_Y);
|
||||
int32_t * ser2_y_points = lv_chart_get_y_array(chart, ser2);
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
/*Set the next points on 'ser1'*/
|
||||
lv_chart_set_next_value(chart, ser1, lv_rand(10, 50));
|
||||
|
||||
/*Directly set points on 'ser2'*/
|
||||
ser2_y_points[i] = lv_rand(50, 90);
|
||||
}
|
||||
|
||||
lv_chart_refresh(chart); /*Required after direct set*/
|
||||
}
|
||||
|
||||
#endif
|
||||
56
libraries/lvgl/examples/widgets/chart/lv_example_chart_2.c
Normal file
56
libraries/lvgl/examples/widgets/chart/lv_example_chart_2.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Use lv_scale to add ticks to a scrollable chart
|
||||
*/
|
||||
void lv_example_chart_2(void)
|
||||
{
|
||||
/*Create a container*/
|
||||
lv_obj_t * main_cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(main_cont, 200, 150);
|
||||
lv_obj_center(main_cont);
|
||||
|
||||
/*Create a transparent wrapper for the chart and the scale.
|
||||
*Set a large width, to make it scrollable on the main container*/
|
||||
lv_obj_t * wrapper = lv_obj_create(main_cont);
|
||||
lv_obj_remove_style_all(wrapper);
|
||||
lv_obj_set_size(wrapper, lv_pct(300), lv_pct(100));
|
||||
lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
/*Create a chart on the wrapper
|
||||
*Set it's width to 100% to fill the large wrapper*/
|
||||
lv_obj_t * chart = lv_chart_create(wrapper);
|
||||
lv_obj_set_width(chart, lv_pct(100));
|
||||
lv_obj_set_flex_grow(chart, 1);
|
||||
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_set_style_radius(chart, 0, 0);
|
||||
|
||||
/*Create a scale also with 100% width*/
|
||||
lv_obj_t * scale_bottom = lv_scale_create(wrapper);
|
||||
lv_scale_set_mode(scale_bottom, LV_SCALE_MODE_HORIZONTAL_BOTTOM);
|
||||
lv_obj_set_size(scale_bottom, lv_pct(100), 25);
|
||||
lv_scale_set_total_tick_count(scale_bottom, 12);
|
||||
lv_scale_set_major_tick_every(scale_bottom, 1);
|
||||
lv_obj_set_style_pad_hor(scale_bottom, lv_chart_get_first_point_center_offset(chart), 0);
|
||||
|
||||
static const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec", NULL};
|
||||
lv_scale_set_text_src(scale_bottom, month);
|
||||
|
||||
/*Add two data series*/
|
||||
lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_lighten(LV_PALETTE_GREEN, 2), LV_CHART_AXIS_PRIMARY_Y);
|
||||
lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_darken(LV_PALETTE_GREEN, 2), LV_CHART_AXIS_PRIMARY_Y);
|
||||
|
||||
/*Set the next points on 'ser1'*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < 12; i++) {
|
||||
lv_chart_set_next_value(chart, ser1, lv_rand(10, 60));
|
||||
lv_chart_set_next_value(chart, ser2, lv_rand(50, 90));
|
||||
}
|
||||
lv_chart_refresh(chart); /*Required after direct set*/
|
||||
}
|
||||
|
||||
#endif
|
||||
87
libraries/lvgl/examples/widgets/chart/lv_example_chart_3.c
Normal file
87
libraries/lvgl/examples/widgets/chart/lv_example_chart_3.c
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * chart = lv_event_get_target(e);
|
||||
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
int32_t * s = lv_event_get_param(e);
|
||||
*s = LV_MAX(*s, 20);
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_POST_END) {
|
||||
int32_t id = lv_chart_get_pressed_point(chart);
|
||||
if(id == LV_CHART_POINT_NONE) return;
|
||||
|
||||
LV_LOG_USER("Selected point %d", (int)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);
|
||||
|
||||
int32_t * y_array = lv_chart_get_y_array(chart, ser);
|
||||
int32_t value = y_array[id];
|
||||
|
||||
char buf[16];
|
||||
lv_snprintf(buf, sizeof(buf), LV_SYMBOL_DUMMY"$%d", value);
|
||||
|
||||
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.bg_image_src = buf;
|
||||
draw_rect_dsc.bg_image_recolor = lv_color_white();
|
||||
|
||||
lv_area_t chart_obj_coords;
|
||||
lv_obj_get_coords(chart, &chart_obj_coords);
|
||||
lv_area_t a;
|
||||
a.x1 = chart_obj_coords.x1 + p.x - 20;
|
||||
a.x2 = chart_obj_coords.x1 + p.x + 20;
|
||||
a.y1 = chart_obj_coords.y1 + p.y - 30;
|
||||
a.y2 = chart_obj_coords.y1 + p.y - 10;
|
||||
|
||||
lv_layer_t * layer = lv_event_get_layer(e);
|
||||
lv_draw_rect(layer, &draw_rect_dsc, &a);
|
||||
|
||||
ser = lv_chart_get_series_next(chart, ser);
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_RELEASED) {
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the value of the pressed points
|
||||
*/
|
||||
void lv_example_chart_3(void)
|
||||
{
|
||||
/*Create a chart*/
|
||||
lv_obj_t * chart;
|
||||
chart = lv_chart_create(lv_screen_active());
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_center(chart);
|
||||
|
||||
lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL);
|
||||
lv_obj_refresh_ext_draw_size(chart);
|
||||
|
||||
/*Zoom in a little in X*/
|
||||
// lv_chart_set_scale_x(chart, 800);
|
||||
|
||||
/*Add two data series*/
|
||||
lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_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
|
||||
48
libraries/lvgl/examples/widgets/chart/lv_example_chart_4.c
Normal file
48
libraries/lvgl/examples/widgets/chart/lv_example_chart_4.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_CHART && LV_DRAW_SW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void draw_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
|
||||
if(base_dsc->part != LV_PART_ITEMS) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_draw_fill_dsc_t * fill_dsc = lv_draw_task_get_fill_dsc(draw_task);
|
||||
if(fill_dsc) {
|
||||
lv_obj_t * chart = lv_event_get_target(e);
|
||||
int32_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
|
||||
int32_t v = y_array[base_dsc->id2];
|
||||
|
||||
uint32_t ratio = v * 255 / 100;
|
||||
fill_dsc->color = lv_color_mix(lv_palette_main(LV_PALETTE_GREEN), lv_palette_main(LV_PALETTE_RED), ratio);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recolor the bars of a chart based on their value
|
||||
*/
|
||||
void lv_example_chart_4(void)
|
||||
{
|
||||
/*Create a chart1*/
|
||||
lv_obj_t * chart = lv_chart_create(lv_screen_active());
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_BAR);
|
||||
lv_chart_set_point_count(chart, 24);
|
||||
lv_obj_set_style_pad_column(chart, 2, 0);
|
||||
lv_obj_set_size(chart, 260, 160);
|
||||
lv_obj_center(chart);
|
||||
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_hex(0xff0000), LV_CHART_AXIS_PRIMARY_Y);
|
||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < 24; i++) {
|
||||
lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
148
libraries/lvgl/examples/widgets/chart/lv_example_chart_5.c
Normal file
148
libraries/lvgl/examples/widgets/chart/lv_example_chart_5.c
Normal file
@@ -0,0 +1,148 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_CHART && LV_DRAW_SW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void hook_division_lines(lv_event_t * e);
|
||||
static void add_faded_area(lv_event_t * e);
|
||||
static void draw_event_cb(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Add a faded area effect to the line chart and make some division lines ticker
|
||||
*/
|
||||
void lv_example_chart_5(void)
|
||||
{
|
||||
/*Create a chart*/
|
||||
lv_obj_t * chart = lv_chart_create(lv_screen_active());
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_set_style_pad_all(chart, 0, 0);
|
||||
lv_obj_set_style_radius(chart, 0, 0);
|
||||
lv_obj_center(chart);
|
||||
|
||||
lv_chart_set_div_line_count(chart, 5, 7);
|
||||
|
||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
||||
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
lv_chart_set_next_value(chart, ser, lv_rand(10, 80));
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
|
||||
if(base_dsc->part == LV_PART_ITEMS && lv_draw_task_get_type(draw_task) == LV_DRAW_TASK_TYPE_LINE) {
|
||||
add_faded_area(e);
|
||||
|
||||
}
|
||||
/*Hook the division lines too*/
|
||||
if(base_dsc->part == LV_PART_MAIN && lv_draw_task_get_type(draw_task) == LV_DRAW_TASK_TYPE_LINE) {
|
||||
hook_division_lines(e);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_faded_area(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_area_t coords;
|
||||
lv_obj_get_coords(obj, &coords);
|
||||
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
|
||||
const lv_chart_series_t * ser = lv_chart_get_series_next(obj, NULL);
|
||||
lv_color_t ser_color = lv_chart_get_series_color(obj, ser);
|
||||
|
||||
/*Draw a triangle below the line witch some opacity gradient*/
|
||||
lv_draw_line_dsc_t * draw_line_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
lv_draw_triangle_dsc_t tri_dsc;
|
||||
|
||||
lv_draw_triangle_dsc_init(&tri_dsc);
|
||||
tri_dsc.p[0].x = draw_line_dsc->p1.x;
|
||||
tri_dsc.p[0].y = draw_line_dsc->p1.y;
|
||||
tri_dsc.p[1].x = draw_line_dsc->p2.x;
|
||||
tri_dsc.p[1].y = draw_line_dsc->p2.y;
|
||||
tri_dsc.p[2].x = draw_line_dsc->p1.y < draw_line_dsc->p2.y ? draw_line_dsc->p1.x : draw_line_dsc->p2.x;
|
||||
tri_dsc.p[2].y = LV_MAX(draw_line_dsc->p1.y, draw_line_dsc->p2.y);
|
||||
tri_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
|
||||
|
||||
int32_t full_h = lv_obj_get_height(obj);
|
||||
int32_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1.y, draw_line_dsc->p2.y) - coords.y1) * 255 / full_h;
|
||||
int32_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1.y, draw_line_dsc->p2.y) - coords.y1) * 255 / full_h;
|
||||
tri_dsc.bg_grad.stops[0].color = ser_color;
|
||||
tri_dsc.bg_grad.stops[0].opa = 255 - fract_uppter;
|
||||
tri_dsc.bg_grad.stops[0].frac = 0;
|
||||
tri_dsc.bg_grad.stops[1].color = ser_color;
|
||||
tri_dsc.bg_grad.stops[1].opa = 255 - fract_lower;
|
||||
tri_dsc.bg_grad.stops[1].frac = 255;
|
||||
|
||||
lv_draw_triangle(base_dsc->layer, &tri_dsc);
|
||||
|
||||
/*Draw rectangle below the triangle*/
|
||||
lv_draw_rect_dsc_t rect_dsc;
|
||||
lv_draw_rect_dsc_init(&rect_dsc);
|
||||
rect_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
|
||||
rect_dsc.bg_grad.stops[0].color = ser_color;
|
||||
rect_dsc.bg_grad.stops[0].frac = 0;
|
||||
rect_dsc.bg_grad.stops[0].opa = 255 - fract_lower;
|
||||
rect_dsc.bg_grad.stops[1].color = ser_color;
|
||||
rect_dsc.bg_grad.stops[1].frac = 255;
|
||||
rect_dsc.bg_grad.stops[1].opa = 0;
|
||||
|
||||
lv_area_t rect_area;
|
||||
rect_area.x1 = (int32_t)draw_line_dsc->p1.x;
|
||||
rect_area.x2 = (int32_t)draw_line_dsc->p2.x - 1;
|
||||
rect_area.y1 = (int32_t)LV_MAX(draw_line_dsc->p1.y, draw_line_dsc->p2.y) - 1;
|
||||
rect_area.y2 = (int32_t)coords.y2;
|
||||
lv_draw_rect(base_dsc->layer, &rect_dsc, &rect_area);
|
||||
}
|
||||
|
||||
static void hook_division_lines(lv_event_t * e)
|
||||
{
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
lv_draw_line_dsc_t * line_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
|
||||
/*Vertical line*/
|
||||
if(line_dsc->p1.x == line_dsc->p2.x) {
|
||||
line_dsc->color = lv_palette_lighten(LV_PALETTE_GREY, 1);
|
||||
if(base_dsc->id1 == 3) {
|
||||
line_dsc->width = 2;
|
||||
line_dsc->dash_gap = 0;
|
||||
line_dsc->dash_width = 0;
|
||||
}
|
||||
else {
|
||||
line_dsc->width = 1;
|
||||
line_dsc->dash_gap = 6;
|
||||
line_dsc->dash_width = 6;
|
||||
}
|
||||
}
|
||||
/*Horizontal line*/
|
||||
else {
|
||||
if(base_dsc->id1 == 2) {
|
||||
line_dsc->width = 2;
|
||||
line_dsc->dash_gap = 0;
|
||||
line_dsc->dash_width = 0;
|
||||
}
|
||||
else {
|
||||
line_dsc->width = 2;
|
||||
line_dsc->dash_gap = 6;
|
||||
line_dsc->dash_width = 6;
|
||||
}
|
||||
|
||||
if(base_dsc->id1 == 1 || base_dsc->id1 == 3) {
|
||||
line_dsc->color = lv_palette_main(LV_PALETTE_GREEN);
|
||||
}
|
||||
else {
|
||||
line_dsc->color = lv_palette_lighten(LV_PALETTE_GREY, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
49
libraries/lvgl/examples/widgets/chart/lv_example_chart_6.c
Normal file
49
libraries/lvgl/examples/widgets/chart/lv_example_chart_6.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * chart;
|
||||
static lv_chart_series_t * ser;
|
||||
static lv_chart_cursor_t * cursor;
|
||||
|
||||
static void value_changed_event_cb(lv_event_t * e)
|
||||
{
|
||||
static int32_t last_id = -1;
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
|
||||
last_id = lv_chart_get_pressed_point(obj);
|
||||
if(last_id != LV_CHART_POINT_NONE) {
|
||||
lv_chart_set_cursor_point(obj, cursor, NULL, last_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show cursor on the clicked point
|
||||
*/
|
||||
void lv_example_chart_6(void)
|
||||
{
|
||||
chart = lv_chart_create(lv_screen_active());
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_align(chart, LV_ALIGN_CENTER, 0, -10);
|
||||
|
||||
// lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 5, true, 40);
|
||||
// lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_X, 10, 5, 10, 1, true, 30);
|
||||
|
||||
lv_obj_add_event_cb(chart, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
lv_obj_refresh_ext_draw_size(chart);
|
||||
|
||||
cursor = lv_chart_add_cursor(chart, lv_palette_main(LV_PALETTE_BLUE), LV_DIR_LEFT | LV_DIR_BOTTOM);
|
||||
|
||||
ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
uint32_t i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
|
||||
}
|
||||
|
||||
// lv_chart_set_scale_x(chart, 500);
|
||||
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Click on a point");
|
||||
lv_obj_align_to(label, chart, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
}
|
||||
|
||||
#endif
|
||||
66
libraries/lvgl/examples/widgets/chart/lv_example_chart_7.c
Normal file
66
libraries/lvgl/examples/widgets/chart/lv_example_chart_7.c
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_BUILD_EXAMPLES
|
||||
|
||||
static void draw_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
|
||||
lv_draw_dsc_base_t * base_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
if(base_dsc->part == LV_PART_INDICATOR) {
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_chart_series_t * ser = lv_chart_get_series_next(obj, NULL);
|
||||
lv_draw_rect_dsc_t * rect_draw_dsc = lv_draw_task_get_draw_dsc(draw_task);
|
||||
uint32_t cnt = lv_chart_get_point_count(obj);
|
||||
|
||||
/*Make older value more transparent*/
|
||||
rect_draw_dsc->bg_opa = (LV_OPA_COVER * base_dsc->id2) / (cnt - 1);
|
||||
|
||||
/*Make smaller values blue, higher values red*/
|
||||
int32_t * x_array = lv_chart_get_x_array(obj, ser);
|
||||
int32_t * y_array = lv_chart_get_y_array(obj, ser);
|
||||
/*dsc->id is the tells drawing order, but we need the ID of the point being drawn.*/
|
||||
uint32_t start_point = lv_chart_get_x_start_point(obj, ser);
|
||||
uint32_t p_act = (start_point + base_dsc->id2) % cnt; /*Consider start point to get the index of the array*/
|
||||
lv_opa_t x_opa = (x_array[p_act] * LV_OPA_50) / 200;
|
||||
lv_opa_t y_opa = (y_array[p_act] * LV_OPA_50) / 1000;
|
||||
|
||||
rect_draw_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_RED),
|
||||
lv_palette_main(LV_PALETTE_BLUE),
|
||||
x_opa + y_opa);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_data(lv_timer_t * timer)
|
||||
{
|
||||
lv_obj_t * chart = lv_timer_get_user_data(timer);
|
||||
lv_chart_set_next_value2(chart, lv_chart_get_series_next(chart, NULL), lv_rand(0, 200), lv_rand(0, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* A scatter chart
|
||||
*/
|
||||
void lv_example_chart_7(void)
|
||||
{
|
||||
lv_obj_t * chart = lv_chart_create(lv_screen_active());
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_align(chart, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
||||
lv_obj_set_style_line_width(chart, 0, LV_PART_ITEMS); /*Remove the lines*/
|
||||
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_SCATTER);
|
||||
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_X, 0, 200);
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 1000);
|
||||
|
||||
lv_chart_set_point_count(chart, 50);
|
||||
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
uint32_t i;
|
||||
for(i = 0; i < 50; i++) {
|
||||
lv_chart_set_next_value2(chart, ser, lv_rand(0, 200), lv_rand(0, 1000));
|
||||
}
|
||||
|
||||
lv_timer_create(add_data, 100, chart);
|
||||
}
|
||||
|
||||
#endif
|
||||
46
libraries/lvgl/examples/widgets/chart/lv_example_chart_8.c
Normal file
46
libraries/lvgl/examples/widgets/chart/lv_example_chart_8.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_DRAW_SW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void add_data(lv_timer_t * t)
|
||||
{
|
||||
lv_obj_t * chart = lv_timer_get_user_data(t);
|
||||
lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL);
|
||||
|
||||
lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
|
||||
|
||||
uint16_t p = lv_chart_get_point_count(chart);
|
||||
uint16_t s = lv_chart_get_x_start_point(chart, ser);
|
||||
int32_t * a = lv_chart_get_y_array(chart, ser);
|
||||
|
||||
a[(s + 1) % p] = LV_CHART_POINT_NONE;
|
||||
a[(s + 2) % p] = LV_CHART_POINT_NONE;
|
||||
a[(s + 2) % p] = LV_CHART_POINT_NONE;
|
||||
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Circular line chart with gap
|
||||
*/
|
||||
void lv_example_chart_8(void)
|
||||
{
|
||||
/*Create a stacked_area_chart.obj*/
|
||||
lv_obj_t * chart = lv_chart_create(lv_screen_active());
|
||||
lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_CIRCULAR);
|
||||
lv_obj_set_style_size(chart, 0, 0, LV_PART_INDICATOR);
|
||||
lv_obj_set_size(chart, 280, 150);
|
||||
lv_obj_center(chart);
|
||||
|
||||
lv_chart_set_point_count(chart, 80);
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
/*Prefill with data*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < 80; i++) {
|
||||
lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
|
||||
}
|
||||
|
||||
lv_timer_create(add_data, 300, chart);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
12
libraries/lvgl/examples/widgets/checkbox/index.rst
Normal file
12
libraries/lvgl/examples/widgets/checkbox/index.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
Simple Checkboxes
|
||||
-----------------
|
||||
|
||||
.. lv_example:: widgets/checkbox/lv_example_checkbox_1
|
||||
:language: c
|
||||
|
||||
Checkboxes as radio buttons
|
||||
---------------------------
|
||||
.. lv_example:: widgets/checkbox/lv_example_checkbox_2
|
||||
:language: c
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
LV_UNUSED(obj);
|
||||
const char * txt = lv_checkbox_get_text(obj);
|
||||
const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked";
|
||||
LV_UNUSED(txt);
|
||||
LV_UNUSED(state);
|
||||
LV_LOG_USER("%s: %s", txt, state);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_checkbox_1(void)
|
||||
{
|
||||
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * cb;
|
||||
cb = lv_checkbox_create(lv_screen_active());
|
||||
lv_checkbox_set_text(cb, "Apple");
|
||||
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
|
||||
|
||||
cb = lv_checkbox_create(lv_screen_active());
|
||||
lv_checkbox_set_text(cb, "Banana");
|
||||
lv_obj_add_state(cb, LV_STATE_CHECKED);
|
||||
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
|
||||
|
||||
cb = lv_checkbox_create(lv_screen_active());
|
||||
lv_checkbox_set_text(cb, "Lemon");
|
||||
lv_obj_add_state(cb, LV_STATE_DISABLED);
|
||||
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
|
||||
|
||||
cb = lv_checkbox_create(lv_screen_active());
|
||||
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
lv_checkbox_set_text(cb, "Melon\nand a new line");
|
||||
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
|
||||
|
||||
lv_obj_update_layout(cb);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_style_t style_radio;
|
||||
static lv_style_t style_radio_chk;
|
||||
static uint32_t active_index_1 = 0;
|
||||
static uint32_t active_index_2 = 0;
|
||||
|
||||
static void radio_event_handler(lv_event_t * e)
|
||||
{
|
||||
uint32_t * active_id = lv_event_get_user_data(e);
|
||||
lv_obj_t * cont = lv_event_get_current_target(e);
|
||||
lv_obj_t * act_cb = lv_event_get_target(e);
|
||||
lv_obj_t * old_cb = lv_obj_get_child(cont, *active_id);
|
||||
|
||||
/*Do nothing if the container was clicked*/
|
||||
if(act_cb == cont) return;
|
||||
|
||||
lv_obj_remove_state(old_cb, LV_STATE_CHECKED); /*Uncheck the previous radio button*/
|
||||
lv_obj_add_state(act_cb, LV_STATE_CHECKED); /*Uncheck the current radio button*/
|
||||
|
||||
*active_id = lv_obj_get_index(act_cb);
|
||||
|
||||
LV_LOG_USER("Selected radio buttons: %d, %d", (int)active_index_1, (int)active_index_2);
|
||||
}
|
||||
|
||||
static void radiobutton_create(lv_obj_t * parent, const char * txt)
|
||||
{
|
||||
lv_obj_t * obj = lv_checkbox_create(parent);
|
||||
lv_checkbox_set_text(obj, txt);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||
lv_obj_add_style(obj, &style_radio, LV_PART_INDICATOR);
|
||||
lv_obj_add_style(obj, &style_radio_chk, LV_PART_INDICATOR | LV_STATE_CHECKED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkboxes as radio buttons
|
||||
*/
|
||||
void lv_example_checkbox_2(void)
|
||||
{
|
||||
/* The idea is to enable `LV_OBJ_FLAG_EVENT_BUBBLE` on checkboxes and process the
|
||||
* `LV_EVENT_CLICKED` on the container.
|
||||
* A variable is passed as event user data where the index of the active
|
||||
* radiobutton is saved */
|
||||
|
||||
lv_style_init(&style_radio);
|
||||
lv_style_set_radius(&style_radio, LV_RADIUS_CIRCLE);
|
||||
|
||||
lv_style_init(&style_radio_chk);
|
||||
lv_style_set_bg_image_src(&style_radio_chk, NULL);
|
||||
|
||||
uint32_t i;
|
||||
char buf[32];
|
||||
|
||||
lv_obj_t * cont1 = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_flex_flow(cont1, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_size(cont1, lv_pct(40), lv_pct(80));
|
||||
lv_obj_add_event_cb(cont1, radio_event_handler, LV_EVENT_CLICKED, &active_index_1);
|
||||
|
||||
for(i = 0; i < 5; i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "A %d", (int)i + 1);
|
||||
radiobutton_create(cont1, buf);
|
||||
|
||||
}
|
||||
/*Make the first checkbox checked*/
|
||||
lv_obj_add_state(lv_obj_get_child(cont1, 0), LV_STATE_CHECKED);
|
||||
|
||||
lv_obj_t * cont2 = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_flex_flow(cont2, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_size(cont2, lv_pct(40), lv_pct(80));
|
||||
lv_obj_set_x(cont2, lv_pct(50));
|
||||
lv_obj_add_event_cb(cont2, radio_event_handler, LV_EVENT_CLICKED, &active_index_2);
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "B %d", (int)i + 1);
|
||||
radiobutton_create(cont2, buf);
|
||||
}
|
||||
|
||||
/*Make the first checkbox checked*/
|
||||
lv_obj_add_state(lv_obj_get_child(cont2, 0), LV_STATE_CHECKED);
|
||||
}
|
||||
|
||||
#endif
|
||||
20
libraries/lvgl/examples/widgets/dropdown/index.rst
Normal file
20
libraries/lvgl/examples/widgets/dropdown/index.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Simple Drop down list
|
||||
---------------------
|
||||
|
||||
.. lv_example:: widgets/dropdown/lv_example_dropdown_1
|
||||
:language: c
|
||||
|
||||
Drop down in four directions
|
||||
----------------------------
|
||||
|
||||
.. lv_example:: widgets/dropdown/lv_example_dropdown_2
|
||||
:language: c
|
||||
|
||||
|
||||
Menu
|
||||
----
|
||||
|
||||
.. lv_example:: widgets/dropdown/lv_example_dropdown_3
|
||||
:language: c
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
char buf[32];
|
||||
lv_dropdown_get_selected_str(obj, buf, sizeof(buf));
|
||||
LV_LOG_USER("Option: %s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_dropdown_1(void)
|
||||
{
|
||||
|
||||
/*Create a normal drop down list*/
|
||||
lv_obj_t * dd = lv_dropdown_create(lv_screen_active());
|
||||
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, LV_ALIGN_TOP_MID, 0, 20);
|
||||
lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Create a drop down, up, left and right menus
|
||||
*/
|
||||
void lv_example_dropdown_2(void)
|
||||
{
|
||||
static const char * opts = "Apple\n"
|
||||
"Banana\n"
|
||||
"Orange\n"
|
||||
"Melon";
|
||||
|
||||
lv_obj_t * dd;
|
||||
dd = lv_dropdown_create(lv_screen_active());
|
||||
lv_dropdown_set_options_static(dd, opts);
|
||||
lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 10);
|
||||
|
||||
dd = lv_dropdown_create(lv_screen_active());
|
||||
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, LV_ALIGN_BOTTOM_MID, 0, -10);
|
||||
|
||||
dd = lv_dropdown_create(lv_screen_active());
|
||||
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, LV_ALIGN_LEFT_MID, 10, 0);
|
||||
|
||||
dd = lv_dropdown_create(lv_screen_active());
|
||||
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, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * dropdown = lv_event_get_target(e);
|
||||
char buf[64];
|
||||
lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf));
|
||||
LV_LOG_USER("'%s' is selected", buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a menu from a drop-down list and show some drop-down list features and styling
|
||||
*/
|
||||
void lv_example_dropdown_3(void)
|
||||
{
|
||||
/*Create a drop down list*/
|
||||
lv_obj_t * dropdown = lv_dropdown_create(lv_screen_active());
|
||||
lv_obj_align(dropdown, LV_ALIGN_TOP_LEFT, 10, 10);
|
||||
lv_dropdown_set_options(dropdown, "New project\n"
|
||||
"New file\n"
|
||||
"Save\n"
|
||||
"Save as ...\n"
|
||||
"Open project\n"
|
||||
"Recent projects\n"
|
||||
"Preferences\n"
|
||||
"Exit");
|
||||
|
||||
/*Set a fixed text to display on the button of the drop-down list*/
|
||||
lv_dropdown_set_text(dropdown, "Menu");
|
||||
|
||||
/*Use a custom image as down icon and flip it when the list is opened*/
|
||||
LV_IMAGE_DECLARE(img_caret_down);
|
||||
lv_dropdown_set_symbol(dropdown, &img_caret_down);
|
||||
lv_obj_set_style_transform_rotation(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);
|
||||
|
||||
/*In a menu we don't need to show the last clicked item*/
|
||||
lv_dropdown_set_selected_highlight(dropdown, false);
|
||||
|
||||
lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
28
libraries/lvgl/examples/widgets/image/index.rst
Normal file
28
libraries/lvgl/examples/widgets/image/index.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Image from variable and symbol
|
||||
------------------------------
|
||||
|
||||
.. lv_example:: widgets/image/lv_example_image_1
|
||||
:language: c
|
||||
|
||||
|
||||
Image recoloring
|
||||
----------------
|
||||
|
||||
.. lv_example:: widgets/image/lv_example_image_2
|
||||
:language: c
|
||||
|
||||
|
||||
Rotate and zoom
|
||||
---------------
|
||||
|
||||
.. lv_example:: widgets/image/lv_example_image_3
|
||||
:language: c
|
||||
|
||||
Image offset and styling
|
||||
------------------------
|
||||
|
||||
.. lv_example:: widgets/image/lv_example_image_4
|
||||
:language: c
|
||||
|
||||
|
||||
16
libraries/lvgl/examples/widgets/image/lv_example_image_1.c
Normal file
16
libraries/lvgl/examples/widgets/image/lv_example_image_1.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_image_1(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_cogwheel_argb);
|
||||
lv_obj_t * img1 = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img1, &img_cogwheel_argb);
|
||||
lv_obj_align(img1, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
lv_obj_t * img2 = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img2, LV_SYMBOL_OK "Accept");
|
||||
lv_obj_align_to(img2, img1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
|
||||
}
|
||||
|
||||
#endif
|
||||
63
libraries/lvgl/examples/widgets/image/lv_example_image_2.c
Normal file
63
libraries/lvgl/examples/widgets/image/lv_example_image_2.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGE && LV_USE_SLIDER && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * create_slider(lv_color_t color);
|
||||
static void slider_event_cb(lv_event_t * e);
|
||||
|
||||
static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider;
|
||||
static lv_obj_t * img1;
|
||||
|
||||
/**
|
||||
* Demonstrate runtime image re-coloring
|
||||
*/
|
||||
void lv_example_image_2(void)
|
||||
{
|
||||
/*Create 4 sliders to adjust RGB color and re-color intensity*/
|
||||
red_slider = create_slider(lv_palette_main(LV_PALETTE_RED));
|
||||
green_slider = create_slider(lv_palette_main(LV_PALETTE_GREEN));
|
||||
blue_slider = create_slider(lv_palette_main(LV_PALETTE_BLUE));
|
||||
intense_slider = create_slider(lv_palette_main(LV_PALETTE_GREY));
|
||||
|
||||
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, LV_ALIGN_LEFT_MID, 25, 0);
|
||||
lv_obj_align_to(green_slider, red_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
lv_obj_align_to(blue_slider, green_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
lv_obj_align_to(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
|
||||
/*Now create the actual image*/
|
||||
LV_IMAGE_DECLARE(img_cogwheel_argb);
|
||||
img1 = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img1, &img_cogwheel_argb);
|
||||
lv_obj_align(img1, LV_ALIGN_RIGHT_MID, -20, 0);
|
||||
|
||||
lv_obj_send_event(intense_slider, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
}
|
||||
|
||||
static void slider_event_cb(lv_event_t * e)
|
||||
{
|
||||
LV_UNUSED(e);
|
||||
|
||||
/*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_image_recolor_opa(img1, intense, 0);
|
||||
lv_obj_set_style_image_recolor(img1, color, 0);
|
||||
}
|
||||
|
||||
static lv_obj_t * create_slider(lv_color_t color)
|
||||
{
|
||||
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
||||
lv_slider_set_range(slider, 0, 255);
|
||||
lv_obj_set_size(slider, 10, 200);
|
||||
lv_obj_set_style_bg_color(slider, color, LV_PART_KNOB);
|
||||
lv_obj_set_style_bg_color(slider, lv_color_darken(color, LV_OPA_40), LV_PART_INDICATOR);
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
return slider;
|
||||
}
|
||||
|
||||
#endif
|
||||
42
libraries/lvgl/examples/widgets/image/lv_example_image_3.c
Normal file
42
libraries/lvgl/examples/widgets/image/lv_example_image_3.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
|
||||
|
||||
static void set_angle(void * img, int32_t v)
|
||||
{
|
||||
lv_image_set_rotation(img, v);
|
||||
}
|
||||
|
||||
static void set_scale(void * img, int32_t v)
|
||||
{
|
||||
lv_image_set_scale(img, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show transformations (zoom and rotation) using a pivot point.
|
||||
*/
|
||||
void lv_example_image_3(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_cogwheel_argb);
|
||||
|
||||
/*Now create the actual image*/
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img, &img_cogwheel_argb);
|
||||
lv_obj_align(img, LV_ALIGN_CENTER, 50, 50);
|
||||
lv_image_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, set_angle);
|
||||
lv_anim_set_values(&a, 0, 3600);
|
||||
lv_anim_set_duration(&a, 5000);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_anim_set_exec_cb(&a, set_scale);
|
||||
lv_anim_set_values(&a, 128, 256);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
#endif
|
||||
41
libraries/lvgl/examples/widgets/image/lv_example_image_4.c
Normal file
41
libraries/lvgl/examples/widgets/image/lv_example_image_4.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
|
||||
|
||||
static void ofs_y_anim(void * img, int32_t v)
|
||||
{
|
||||
lv_image_set_offset_y(img, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Image styling and offset
|
||||
*/
|
||||
void lv_example_image_4(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_skew_strip);
|
||||
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_YELLOW));
|
||||
lv_style_set_bg_opa(&style, LV_OPA_COVER);
|
||||
lv_style_set_image_recolor_opa(&style, LV_OPA_COVER);
|
||||
lv_style_set_image_recolor(&style, lv_color_black());
|
||||
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
lv_obj_add_style(img, &style, 0);
|
||||
lv_image_set_src(img, &img_skew_strip);
|
||||
lv_obj_set_size(img, 150, 100);
|
||||
lv_obj_center(img);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, img);
|
||||
lv_anim_set_exec_cb(&a, ofs_y_anim);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 500);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
7
libraries/lvgl/examples/widgets/imagebutton/index.rst
Normal file
7
libraries/lvgl/examples/widgets/imagebutton/index.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
Simple Image button
|
||||
-------------------
|
||||
|
||||
.. lv_example:: widgets/imagebutton/lv_example_imagebutton_1
|
||||
:language: c
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGEBUTTON && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_imagebutton_1(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(imagebutton_left);
|
||||
LV_IMAGE_DECLARE(imagebutton_right);
|
||||
LV_IMAGE_DECLARE(imagebutton_mid);
|
||||
|
||||
/*Create a transition animation on width transformation and recolor.*/
|
||||
static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMAGE_RECOLOR_OPA, 0};
|
||||
static lv_style_transition_dsc_t tr;
|
||||
lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 200, 0, NULL);
|
||||
|
||||
static lv_style_t style_def;
|
||||
lv_style_init(&style_def);
|
||||
lv_style_set_text_color(&style_def, lv_color_white());
|
||||
lv_style_set_transition(&style_def, &tr);
|
||||
|
||||
/*Darken the button when pressed and make it wider*/
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
lv_style_set_image_recolor_opa(&style_pr, LV_OPA_30);
|
||||
lv_style_set_image_recolor(&style_pr, lv_color_black());
|
||||
lv_style_set_transform_width(&style_pr, 20);
|
||||
|
||||
/*Create an image button*/
|
||||
lv_obj_t * imagebutton1 = lv_imagebutton_create(lv_screen_active());
|
||||
lv_imagebutton_set_src(imagebutton1, LV_IMAGEBUTTON_STATE_RELEASED, &imagebutton_left, &imagebutton_mid,
|
||||
&imagebutton_right);
|
||||
lv_obj_add_style(imagebutton1, &style_def, 0);
|
||||
lv_obj_add_style(imagebutton1, &style_pr, LV_STATE_PRESSED);
|
||||
|
||||
lv_obj_set_width(imagebutton1, 100);
|
||||
lv_obj_align(imagebutton1, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/*Create a label on the image button*/
|
||||
lv_obj_t * label = lv_label_create(imagebutton1);
|
||||
lv_label_set_text(label, "Button");
|
||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, -4);
|
||||
}
|
||||
|
||||
#endif
|
||||
14
libraries/lvgl/examples/widgets/keyboard/index.rst
Normal file
14
libraries/lvgl/examples/widgets/keyboard/index.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
Keyboard with text area
|
||||
-----------------------
|
||||
|
||||
.. lv_example:: widgets/keyboard/lv_example_keyboard_1
|
||||
:language: c
|
||||
|
||||
|
||||
Keyboard with custom map
|
||||
------------------------
|
||||
|
||||
.. lv_example:: widgets/keyboard/lv_example_keyboard_2
|
||||
:language: c
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES
|
||||
|
||||
static void ta_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * ta = lv_event_get_target(e);
|
||||
lv_obj_t * kb = lv_event_get_user_data(e);
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
if(code == LV_EVENT_DEFOCUSED) {
|
||||
lv_keyboard_set_textarea(kb, NULL);
|
||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_keyboard_1(void)
|
||||
{
|
||||
/*Create a keyboard to use it with an of the text areas*/
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||
|
||||
/*Create a text area. The keyboard will write here*/
|
||||
lv_obj_t * ta1;
|
||||
ta1 = lv_textarea_create(lv_screen_active());
|
||||
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 10, 10);
|
||||
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
|
||||
lv_textarea_set_placeholder_text(ta1, "Hello");
|
||||
lv_obj_set_size(ta1, 140, 80);
|
||||
|
||||
lv_obj_t * ta2;
|
||||
ta2 = lv_textarea_create(lv_screen_active());
|
||||
lv_obj_align(ta2, LV_ALIGN_TOP_RIGHT, -10, 10);
|
||||
lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb);
|
||||
lv_obj_set_size(ta2, 140, 80);
|
||||
|
||||
lv_keyboard_set_textarea(kb, ta1);
|
||||
|
||||
/*The keyboard will show Arabic characters if they are enabled */
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS && LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
lv_obj_set_style_text_font(kb, &lv_font_dejavu_16_persian_hebrew, 0);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_dejavu_16_persian_hebrew, 0);
|
||||
lv_obj_set_style_text_font(ta2, &lv_font_dejavu_16_persian_hebrew, 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_keyboard_2(void)
|
||||
{
|
||||
/*Create an AZERTY keyboard map*/
|
||||
static const char * kb_map[] = {"A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"Q", "S", "D", "F", "G", "J", "K", "L", "M", LV_SYMBOL_NEW_LINE, "\n",
|
||||
"W", "X", "C", "V", "B", "N", ",", ".", ":", "!", "?", "\n",
|
||||
LV_SYMBOL_CLOSE, " ", " ", " ", LV_SYMBOL_OK, NULL
|
||||
};
|
||||
|
||||
/*Set the relative width of the buttons and other controls*/
|
||||
static const lv_buttonmatrix_ctrl_t kb_ctrl[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
2, LV_BUTTONMATRIX_CTRL_HIDDEN | 2, 6, LV_BUTTONMATRIX_CTRL_HIDDEN | 2, 2
|
||||
};
|
||||
|
||||
/*Create a keyboard and add the new map as USER_1 mode*/
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||
|
||||
lv_keyboard_set_map(kb, LV_KEYBOARD_MODE_USER_1, kb_map, kb_ctrl);
|
||||
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_USER_1);
|
||||
|
||||
/*Create a text area. The keyboard will write here*/
|
||||
lv_obj_t * ta;
|
||||
ta = lv_textarea_create(lv_screen_active());
|
||||
lv_obj_align(ta, LV_ALIGN_TOP_MID, 0, 10);
|
||||
lv_obj_set_size(ta, lv_pct(90), 80);
|
||||
lv_obj_add_state(ta, LV_STATE_FOCUSED);
|
||||
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
#endif
|
||||
31
libraries/lvgl/examples/widgets/label/index.rst
Normal file
31
libraries/lvgl/examples/widgets/label/index.rst
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Line wrap, recoloring and scrolling
|
||||
-----------------------------------
|
||||
|
||||
.. lv_example:: widgets/label/lv_example_label_1
|
||||
:language: c
|
||||
|
||||
Text shadow
|
||||
------------
|
||||
|
||||
.. lv_example:: widgets/label/lv_example_label_2
|
||||
:language: c
|
||||
|
||||
Show LTR, RTL and Chinese texts
|
||||
-------------------------------
|
||||
|
||||
.. lv_example:: widgets/label/lv_example_label_3
|
||||
:language: c
|
||||
|
||||
Draw label with gradient color
|
||||
------------------------------
|
||||
|
||||
.. lv_example:: widgets/label/lv_example_label_4
|
||||
:language: c
|
||||
|
||||
Customize circular scrolling animation
|
||||
--------------------------------------
|
||||
|
||||
.. lv_example:: widgets/label/lv_example_label_5
|
||||
:language: c
|
||||
|
||||
23
libraries/lvgl/examples/widgets/label/lv_example_label_1.c
Normal file
23
libraries/lvgl/examples/widgets/label/lv_example_label_1.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Show line wrap, re-color, line align and text scrolling.
|
||||
*/
|
||||
void lv_example_label_1(void)
|
||||
{
|
||||
lv_obj_t * label1 = lv_label_create(lv_screen_active());
|
||||
lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/
|
||||
lv_label_set_text(label1, "Recolor is not supported for v9 now.");
|
||||
lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/
|
||||
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
|
||||
|
||||
lv_obj_t * label2 = lv_label_create(lv_screen_active());
|
||||
lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
|
||||
lv_obj_set_width(label2, 150);
|
||||
lv_label_set_text(label2, "It is a circularly scrolling text. ");
|
||||
lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40);
|
||||
}
|
||||
|
||||
#endif
|
||||
36
libraries/lvgl/examples/widgets/label/lv_example_label_2.c
Normal file
36
libraries/lvgl/examples/widgets/label/lv_example_label_2.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Create a fake text shadow
|
||||
*/
|
||||
void lv_example_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_screen_active());
|
||||
lv_obj_add_style(shadow_label, &style_shadow, 0);
|
||||
|
||||
/*Create the main label*/
|
||||
lv_obj_t * main_label = lv_label_create(lv_screen_active());
|
||||
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, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/*Shift the second label down and to the right by 2 pixel*/
|
||||
lv_obj_align_to(shadow_label, main_label, LV_ALIGN_TOP_LEFT, 2, 2);
|
||||
}
|
||||
|
||||
#endif
|
||||
31
libraries/lvgl/examples/widgets/label/lv_example_label_3.c
Normal file
31
libraries/lvgl/examples/widgets/label/lv_example_label_3.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES && LV_FONT_DEJAVU_16_PERSIAN_HEBREW && LV_FONT_SIMSUN_16_CJK && LV_USE_BIDI
|
||||
|
||||
/**
|
||||
* Show mixed LTR, RTL and Chinese label
|
||||
*/
|
||||
void lv_example_label_3(void)
|
||||
{
|
||||
lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
|
||||
lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
|
||||
lv_obj_set_width(ltr_label, 310);
|
||||
lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
|
||||
|
||||
lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(rtl_label,
|
||||
"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
|
||||
lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
|
||||
lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
|
||||
lv_obj_set_width(rtl_label, 310);
|
||||
lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
}
|
||||
|
||||
#endif
|
||||
55
libraries/lvgl/examples/widgets/label/lv_example_label_4.c
Normal file
55
libraries/lvgl/examples/widgets/label/lv_example_label_4.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_LABEL && LV_FONT_MONTSERRAT_24 && LV_USE_CANVAS && LV_BUILD_EXAMPLES && LV_DRAW_SW_COMPLEX
|
||||
|
||||
#define MASK_WIDTH 150
|
||||
#define MASK_HEIGHT 60
|
||||
|
||||
static void generate_mask(lv_draw_buf_t * mask, int32_t w, int32_t h, const char * txt)
|
||||
{
|
||||
/*Create a "8 bit alpha" canvas and clear it*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, mask);
|
||||
lv_canvas_fill_bg(canvas, lv_color_black(), LV_OPA_TRANSP);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
/*Draw a label to the canvas. The result "image" will be used as mask*/
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
label_dsc.color = lv_color_white();
|
||||
label_dsc.align = LV_TEXT_ALIGN_CENTER;
|
||||
label_dsc.text = txt;
|
||||
label_dsc.font = &lv_font_montserrat_24;
|
||||
lv_area_t a = {0, 0, w - 1, h - 1};
|
||||
lv_draw_label(&layer, &label_dsc, &a);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
lv_obj_delete(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw label with gradient color
|
||||
*/
|
||||
void lv_example_label_4(void)
|
||||
{
|
||||
/* Create the mask of a text by drawing it to a canvas*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(mask, MASK_WIDTH, MASK_HEIGHT, LV_COLOR_FORMAT_L8);
|
||||
LV_DRAW_BUF_INIT_STATIC(mask);
|
||||
|
||||
generate_mask(&mask, MASK_WIDTH, MASK_HEIGHT, "Text with gradient");
|
||||
|
||||
/* Create an object from where the text will be masked out.
|
||||
* Now it's a rectangle with a gradient but it could be an image too*/
|
||||
lv_obj_t * grad = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(grad, MASK_WIDTH, MASK_HEIGHT);
|
||||
lv_obj_center(grad);
|
||||
lv_obj_set_style_bg_color(grad, lv_color_hex(0xff0000), 0);
|
||||
lv_obj_set_style_bg_grad_color(grad, lv_color_hex(0x0000ff), 0);
|
||||
lv_obj_set_style_bg_grad_dir(grad, LV_GRAD_DIR_HOR, 0);
|
||||
lv_obj_set_style_bitmap_mask_src(grad, &mask, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
30
libraries/lvgl/examples/widgets/label/lv_example_label_5.c
Normal file
30
libraries/lvgl/examples/widgets/label/lv_example_label_5.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Show customizing the circular scrolling animation of a label with `LV_LABEL_LONG_SCROLL_CIRCULAR`
|
||||
* long mode.
|
||||
*/
|
||||
void lv_example_label_5(void)
|
||||
{
|
||||
static lv_anim_t animation_template;
|
||||
static lv_style_t label_style;
|
||||
|
||||
lv_anim_init(&animation_template);
|
||||
lv_anim_set_delay(&animation_template, 1000); /*Wait 1 second to start the first scroll*/
|
||||
lv_anim_set_repeat_delay(&animation_template,
|
||||
3000); /*Repeat the scroll 3 seconds after the label scrolls back to the initial position*/
|
||||
|
||||
/*Initialize the label style with the animation template*/
|
||||
lv_style_init(&label_style);
|
||||
lv_style_set_anim(&label_style, &animation_template);
|
||||
|
||||
lv_obj_t * label1 = lv_label_create(lv_screen_active());
|
||||
lv_label_set_long_mode(label1, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
|
||||
lv_obj_set_width(label1, 150);
|
||||
lv_label_set_text(label1, "It is a circularly scrolling text. ");
|
||||
lv_obj_align(label1, LV_ALIGN_CENTER, 0, 40);
|
||||
lv_obj_add_style(label1, &label_style, LV_STATE_DEFAULT); /*Add the style to the label*/
|
||||
}
|
||||
|
||||
#endif
|
||||
7
libraries/lvgl/examples/widgets/led/index.rst
Normal file
7
libraries/lvgl/examples/widgets/led/index.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
LED with custom style
|
||||
---------------------
|
||||
|
||||
.. lv_example:: widgets/led/lv_example_led_1
|
||||
:language: c
|
||||
|
||||
26
libraries/lvgl/examples/widgets/led/lv_example_led_1.c
Normal file
26
libraries/lvgl/examples/widgets/led/lv_example_led_1.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LED && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Create LED's with different brightness and color
|
||||
*/
|
||||
void lv_example_led_1(void)
|
||||
{
|
||||
/*Create a LED and switch it OFF*/
|
||||
lv_obj_t * led1 = lv_led_create(lv_screen_active());
|
||||
lv_obj_align(led1, 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_screen_active());
|
||||
lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_led_set_brightness(led2, 150);
|
||||
lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
|
||||
|
||||
/*Copy the previous LED and switch it ON*/
|
||||
lv_obj_t * led3 = lv_led_create(lv_screen_active());
|
||||
lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0);
|
||||
lv_led_on(led3);
|
||||
}
|
||||
|
||||
#endif
|
||||
7
libraries/lvgl/examples/widgets/line/index.rst
Normal file
7
libraries/lvgl/examples/widgets/line/index.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
Simple Line
|
||||
-----------
|
||||
|
||||
.. lv_example:: widgets/line/lv_example_line_1
|
||||
:language: c
|
||||
|
||||
24
libraries/lvgl/examples/widgets/line/lv_example_line_1.c
Normal file
24
libraries/lvgl/examples/widgets/line/lv_example_line_1.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LINE && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_line_1(void)
|
||||
{
|
||||
/*Create an array for the points of the line*/
|
||||
static lv_point_precise_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_palette_main(LV_PALETTE_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_screen_active());
|
||||
lv_line_set_points(line1, line_points, 5); /*Set the points*/
|
||||
lv_obj_add_style(line1, &style_line, 0);
|
||||
lv_obj_center(line1);
|
||||
}
|
||||
|
||||
#endif
|
||||
13
libraries/lvgl/examples/widgets/list/index.rst
Normal file
13
libraries/lvgl/examples/widgets/list/index.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
Simple List
|
||||
-----------
|
||||
|
||||
.. lv_example:: widgets/list/lv_example_list_1
|
||||
:language: c
|
||||
|
||||
|
||||
Sorting a List using up and down buttons
|
||||
----------------------------------------
|
||||
|
||||
.. lv_example:: widgets/list/lv_example_list_2
|
||||
:language: c
|
||||
52
libraries/lvgl/examples/widgets/list/lv_example_list_1.c
Normal file
52
libraries/lvgl/examples/widgets/list/lv_example_list_1.c
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LIST && LV_BUILD_EXAMPLES
|
||||
static lv_obj_t * list1;
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
LV_UNUSED(obj);
|
||||
LV_LOG_USER("Clicked: %s", lv_list_get_button_text(list1, obj));
|
||||
}
|
||||
}
|
||||
void lv_example_list_1(void)
|
||||
{
|
||||
/*Create a list*/
|
||||
list1 = lv_list_create(lv_screen_active());
|
||||
lv_obj_set_size(list1, 180, 220);
|
||||
lv_obj_center(list1);
|
||||
|
||||
/*Add buttons to the list*/
|
||||
lv_obj_t * btn;
|
||||
lv_list_add_text(list1, "File");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_FILE, "New");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_DIRECTORY, "Open");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_SAVE, "Save");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_CLOSE, "Delete");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_EDIT, "Edit");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_list_add_text(list1, "Connectivity");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_BLUETOOTH, "Bluetooth");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_GPS, "Navigation");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_USB, "USB");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_BATTERY_FULL, "Battery");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_list_add_text(list1, "Exit");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_OK, "Apply");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_CLOSE, "Close");
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
166
libraries/lvgl/examples/widgets/list/lv_example_list_2.c
Normal file
166
libraries/lvgl/examples/widgets/list/lv_example_list_2.c
Normal file
@@ -0,0 +1,166 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LIST && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * list1;
|
||||
static lv_obj_t * list2;
|
||||
|
||||
static lv_obj_t * currentButton = NULL;
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
LV_LOG_USER("Clicked: %s", lv_list_get_button_text(list1, obj));
|
||||
|
||||
if(currentButton == obj) {
|
||||
currentButton = NULL;
|
||||
}
|
||||
else {
|
||||
currentButton = obj;
|
||||
}
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
uint32_t i;
|
||||
for(i = 0; i < lv_obj_get_child_count(parent); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(parent, i);
|
||||
if(child == currentButton) {
|
||||
lv_obj_add_state(child, LV_STATE_CHECKED);
|
||||
}
|
||||
else {
|
||||
lv_obj_remove_state(child, LV_STATE_CHECKED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_top(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
if(currentButton == NULL) return;
|
||||
lv_obj_move_background(currentButton);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_up(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
||||
if(currentButton == NULL) return;
|
||||
uint32_t index = lv_obj_get_index(currentButton);
|
||||
if(index <= 0) return;
|
||||
lv_obj_move_to_index(currentButton, index - 1);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_center(lv_event_t * e)
|
||||
{
|
||||
const lv_event_code_t code = lv_event_get_code(e);
|
||||
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
||||
if(currentButton == NULL) return;
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(currentButton);
|
||||
const uint32_t pos = lv_obj_get_child_count(parent) / 2;
|
||||
|
||||
lv_obj_move_to_index(currentButton, pos);
|
||||
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_dn(lv_event_t * e)
|
||||
{
|
||||
const lv_event_code_t code = lv_event_get_code(e);
|
||||
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
||||
if(currentButton == NULL) return;
|
||||
const uint32_t index = lv_obj_get_index(currentButton);
|
||||
|
||||
lv_obj_move_to_index(currentButton, index + 1);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_bottom(lv_event_t * e)
|
||||
{
|
||||
const lv_event_code_t code = lv_event_get_code(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
if(currentButton == NULL) return;
|
||||
lv_obj_move_foreground(currentButton);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_swap(lv_event_t * e)
|
||||
{
|
||||
const lv_event_code_t code = lv_event_get_code(e);
|
||||
// lv_obj_t* obj = lv_event_get_target(e);
|
||||
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
|
||||
uint32_t cnt = lv_obj_get_child_count(list1);
|
||||
for(int i = 0; i < 100; i++)
|
||||
if(cnt > 1) {
|
||||
lv_obj_t * obj = lv_obj_get_child(list1, lv_rand(0, cnt));
|
||||
lv_obj_move_to_index(obj, lv_rand(0, cnt));
|
||||
if(currentButton != NULL) {
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_list_2(void)
|
||||
{
|
||||
/*Create a list*/
|
||||
list1 = lv_list_create(lv_screen_active());
|
||||
lv_obj_set_size(list1, lv_pct(60), lv_pct(100));
|
||||
lv_obj_set_style_pad_row(list1, 5, 0);
|
||||
|
||||
/*Add buttons to the list*/
|
||||
lv_obj_t * btn;
|
||||
int i;
|
||||
for(i = 0; i < 15; i++) {
|
||||
btn = lv_button_create(list1);
|
||||
lv_obj_set_width(btn, lv_pct(50));
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_obj_t * lab = lv_label_create(btn);
|
||||
lv_label_set_text_fmt(lab, "Item %d", i);
|
||||
}
|
||||
|
||||
/*Select the first button by default*/
|
||||
currentButton = lv_obj_get_child(list1, 0);
|
||||
lv_obj_add_state(currentButton, LV_STATE_CHECKED);
|
||||
|
||||
/*Create a second list with up and down buttons*/
|
||||
list2 = lv_list_create(lv_screen_active());
|
||||
lv_obj_set_size(list2, lv_pct(40), lv_pct(100));
|
||||
lv_obj_align(list2, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||
lv_obj_set_flex_flow(list2, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
btn = lv_list_add_button(list2, NULL, "Top");
|
||||
lv_obj_add_event_cb(btn, event_handler_top, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_UP, "Up");
|
||||
lv_obj_add_event_cb(btn, event_handler_up, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_LEFT, "Center");
|
||||
lv_obj_add_event_cb(btn, event_handler_center, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_DOWN, "Down");
|
||||
lv_obj_add_event_cb(btn, event_handler_dn, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, NULL, "Bottom");
|
||||
lv_obj_add_event_cb(btn, event_handler_bottom, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_SHUFFLE, "Shuffle");
|
||||
lv_obj_add_event_cb(btn, event_handler_swap, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
}
|
||||
|
||||
#endif
|
||||
11
libraries/lvgl/examples/widgets/lottie/index.rst
Normal file
11
libraries/lvgl/examples/widgets/lottie/index.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
Load a Lottie animation from an array
|
||||
-------------------------------------
|
||||
|
||||
.. lv_example:: widgets/lottie/lv_example_lottie_1
|
||||
:language: c
|
||||
|
||||
Load a Lottie animation from file
|
||||
---------------------------------
|
||||
|
||||
.. lv_example:: widgets/lottie/lv_example_lottie_2
|
||||
:language: c
|
||||
43
libraries/lvgl/examples/widgets/lottie/lv_example_lottie_1.c
Normal file
43
libraries/lvgl/examples/widgets/lottie/lv_example_lottie_1.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES
|
||||
#if LV_USE_LOTTIE
|
||||
|
||||
/**
|
||||
* Load an lottie animation from data
|
||||
*/
|
||||
void lv_example_lottie_1(void)
|
||||
{
|
||||
extern const uint8_t lv_example_lottie_approve[];
|
||||
extern const size_t lv_example_lottie_approve_size;
|
||||
|
||||
lv_obj_t * lottie = lv_lottie_create(lv_screen_active());
|
||||
lv_lottie_set_src_data(lottie, lv_example_lottie_approve, lv_example_lottie_approve_size);
|
||||
|
||||
#if LV_DRAW_BUF_ALIGN == 4 && LV_DRAW_BUF_STRIDE_ALIGN == 1
|
||||
/*If there are no special requirements, just declare a buffer
|
||||
x4 because the Lottie is rendered in ARGB8888 format*/
|
||||
static uint8_t buf[64 * 64 * 4];
|
||||
lv_lottie_set_buffer(lottie, 64, 64, buf);
|
||||
#else
|
||||
/*For GPUs and special alignment/strid setting use a draw_buf instead*/
|
||||
LV_DRAW_BUF_DEFINE(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888);
|
||||
lv_lottie_set_draw_buf(lottie, &draw_buf);
|
||||
#endif
|
||||
|
||||
lv_obj_center(lottie);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void lv_example_lottie_1(void)
|
||||
{
|
||||
/*fallback for online examples*/
|
||||
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Lottie cannot be previewed online");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_LOTTIE*/
|
||||
|
||||
#endif /*LV_BUILD_EXAMPLES*/
|
||||
41
libraries/lvgl/examples/widgets/lottie/lv_example_lottie_2.c
Normal file
41
libraries/lvgl/examples/widgets/lottie/lv_example_lottie_2.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES
|
||||
#if LV_USE_LOTTIE
|
||||
|
||||
/**
|
||||
* Load an lottie animation from file
|
||||
*/
|
||||
void lv_example_lottie_2(void)
|
||||
{
|
||||
|
||||
lv_obj_t * lottie = lv_lottie_create(lv_screen_active());
|
||||
lv_lottie_set_src_file(lottie, "lvgl/examples/widgets/lottie/lv_example_lottie_approve.json");
|
||||
|
||||
#if LV_DRAW_BUF_ALIGN == 4 && LV_DRAW_BUF_STRIDE_ALIGN == 1
|
||||
/*If there are no special requirements, just declare a buffer
|
||||
x4 because the Lottie is rendered in ARGB8888 format*/
|
||||
static uint8_t buf[64 * 64 * 4];
|
||||
lv_lottie_set_buffer(lottie, 64, 64, buf);
|
||||
#else
|
||||
/*For GPUs and special alignment/strid setting use a draw_buf instead*/
|
||||
LV_DRAW_BUF_DEFINE(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888);
|
||||
lv_lottie_set_draw_buf(lottie, &draw_buf);
|
||||
#endif
|
||||
|
||||
lv_obj_center(lottie);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void lv_example_lottie_2(void)
|
||||
{
|
||||
/*fallback for online examples*/
|
||||
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Lottie cannot be previewed online");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_LOTTIE*/
|
||||
|
||||
#endif /*LV_BUILD_EXAMPLES*/
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
/* The original JSON string is converted to hex array because C99 requires support only 4096 character long strings.
|
||||
|
||||
lvgl/scripts/tohex.py is sued to convert a json file to a hex array. E.g.
|
||||
./filetohex.py my_lottie.json > output.txt
|
||||
|
||||
If your compiler support very long strings you can do
|
||||
const char * my_lottie = "JSON data here";
|
||||
But be sure to replace all " characters with \".
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "../../../lvgl.h"
|
||||
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_LOTTIE
|
||||
|
||||
const uint8_t lv_example_lottie_approve[] = {
|
||||
0x7b, 0x22, 0x76, 0x22, 0x3a, 0x22, 0x34, 0x2e, 0x38, 0x2e, 0x30, 0x22, 0x2c, 0x22, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x67, 0x22, 0x3a, 0x22, 0x4c, 0x6f, 0x74, 0x74, 0x69, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x41, 0x45, 0x20, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x22, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x64, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x74, 0x63, 0x22, 0x3a, 0x22, 0x22, 0x7d, 0x2c, 0x22, 0x66, 0x72, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x77, 0x22, 0x3a, 0x37, 0x32, 0x30, 0x2c, 0x22, 0x68, 0x22, 0x3a, 0x37, 0x32, 0x30, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x2c, 0x22, 0x64, 0x64, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x64, 0x64, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x20, 0x34, 0x22, 0x2c, 0x22, 0x73, 0x72, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x31, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x30, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x33, 0x33, 0x36, 0x2c, 0x33, 0x39, 0x36, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x7d, 0x2c, 0x22, 0x61, 0x6f, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x68, 0x61, 0x70, 0x65, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x67, 0x72, 0x22, 0x2c, 0x22, 0x69, 0x74, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x68, 0x22, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x5b, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x5d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x5b, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x5d, 0x2c, 0x22, 0x76, 0x22, 0x3a, 0x5b, 0x5b, 0x2d, 0x31, 0x32, 0x33, 0x2c, 0x2d, 0x36, 0x36, 0x5d, 0x2c, 0x5b, 0x36, 0x2c, 0x34, 0x35, 0x5d, 0x2c, 0x5b, 0x33, 0x32, 0x31, 0x2c, 0x2d, 0x32, 0x36, 0x34, 0x5d, 0x5d, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x50, 0x61, 0x74, 0x68, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x2d, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x22, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x39, 0x38, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, 0x38, 0x36, 0x2c, 0x30, 0x2e, 0x36, 0x38, 0x36, 0x32, 0x37, 0x34, 0x35, 0x30, 0x39, 0x38, 0x30, 0x34, 0x2c, 0x30, 0x2e, 0x33, 0x31, 0x33, 0x37, 0x32, 0x35,
|
||||
0x34, 0x39, 0x30, 0x31, 0x39, 0x36, 0x2c, 0x31, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x77, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x35, 0x32, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6c, 0x63, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6c, 0x6a, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x2d, 0x20, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x72, 0x22, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x37, 0x7d, 0x2c, 0x22, 0x73, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x73, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x7d, 0x5d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6e, 0x70, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x63, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x6d, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x65, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x33, 0x36, 0x38, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x31, 0x5d, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x35, 0x31, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x22, 0x74, 0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x22, 0x3a, 0x34, 0x35, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x39, 0x32, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6d, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x69, 0x6d, 0x20, 0x50, 0x61, 0x74, 0x68, 0x73, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x20, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x2d, 0x20, 0x54, 0x72, 0x69, 0x6d, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x73, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x64, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x20, 0x33, 0x22, 0x2c, 0x22, 0x73, 0x72, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x31, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x30, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x33, 0x33, 0x36, 0x2c, 0x33, 0x39, 0x36, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x7d, 0x2c, 0x22, 0x61, 0x6f, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x68, 0x61, 0x70, 0x65, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x67, 0x72, 0x22, 0x2c, 0x22, 0x69, 0x74, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x68, 0x22, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x5b, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x5d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x5b, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x5d, 0x2c, 0x22, 0x76, 0x22, 0x3a, 0x5b, 0x5b, 0x2d, 0x31, 0x32, 0x33, 0x2c, 0x2d, 0x36, 0x36, 0x5d, 0x2c, 0x5b, 0x36, 0x2c, 0x34, 0x35, 0x5d, 0x2c, 0x5b, 0x33, 0x32, 0x31, 0x2c, 0x2d, 0x32, 0x36, 0x34, 0x5d, 0x5d, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x50, 0x61, 0x74, 0x68, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x2d, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x22, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x31, 0x39, 0x36, 0x30, 0x37, 0x38, 0x34, 0x33, 0x31, 0x33, 0x37, 0x2c, 0x30, 0x2e, 0x35, 0x35, 0x36, 0x38, 0x36, 0x32, 0x37, 0x34, 0x35, 0x30, 0x39, 0x38, 0x2c, 0x30, 0x2e, 0x32, 0x33, 0x35, 0x32, 0x39, 0x34, 0x31, 0x31, 0x37, 0x36, 0x34, 0x37, 0x2c, 0x31, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x77, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x34, 0x38, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6c, 0x63, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6c, 0x6a, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22,
|
||||
0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x2d, 0x20, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x72, 0x22, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x37, 0x7d, 0x2c, 0x22, 0x73, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x73, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x7d, 0x5d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6e, 0x70, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x63, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x6d, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x65, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x33, 0x36, 0x38, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x31, 0x5d, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x35, 0x31, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x22, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x22, 0x3a, 0x34, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6d, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x69, 0x6d, 0x20, 0x50, 0x61, 0x74, 0x68, 0x73, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x2d, 0x20, 0x54, 0x72, 0x69, 0x6d, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x73, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x64, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65,
|
||||
0x20, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x20, 0x32, 0x22, 0x2c, 0x22, 0x73, 0x72, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x31, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x38, 0x37, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x30, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x33, 0x33, 0x36, 0x2c, 0x33, 0x36, 0x36, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x7d, 0x2c, 0x22, 0x61, 0x6f, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x68, 0x61, 0x70, 0x65, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x67, 0x72, 0x22, 0x2c, 0x22, 0x69, 0x74, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x64, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x65, 0x6c, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x35, 0x32, 0x30, 0x2c, 0x35, 0x32, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x20, 0x50, 0x61, 0x74, 0x68, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x2d, 0x20, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x22, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x39, 0x38, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, 0x38, 0x36, 0x2c, 0x30, 0x2e, 0x36, 0x38, 0x36, 0x32, 0x37, 0x34, 0x35, 0x30, 0x39, 0x38, 0x30, 0x34, 0x2c, 0x30, 0x2e, 0x33, 0x31, 0x33, 0x37, 0x32, 0x35, 0x34, 0x39, 0x30, 0x31, 0x39, 0x36, 0x2c, 0x31, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x77, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x35, 0x32, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6c, 0x63, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6c, 0x6a, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6c, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x2d, 0x20, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x72, 0x22, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c,
|
||||
0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x37, 0x7d, 0x2c, 0x22, 0x73, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x73, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x7d, 0x5d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6e, 0x70, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x63, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x6d, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x65, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x33, 0x33, 0x37, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x31, 0x5d, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x33, 0x33, 0x34, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x22, 0x74, 0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x22, 0x3a, 0x34, 0x35, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x38, 0x30, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6d, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x69, 0x6d, 0x20, 0x50, 0x61, 0x74, 0x68, 0x73, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x2d, 0x20, 0x54, 0x72, 0x69, 0x6d, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x73, 0x74, 0x22, 0x3a, 0x31, 0x30, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x7d, 0x2c, 0x7b, 0x22, 0x64, 0x64, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x6e, 0x64, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x72, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x31, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x38, 0x37, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x30, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x33, 0x33, 0x36, 0x2c, 0x33, 0x36, 0x36, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d,
|
||||
0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x7d, 0x2c, 0x22, 0x61, 0x6f, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x68, 0x61, 0x70, 0x65, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x67, 0x72, 0x22, 0x2c, 0x22, 0x69, 0x74, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x64, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x65, 0x6c, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x35, 0x32, 0x30, 0x2c, 0x35, 0x32, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x20, 0x50, 0x61, 0x74, 0x68, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x53, 0x68, 0x61, 0x70, 0x65, 0x20, 0x2d, 0x20, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x22, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x31, 0x39, 0x36, 0x30, 0x37, 0x38, 0x34, 0x33, 0x31, 0x33, 0x37, 0x2c, 0x30, 0x2e, 0x35, 0x35, 0x36, 0x38, 0x36, 0x32, 0x37, 0x34, 0x35, 0x30, 0x39, 0x38, 0x2c, 0x30, 0x2e, 0x32, 0x33, 0x35, 0x32, 0x39, 0x34, 0x31, 0x31, 0x37, 0x36, 0x34, 0x37, 0x2c, 0x31, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x77, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x34, 0x38, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6c, 0x63, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6c, 0x6a, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6c, 0x22, 0x3a, 0x34, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x2d, 0x20, 0x53, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x72, 0x22, 0x2c, 0x22, 0x70, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x30, 0x2c, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x31, 0x30, 0x30, 0x2c, 0x31, 0x30, 0x30, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x36, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x37, 0x7d, 0x2c, 0x22, 0x73, 0x6b, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x34, 0x7d, 0x2c, 0x22, 0x73, 0x61, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x35, 0x7d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x7d, 0x5d, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x45,
|
||||
0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6e, 0x70, 0x22, 0x3a, 0x33, 0x2c, 0x22, 0x63, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x74, 0x6d, 0x22, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x2c, 0x22, 0x65, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x69, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x33, 0x36, 0x38, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x31, 0x5d, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x5b, 0x30, 0x2e, 0x32, 0x35, 0x31, 0x5d, 0x2c, 0x22, 0x79, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x22, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x30, 0x5d, 0x7d, 0x2c, 0x7b, 0x22, 0x74, 0x22, 0x3a, 0x34, 0x30, 0x2c, 0x22, 0x73, 0x22, 0x3a, 0x5b, 0x38, 0x34, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x6f, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x33, 0x7d, 0x2c, 0x22, 0x6d, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x69, 0x78, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6e, 0x6d, 0x22, 0x3a, 0x22, 0x54, 0x72, 0x69, 0x6d, 0x20, 0x50, 0x61, 0x74, 0x68, 0x73, 0x20, 0x31, 0x22, 0x2c, 0x22, 0x6d, 0x6e, 0x22, 0x3a, 0x22, 0x41, 0x44, 0x42, 0x45, 0x20, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x2d, 0x20, 0x54, 0x72, 0x69, 0x6d, 0x22, 0x2c, 0x22, 0x68, 0x64, 0x22, 0x3a, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x5d, 0x2c, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x70, 0x22, 0x3a, 0x36, 0x30, 0x2c, 0x22, 0x73, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x62, 0x6d, 0x22, 0x3a, 0x30, 0x7d, 0x5d, 0x2c, 0x22, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d,
|
||||
0x00 /*Close the string*/
|
||||
};
|
||||
|
||||
const size_t lv_example_lottie_approve_size = sizeof(lv_example_lottie_approve);
|
||||
|
||||
#endif
|
||||
File diff suppressed because one or more lines are too long
162
libraries/lvgl/examples/widgets/lv_example_widgets.h
Normal file
162
libraries/lvgl/examples/widgets/lv_example_widgets.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* @file lv_example_widgets.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EXAMPLE_WIDGETS_H
|
||||
#define LV_EXAMPLE_WIDGETS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_example_animimg_1(void);
|
||||
|
||||
void lv_example_arc_1(void);
|
||||
void lv_example_arc_2(void);
|
||||
|
||||
void lv_example_bar_1(void);
|
||||
void lv_example_bar_2(void);
|
||||
void lv_example_bar_3(void);
|
||||
void lv_example_bar_4(void);
|
||||
void lv_example_bar_5(void);
|
||||
void lv_example_bar_6(void);
|
||||
void lv_example_bar_7(void);
|
||||
|
||||
void lv_example_button_1(void);
|
||||
void lv_example_button_2(void);
|
||||
void lv_example_button_3(void);
|
||||
|
||||
void lv_example_buttonmatrix_1(void);
|
||||
void lv_example_buttonmatrix_2(void);
|
||||
void lv_example_buttonmatrix_3(void);
|
||||
|
||||
void lv_example_calendar_1(void);
|
||||
void lv_example_calendar_2(void);
|
||||
|
||||
void lv_example_canvas_1(void);
|
||||
void lv_example_canvas_2(void);
|
||||
void lv_example_canvas_3(void);
|
||||
void lv_example_canvas_4(void);
|
||||
void lv_example_canvas_5(void);
|
||||
void lv_example_canvas_6(void);
|
||||
void lv_example_canvas_7(void);
|
||||
void lv_example_canvas_8(void);
|
||||
|
||||
void lv_example_chart_1(void);
|
||||
void lv_example_chart_2(void);
|
||||
void lv_example_chart_3(void);
|
||||
void lv_example_chart_4(void);
|
||||
void lv_example_chart_5(void);
|
||||
void lv_example_chart_6(void);
|
||||
void lv_example_chart_7(void);
|
||||
void lv_example_chart_8(void);
|
||||
|
||||
void lv_example_checkbox_1(void);
|
||||
void lv_example_checkbox_2(void);
|
||||
|
||||
void lv_example_dropdown_1(void);
|
||||
void lv_example_dropdown_2(void);
|
||||
void lv_example_dropdown_3(void);
|
||||
|
||||
void lv_example_image_1(void);
|
||||
void lv_example_image_2(void);
|
||||
void lv_example_image_3(void);
|
||||
void lv_example_image_4(void);
|
||||
|
||||
void lv_example_imagebutton_1(void);
|
||||
|
||||
void lv_example_keyboard_1(void);
|
||||
void lv_example_keyboard_2(void);
|
||||
|
||||
void lv_example_label_1(void);
|
||||
void lv_example_label_2(void);
|
||||
void lv_example_label_3(void);
|
||||
void lv_example_label_4(void);
|
||||
void lv_example_label_5(void);
|
||||
|
||||
void lv_example_led_1(void);
|
||||
|
||||
void lv_example_line_1(void);
|
||||
|
||||
void lv_example_list_1(void);
|
||||
void lv_example_list_2(void);
|
||||
|
||||
void lv_example_lottie_1(void);
|
||||
void lv_example_lottie_2(void);
|
||||
|
||||
void lv_example_menu_1(void);
|
||||
void lv_example_menu_2(void);
|
||||
void lv_example_menu_3(void);
|
||||
void lv_example_menu_4(void);
|
||||
void lv_example_menu_5(void);
|
||||
|
||||
void lv_example_msgbox_1(void);
|
||||
void lv_example_msgbox_2(void);
|
||||
|
||||
void lv_example_obj_1(void);
|
||||
void lv_example_obj_2(void);
|
||||
|
||||
void lv_example_roller_1(void);
|
||||
void lv_example_roller_2(void);
|
||||
void lv_example_roller_3(void);
|
||||
|
||||
void lv_example_scale_1(void);
|
||||
void lv_example_scale_2(void);
|
||||
void lv_example_scale_3(void);
|
||||
void lv_example_scale_4(void);
|
||||
void lv_example_scale_5(void);
|
||||
void lv_example_scale_6(void);
|
||||
void lv_example_scale_7(void);
|
||||
|
||||
void lv_example_slider_1(void);
|
||||
void lv_example_slider_2(void);
|
||||
void lv_example_slider_3(void);
|
||||
void lv_example_slider_4(void);
|
||||
|
||||
void lv_example_span_1(void);
|
||||
|
||||
void lv_example_spinbox_1(void);
|
||||
|
||||
void lv_example_spinner_1(void);
|
||||
|
||||
void lv_example_switch_1(void);
|
||||
|
||||
void lv_example_table_1(void);
|
||||
void lv_example_table_2(void);
|
||||
|
||||
void lv_example_tabview_1(void);
|
||||
void lv_example_tabview_2(void);
|
||||
|
||||
void lv_example_textarea_1(void);
|
||||
void lv_example_textarea_2(void);
|
||||
void lv_example_textarea_3(void);
|
||||
|
||||
void lv_example_tileview_1(void);
|
||||
|
||||
void lv_example_win_1(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_WIDGETS_H*/
|
||||
31
libraries/lvgl/examples/widgets/menu/index.rst
Normal file
31
libraries/lvgl/examples/widgets/menu/index.rst
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Simple Menu
|
||||
-----------
|
||||
|
||||
.. lv_example:: widgets/menu/lv_example_menu_1
|
||||
:language: c
|
||||
|
||||
Simple Menu with root btn
|
||||
-------------------------
|
||||
|
||||
.. lv_example:: widgets/menu/lv_example_menu_2
|
||||
:language: c
|
||||
|
||||
Simple Menu with custom header
|
||||
------------------------------
|
||||
|
||||
.. lv_example:: widgets/menu/lv_example_menu_3
|
||||
:language: c
|
||||
|
||||
Simple Menu with floating btn to add new menu page
|
||||
--------------------------------------------------
|
||||
|
||||
.. lv_example:: widgets/menu/lv_example_menu_4
|
||||
:language: c
|
||||
|
||||
Complex Menu
|
||||
------------
|
||||
|
||||
.. lv_example:: widgets/menu/lv_example_menu_5
|
||||
:language: c
|
||||
|
||||
40
libraries/lvgl/examples/widgets/menu/lv_example_menu_1.c
Normal file
40
libraries/lvgl/examples/widgets/menu/lv_example_menu_1.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MENU && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_menu_1(void)
|
||||
{
|
||||
/*Create a menu object*/
|
||||
lv_obj_t * menu = lv_menu_create(lv_screen_active());
|
||||
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
|
||||
lv_obj_center(menu);
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * label;
|
||||
|
||||
/*Create a sub page*/
|
||||
lv_obj_t * sub_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(sub_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding here");
|
||||
|
||||
/*Create a main page*/
|
||||
lv_obj_t * main_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 1");
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 2");
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 3 (Click me!)");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||
|
||||
lv_menu_set_page(menu, main_page);
|
||||
}
|
||||
|
||||
#endif
|
||||
54
libraries/lvgl/examples/widgets/menu/lv_example_menu_2.c
Normal file
54
libraries/lvgl/examples/widgets/menu/lv_example_menu_2.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MENU && LV_USE_MSGBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void back_event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_obj_t * menu = lv_event_get_user_data(e);
|
||||
|
||||
if(lv_menu_back_button_is_root(menu, obj)) {
|
||||
lv_obj_t * mbox1 = lv_msgbox_create(NULL);
|
||||
lv_msgbox_add_title(mbox1, "Hello");
|
||||
lv_msgbox_add_text(mbox1, "Root back btn click.");
|
||||
lv_msgbox_add_close_button(mbox1);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_menu_2(void)
|
||||
{
|
||||
lv_obj_t * menu = lv_menu_create(lv_screen_active());
|
||||
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
|
||||
lv_obj_add_event_cb(menu, back_event_handler, LV_EVENT_CLICKED, menu);
|
||||
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
|
||||
lv_obj_center(menu);
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * label;
|
||||
|
||||
/*Create a sub page*/
|
||||
lv_obj_t * sub_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(sub_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding here");
|
||||
|
||||
/*Create a main page*/
|
||||
lv_obj_t * main_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 1");
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 2");
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 3 (Click me!)");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||
|
||||
lv_menu_set_page(menu, main_page);
|
||||
}
|
||||
|
||||
#endif
|
||||
59
libraries/lvgl/examples/widgets/menu/lv_example_menu_3.c
Normal file
59
libraries/lvgl/examples/widgets/menu/lv_example_menu_3.c
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MENU && LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_menu_3(void)
|
||||
{
|
||||
/*Create a menu object*/
|
||||
lv_obj_t * menu = lv_menu_create(lv_screen_active());
|
||||
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
|
||||
lv_obj_center(menu);
|
||||
|
||||
/*Modify the header*/
|
||||
lv_obj_t * back_btn = lv_menu_get_main_header_back_button(menu);
|
||||
lv_obj_t * back_button_label = lv_label_create(back_btn);
|
||||
lv_label_set_text(back_button_label, "Back");
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * label;
|
||||
|
||||
/*Create sub pages*/
|
||||
lv_obj_t * sub_1_page = lv_menu_page_create(menu, "Page 1");
|
||||
|
||||
cont = lv_menu_cont_create(sub_1_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding here");
|
||||
|
||||
lv_obj_t * sub_2_page = lv_menu_page_create(menu, "Page 2");
|
||||
|
||||
cont = lv_menu_cont_create(sub_2_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding here");
|
||||
|
||||
lv_obj_t * sub_3_page = lv_menu_page_create(menu, "Page 3");
|
||||
|
||||
cont = lv_menu_cont_create(sub_3_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding here");
|
||||
|
||||
/*Create a main page*/
|
||||
lv_obj_t * main_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 1 (Click me!)");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_1_page);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 2 (Click me!)");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_2_page);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 3 (Click me!)");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_3_page);
|
||||
|
||||
lv_menu_set_page(menu, main_page);
|
||||
}
|
||||
|
||||
#endif
|
||||
69
libraries/lvgl/examples/widgets/menu/lv_example_menu_4.c
Normal file
69
libraries/lvgl/examples/widgets/menu/lv_example_menu_4.c
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MENU && LV_BUILD_EXAMPLES
|
||||
|
||||
static uint32_t btn_cnt = 1;
|
||||
static lv_obj_t * main_page;
|
||||
static lv_obj_t * menu;
|
||||
|
||||
static void float_button_event_cb(lv_event_t * e)
|
||||
{
|
||||
LV_UNUSED(e);
|
||||
|
||||
btn_cnt++;
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * label;
|
||||
|
||||
lv_obj_t * sub_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(sub_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text_fmt(label, "Hello, I am hiding inside %"LV_PRIu32"", btn_cnt);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text_fmt(label, "Item %"LV_PRIu32"", btn_cnt);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||
|
||||
lv_obj_scroll_to_view_recursive(cont, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
void lv_example_menu_4(void)
|
||||
{
|
||||
/*Create a menu object*/
|
||||
menu = lv_menu_create(lv_screen_active());
|
||||
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
|
||||
lv_obj_center(menu);
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * label;
|
||||
|
||||
/*Create a sub page*/
|
||||
lv_obj_t * sub_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(sub_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Hello, I am hiding inside the first item");
|
||||
|
||||
/*Create a main page*/
|
||||
main_page = lv_menu_page_create(menu, NULL);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Item 1");
|
||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||
|
||||
lv_menu_set_page(menu, main_page);
|
||||
|
||||
/*Create floating btn*/
|
||||
lv_obj_t * float_btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_set_size(float_btn, 50, 50);
|
||||
lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING);
|
||||
lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, -10, -10);
|
||||
lv_obj_add_event_cb(float_btn, float_button_event_cb, LV_EVENT_CLICKED, menu);
|
||||
lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0);
|
||||
lv_obj_set_style_bg_image_src(float_btn, LV_SYMBOL_PLUS, 0);
|
||||
lv_obj_set_style_text_font(float_btn, lv_theme_get_font_large(float_btn), 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
201
libraries/lvgl/examples/widgets/menu/lv_example_menu_5.c
Normal file
201
libraries/lvgl/examples/widgets/menu/lv_example_menu_5.c
Normal file
@@ -0,0 +1,201 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MENU && LV_USE_MSGBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
typedef enum {
|
||||
LV_MENU_ITEM_BUILDER_VARIANT_1,
|
||||
LV_MENU_ITEM_BUILDER_VARIANT_2
|
||||
} lv_menu_builder_variant_t;
|
||||
|
||||
static void back_event_handler(lv_event_t * e);
|
||||
static void switch_handler(lv_event_t * e);
|
||||
lv_obj_t * root_page;
|
||||
static lv_obj_t * create_text(lv_obj_t * parent, const char * icon, const char * txt,
|
||||
lv_menu_builder_variant_t builder_variant);
|
||||
static lv_obj_t * create_slider(lv_obj_t * parent,
|
||||
const char * icon, const char * txt, int32_t min, int32_t max, int32_t val);
|
||||
static lv_obj_t * create_switch(lv_obj_t * parent,
|
||||
const char * icon, const char * txt, bool chk);
|
||||
|
||||
void lv_example_menu_5(void)
|
||||
{
|
||||
lv_obj_t * menu = lv_menu_create(lv_screen_active());
|
||||
|
||||
lv_color_t bg_color = lv_obj_get_style_bg_color(menu, 0);
|
||||
if(lv_color_brightness(bg_color) > 127) {
|
||||
lv_obj_set_style_bg_color(menu, lv_color_darken(lv_obj_get_style_bg_color(menu, 0), 10), 0);
|
||||
}
|
||||
else {
|
||||
lv_obj_set_style_bg_color(menu, lv_color_darken(lv_obj_get_style_bg_color(menu, 0), 50), 0);
|
||||
}
|
||||
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
|
||||
lv_obj_add_event_cb(menu, back_event_handler, LV_EVENT_CLICKED, menu);
|
||||
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
|
||||
lv_obj_center(menu);
|
||||
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * section;
|
||||
|
||||
/*Create sub pages*/
|
||||
lv_obj_t * sub_mechanics_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_mechanics_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
lv_menu_separator_create(sub_mechanics_page);
|
||||
section = lv_menu_section_create(sub_mechanics_page);
|
||||
create_slider(section, LV_SYMBOL_SETTINGS, "Velocity", 0, 150, 120);
|
||||
create_slider(section, LV_SYMBOL_SETTINGS, "Acceleration", 0, 150, 50);
|
||||
create_slider(section, LV_SYMBOL_SETTINGS, "Weight limit", 0, 150, 80);
|
||||
|
||||
lv_obj_t * sub_sound_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_sound_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
lv_menu_separator_create(sub_sound_page);
|
||||
section = lv_menu_section_create(sub_sound_page);
|
||||
create_switch(section, LV_SYMBOL_AUDIO, "Sound", false);
|
||||
|
||||
lv_obj_t * sub_display_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_display_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
lv_menu_separator_create(sub_display_page);
|
||||
section = lv_menu_section_create(sub_display_page);
|
||||
create_slider(section, LV_SYMBOL_SETTINGS, "Brightness", 0, 150, 100);
|
||||
|
||||
lv_obj_t * sub_software_info_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_software_info_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
section = lv_menu_section_create(sub_software_info_page);
|
||||
create_text(section, NULL, "Version 1.0", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
|
||||
lv_obj_t * sub_legal_info_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_legal_info_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
section = lv_menu_section_create(sub_legal_info_page);
|
||||
for(uint32_t i = 0; i < 15; i++) {
|
||||
create_text(section, NULL,
|
||||
"This is a long long long long long long long long long text, if it is long enough it may scroll.",
|
||||
LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
}
|
||||
|
||||
lv_obj_t * sub_about_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_about_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
lv_menu_separator_create(sub_about_page);
|
||||
section = lv_menu_section_create(sub_about_page);
|
||||
cont = create_text(section, NULL, "Software information", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_software_info_page);
|
||||
cont = create_text(section, NULL, "Legal information", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_legal_info_page);
|
||||
|
||||
lv_obj_t * sub_menu_mode_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_menu_mode_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
lv_menu_separator_create(sub_menu_mode_page);
|
||||
section = lv_menu_section_create(sub_menu_mode_page);
|
||||
cont = create_switch(section, LV_SYMBOL_AUDIO, "Sidebar enable", true);
|
||||
lv_obj_add_event_cb(lv_obj_get_child(cont, 2), switch_handler, LV_EVENT_VALUE_CHANGED, menu);
|
||||
|
||||
/*Create a root page*/
|
||||
root_page = lv_menu_page_create(menu, "Settings");
|
||||
lv_obj_set_style_pad_hor(root_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
section = lv_menu_section_create(root_page);
|
||||
cont = create_text(section, LV_SYMBOL_SETTINGS, "Mechanics", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_mechanics_page);
|
||||
cont = create_text(section, LV_SYMBOL_AUDIO, "Sound", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_sound_page);
|
||||
cont = create_text(section, LV_SYMBOL_SETTINGS, "Display", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_display_page);
|
||||
|
||||
create_text(root_page, NULL, "Others", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
section = lv_menu_section_create(root_page);
|
||||
cont = create_text(section, NULL, "About", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_about_page);
|
||||
cont = create_text(section, LV_SYMBOL_SETTINGS, "Menu mode", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_menu_mode_page);
|
||||
|
||||
lv_menu_set_sidebar_page(menu, root_page);
|
||||
|
||||
lv_obj_send_event(lv_obj_get_child(lv_obj_get_child(lv_menu_get_cur_sidebar_page(menu), 0), 0), LV_EVENT_CLICKED,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void back_event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_obj_t * menu = lv_event_get_user_data(e);
|
||||
|
||||
if(lv_menu_back_button_is_root(menu, obj)) {
|
||||
lv_obj_t * mbox1 = lv_msgbox_create(NULL);
|
||||
lv_msgbox_add_title(mbox1, "Hello");
|
||||
lv_msgbox_add_text(mbox1, "Root back btn click.");
|
||||
lv_msgbox_add_close_button(mbox1);
|
||||
}
|
||||
}
|
||||
|
||||
static void switch_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * menu = lv_event_get_user_data(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
if(lv_obj_has_state(obj, LV_STATE_CHECKED)) {
|
||||
lv_menu_set_page(menu, NULL);
|
||||
lv_menu_set_sidebar_page(menu, root_page);
|
||||
lv_obj_send_event(lv_obj_get_child(lv_obj_get_child(lv_menu_get_cur_sidebar_page(menu), 0), 0), LV_EVENT_CLICKED,
|
||||
NULL);
|
||||
}
|
||||
else {
|
||||
lv_menu_set_sidebar_page(menu, NULL);
|
||||
lv_menu_clear_history(menu); /* Clear history because we will be showing the root page later */
|
||||
lv_menu_set_page(menu, root_page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static lv_obj_t * create_text(lv_obj_t * parent, const char * icon, const char * txt,
|
||||
lv_menu_builder_variant_t builder_variant)
|
||||
{
|
||||
lv_obj_t * obj = lv_menu_cont_create(parent);
|
||||
|
||||
lv_obj_t * img = NULL;
|
||||
lv_obj_t * label = NULL;
|
||||
|
||||
if(icon) {
|
||||
img = lv_image_create(obj);
|
||||
lv_image_set_src(img, icon);
|
||||
}
|
||||
|
||||
if(txt) {
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text(label, txt);
|
||||
lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
|
||||
lv_obj_set_flex_grow(label, 1);
|
||||
}
|
||||
|
||||
if(builder_variant == LV_MENU_ITEM_BUILDER_VARIANT_2 && icon && txt) {
|
||||
lv_obj_add_flag(img, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
lv_obj_swap(img, label);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static lv_obj_t * create_slider(lv_obj_t * parent, const char * icon, const char * txt, int32_t min, int32_t max,
|
||||
int32_t val)
|
||||
{
|
||||
lv_obj_t * obj = create_text(parent, icon, txt, LV_MENU_ITEM_BUILDER_VARIANT_2);
|
||||
|
||||
lv_obj_t * slider = lv_slider_create(obj);
|
||||
lv_obj_set_flex_grow(slider, 1);
|
||||
lv_slider_set_range(slider, min, max);
|
||||
lv_slider_set_value(slider, val, LV_ANIM_OFF);
|
||||
|
||||
if(icon == NULL) {
|
||||
lv_obj_add_flag(slider, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static lv_obj_t * create_switch(lv_obj_t * parent, const char * icon, const char * txt, bool chk)
|
||||
{
|
||||
lv_obj_t * obj = create_text(parent, icon, txt, LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
|
||||
lv_obj_t * sw = lv_switch_create(obj);
|
||||
lv_obj_add_state(sw, chk ? LV_STATE_CHECKED : 0);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
#endif
|
||||
14
libraries/lvgl/examples/widgets/msgbox/index.rst
Normal file
14
libraries/lvgl/examples/widgets/msgbox/index.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
Simple Message box
|
||||
------------------
|
||||
|
||||
.. lv_example:: widgets/msgbox/lv_example_msgbox_1
|
||||
:language: c
|
||||
|
||||
Scrolling and styled Message box
|
||||
--------------------------------
|
||||
|
||||
.. lv_example:: widgets/msgbox/lv_example_msgbox_2
|
||||
:language: c
|
||||
|
||||
|
||||
29
libraries/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c
Normal file
29
libraries/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * btn = lv_event_get_target(e);
|
||||
lv_obj_t * label = lv_obj_get_child(btn, 0);
|
||||
LV_UNUSED(label);
|
||||
LV_LOG_USER("Button %s clicked", lv_label_get_text(label));
|
||||
}
|
||||
|
||||
void lv_example_msgbox_1(void)
|
||||
{
|
||||
lv_obj_t * mbox1 = lv_msgbox_create(NULL);
|
||||
|
||||
lv_msgbox_add_title(mbox1, "Hello");
|
||||
|
||||
lv_msgbox_add_text(mbox1, "This is a message box with two buttons.");
|
||||
lv_msgbox_add_close_button(mbox1);
|
||||
|
||||
lv_obj_t * btn;
|
||||
btn = lv_msgbox_add_footer_button(mbox1, "Apply");
|
||||
lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_msgbox_add_footer_button(mbox1, "Cancel");
|
||||
lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
63
libraries/lvgl/examples/widgets/msgbox/lv_example_msgbox_2.c
Normal file
63
libraries/lvgl/examples/widgets/msgbox/lv_example_msgbox_2.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void minimize_button_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * mbox = (lv_obj_t *) lv_event_get_user_data(e);
|
||||
lv_obj_add_flag(mbox, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
void lv_example_msgbox_2(void)
|
||||
{
|
||||
lv_obj_t * setting = lv_msgbox_create(lv_screen_active());
|
||||
lv_obj_set_style_clip_corner(setting, true, 0);
|
||||
|
||||
/* setting fixed size */
|
||||
lv_obj_set_size(setting, 300, 200);
|
||||
|
||||
/* setting's titlebar/header */
|
||||
lv_msgbox_add_title(setting, "Setting");
|
||||
lv_obj_t * minimize_button = lv_msgbox_add_header_button(setting, LV_SYMBOL_MINUS);
|
||||
lv_obj_add_event_cb(minimize_button, minimize_button_event_cb, LV_EVENT_CLICKED, setting);
|
||||
lv_msgbox_add_close_button(setting);
|
||||
|
||||
/* setting's content*/
|
||||
lv_obj_t * content = lv_msgbox_get_content(setting);
|
||||
lv_obj_set_flex_flow(content, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_align(content, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_pad_right(content, -1, LV_PART_SCROLLBAR);
|
||||
|
||||
lv_obj_t * cont_brightness = lv_obj_create(content);
|
||||
lv_obj_set_size(cont_brightness, lv_pct(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(cont_brightness, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_align(cont_brightness, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * lb_brightness = lv_label_create(cont_brightness);
|
||||
lv_label_set_text(lb_brightness, "Brightness : ");
|
||||
lv_obj_t * slider_brightness = lv_slider_create(cont_brightness);
|
||||
lv_obj_set_width(slider_brightness, lv_pct(100));
|
||||
lv_slider_set_value(slider_brightness, 50, LV_ANIM_OFF);
|
||||
|
||||
lv_obj_t * cont_speed = lv_obj_create(content);
|
||||
lv_obj_set_size(cont_speed, lv_pct(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(cont_speed, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flex_align(cont_speed, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * lb_speed = lv_label_create(cont_speed);
|
||||
lv_label_set_text(lb_speed, "Speed : ");
|
||||
lv_obj_t * slider_speed = lv_slider_create(cont_speed);
|
||||
lv_obj_set_width(slider_speed, lv_pct(100));
|
||||
lv_slider_set_value(slider_speed, 80, LV_ANIM_OFF);
|
||||
|
||||
/* footer */
|
||||
lv_obj_t * apply_button = lv_msgbox_add_footer_button(setting, "Apply");
|
||||
lv_obj_set_flex_grow(apply_button, 1);
|
||||
|
||||
lv_obj_t * cancel_button = lv_msgbox_add_footer_button(setting, "Cancel");
|
||||
lv_obj_set_flex_grow(cancel_button, 1);
|
||||
|
||||
lv_obj_t * footer = lv_msgbox_get_footer(setting);
|
||||
lv_obj_set_style_bg_color(footer, lv_palette_main(LV_PALETTE_INDIGO), 0);
|
||||
lv_obj_set_style_bg_opa(footer, LV_OPA_100, 0);
|
||||
}
|
||||
#endif
|
||||
13
libraries/lvgl/examples/widgets/obj/index.rst
Normal file
13
libraries/lvgl/examples/widgets/obj/index.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
Base objects with custom styles
|
||||
-------------------------------
|
||||
|
||||
.. lv_example:: widgets/obj/lv_example_obj_1
|
||||
:language: c
|
||||
|
||||
Make an object draggable
|
||||
------------------------
|
||||
|
||||
.. lv_example:: widgets/obj/lv_example_obj_2
|
||||
:language: c
|
||||
|
||||
22
libraries/lvgl/examples/widgets/obj/lv_example_obj_1.c
Normal file
22
libraries/lvgl/examples/widgets/obj/lv_example_obj_1.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES
|
||||
|
||||
void lv_example_obj_1(void)
|
||||
{
|
||||
lv_obj_t * obj1;
|
||||
obj1 = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(obj1, 100, 50);
|
||||
lv_obj_align(obj1, LV_ALIGN_CENTER, -60, -30);
|
||||
|
||||
static lv_style_t style_shadow;
|
||||
lv_style_init(&style_shadow);
|
||||
lv_style_set_shadow_width(&style_shadow, 10);
|
||||
lv_style_set_shadow_spread(&style_shadow, 5);
|
||||
lv_style_set_shadow_color(&style_shadow, lv_palette_main(LV_PALETTE_BLUE));
|
||||
|
||||
lv_obj_t * obj2;
|
||||
obj2 = lv_obj_create(lv_screen_active());
|
||||
lv_obj_add_style(obj2, &style_shadow, 0);
|
||||
lv_obj_align(obj2, LV_ALIGN_CENTER, 60, 30);
|
||||
}
|
||||
#endif
|
||||
34
libraries/lvgl/examples/widgets/obj/lv_example_obj_2.c
Normal file
34
libraries/lvgl/examples/widgets/obj/lv_example_obj_2.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES
|
||||
|
||||
static void drag_event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev == NULL) return;
|
||||
|
||||
lv_point_t vect;
|
||||
lv_indev_get_vect(indev, &vect);
|
||||
|
||||
int32_t x = lv_obj_get_x_aligned(obj) + vect.x;
|
||||
int32_t y = lv_obj_get_y_aligned(obj) + vect.y;
|
||||
lv_obj_set_pos(obj, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an object draggable.
|
||||
*/
|
||||
void lv_example_obj_2(void)
|
||||
{
|
||||
lv_obj_t * obj;
|
||||
obj = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(obj, 150, 100);
|
||||
lv_obj_add_event_cb(obj, drag_event_handler, LV_EVENT_PRESSING, NULL);
|
||||
|
||||
lv_obj_t * label = lv_label_create(obj);
|
||||
lv_label_set_text(label, "Drag me");
|
||||
lv_obj_center(label);
|
||||
|
||||
}
|
||||
#endif
|
||||
19
libraries/lvgl/examples/widgets/roller/index.rst
Normal file
19
libraries/lvgl/examples/widgets/roller/index.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
Simple Roller
|
||||
-------------
|
||||
|
||||
.. lv_example:: widgets/roller/lv_example_roller_1
|
||||
:language: c
|
||||
|
||||
Styling the roller
|
||||
------------------
|
||||
|
||||
.. lv_example:: widgets/roller/lv_example_roller_2
|
||||
:language: c
|
||||
|
||||
add fade mask to roller
|
||||
-----------------------
|
||||
|
||||
.. lv_example:: widgets/roller/lv_example_roller_3
|
||||
:language: c
|
||||
|
||||
41
libraries/lvgl/examples/widgets/roller/lv_example_roller_1.c
Normal file
41
libraries/lvgl/examples/widgets/roller/lv_example_roller_1.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_ROLLER && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
char buf[32];
|
||||
lv_roller_get_selected_str(obj, buf, sizeof(buf));
|
||||
LV_LOG_USER("Selected month: %s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An infinite roller with the name of the months
|
||||
*/
|
||||
void lv_example_roller_1(void)
|
||||
{
|
||||
lv_obj_t * roller1 = lv_roller_create(lv_screen_active());
|
||||
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_center(roller1);
|
||||
lv_obj_add_event_cb(roller1, event_handler, LV_EVENT_ALL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
66
libraries/lvgl/examples/widgets/roller/lv_example_roller_2.c
Normal file
66
libraries/lvgl/examples/widgets/roller/lv_example_roller_2.c
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_ROLLER && LV_FONT_MONTSERRAT_22 && LV_BUILD_EXAMPLES
|
||||
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
char buf[32];
|
||||
lv_roller_get_selected_str(obj, buf, sizeof(buf));
|
||||
LV_LOG_USER("Selected value: %s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Roller with various alignments and larger text in the selected area
|
||||
*/
|
||||
void lv_example_roller_2(void)
|
||||
{
|
||||
/*A style to make the selected option larger*/
|
||||
static lv_style_t style_sel;
|
||||
lv_style_init(&style_sel);
|
||||
lv_style_set_text_font(&style_sel, &lv_font_montserrat_22);
|
||||
lv_style_set_bg_color(&style_sel, lv_color_hex3(0xf88));
|
||||
lv_style_set_border_width(&style_sel, 2);
|
||||
lv_style_set_border_color(&style_sel, lv_color_hex3(0xf00));
|
||||
|
||||
const char * opts = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10";
|
||||
lv_obj_t * roller;
|
||||
|
||||
/*A roller on the left with left aligned text, and custom width*/
|
||||
roller = lv_roller_create(lv_screen_active());
|
||||
lv_roller_set_options(roller, opts, LV_ROLLER_MODE_NORMAL);
|
||||
lv_roller_set_visible_row_count(roller, 2);
|
||||
lv_obj_set_width(roller, 100);
|
||||
lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED);
|
||||
lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_LEFT, 0);
|
||||
lv_obj_set_style_bg_color(roller, lv_color_hex3(0x0f0), 0);
|
||||
lv_obj_set_style_bg_grad_color(roller, lv_color_hex3(0xafa), 0);
|
||||
lv_obj_set_style_bg_grad_dir(roller, LV_GRAD_DIR_VER, 0);
|
||||
lv_obj_align(roller, LV_ALIGN_LEFT_MID, 10, 0);
|
||||
lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL);
|
||||
lv_roller_set_selected(roller, 2, LV_ANIM_OFF);
|
||||
|
||||
/*A roller on the middle with center aligned text, and auto (default) width*/
|
||||
roller = lv_roller_create(lv_screen_active());
|
||||
lv_roller_set_options(roller, opts, LV_ROLLER_MODE_NORMAL);
|
||||
lv_roller_set_visible_row_count(roller, 3);
|
||||
lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED);
|
||||
lv_obj_align(roller, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL);
|
||||
lv_roller_set_selected(roller, 5, LV_ANIM_OFF);
|
||||
|
||||
/*A roller on the right with right aligned text, and custom width*/
|
||||
roller = lv_roller_create(lv_screen_active());
|
||||
lv_roller_set_options(roller, opts, LV_ROLLER_MODE_NORMAL);
|
||||
lv_roller_set_visible_row_count(roller, 4);
|
||||
lv_obj_set_width(roller, 80);
|
||||
lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED);
|
||||
lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_RIGHT, 0);
|
||||
lv_obj_align(roller, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL);
|
||||
lv_roller_set_selected(roller, 8, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
#endif
|
||||
82
libraries/lvgl/examples/widgets/roller/lv_example_roller_3.c
Normal file
82
libraries/lvgl/examples/widgets/roller/lv_example_roller_3.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_ROLLER && LV_DRAW_SW_COMPLEX && LV_BUILD_EXAMPLES && 1
|
||||
|
||||
static void generate_mask(lv_draw_buf_t * mask)
|
||||
{
|
||||
/*Create a "8 bit alpha" canvas and clear it*/
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
lv_canvas_set_draw_buf(canvas, mask);
|
||||
lv_canvas_fill_bg(canvas, lv_color_white(), LV_OPA_TRANSP);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
/*Draw a label to the canvas. The result "image" will be used as mask*/
|
||||
lv_draw_rect_dsc_t rect_dsc;
|
||||
lv_draw_rect_dsc_init(&rect_dsc);
|
||||
rect_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
|
||||
rect_dsc.bg_grad.stops[0].color = lv_color_black();
|
||||
rect_dsc.bg_grad.stops[1].color = lv_color_white();
|
||||
rect_dsc.bg_grad.stops[0].opa = LV_OPA_COVER;
|
||||
rect_dsc.bg_grad.stops[1].opa = LV_OPA_COVER;
|
||||
lv_area_t a = {0, 0, mask->header.w - 1, mask->header.h / 2 - 10};
|
||||
lv_draw_rect(&layer, &rect_dsc, &a);
|
||||
|
||||
a.y1 = mask->header.h / 2 + 10;
|
||||
a.y2 = mask->header.h - 1;
|
||||
rect_dsc.bg_grad.stops[0].color = lv_color_white();
|
||||
rect_dsc.bg_grad.stops[1].color = lv_color_black();
|
||||
lv_draw_rect(&layer, &rect_dsc, &a);
|
||||
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
/*Comment it to make the mask visible*/
|
||||
lv_obj_delete(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a fade mask to roller.
|
||||
*/
|
||||
void lv_example_roller_3(void)
|
||||
{
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_palette_main(LV_PALETTE_BLUE_GREY), 0);
|
||||
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_bg_color(&style, lv_color_black());
|
||||
lv_style_set_text_color(&style, lv_color_white());
|
||||
lv_style_set_border_width(&style, 0);
|
||||
lv_style_set_radius(&style, 0);
|
||||
|
||||
lv_obj_t * roller1 = lv_roller_create(lv_screen_active());
|
||||
lv_obj_add_style(roller1, &style, 0);
|
||||
lv_obj_set_style_bg_opa(roller1, LV_OPA_50, LV_PART_SELECTED);
|
||||
|
||||
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_NORMAL);
|
||||
|
||||
lv_obj_center(roller1);
|
||||
lv_roller_set_visible_row_count(roller1, 4);
|
||||
|
||||
/* Create the mask to make the top and bottom part of roller faded.
|
||||
* The width and height are empirical values for simplicity*/
|
||||
LV_DRAW_BUF_DEFINE_STATIC(mask, 130, 150, LV_COLOR_FORMAT_L8);
|
||||
LV_DRAW_BUF_INIT_STATIC(mask);
|
||||
|
||||
generate_mask(&mask);
|
||||
lv_obj_set_style_bitmap_mask_src(roller1, &mask, 0);
|
||||
}
|
||||
#endif
|
||||
42
libraries/lvgl/examples/widgets/scale/index.rst
Normal file
42
libraries/lvgl/examples/widgets/scale/index.rst
Normal file
@@ -0,0 +1,42 @@
|
||||
A simple horizontal scale
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_1
|
||||
:language: c
|
||||
|
||||
An vertical scale with section and custom styling
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_2
|
||||
:language: c
|
||||
|
||||
A simple round scale
|
||||
""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_3
|
||||
:language: c
|
||||
|
||||
A round scale with section and custom styling
|
||||
"""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_4
|
||||
:language: c
|
||||
|
||||
An scale with section and custom styling
|
||||
""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_5
|
||||
:language: c
|
||||
|
||||
A round scale with multiple needles, resembling a clock
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_6
|
||||
:language: c
|
||||
|
||||
Customizing scale major tick label color with `LV_EVENT_DRAW_TASK_ADDED` event
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/scale/lv_example_scale_7
|
||||
:language: c
|
||||
|
||||
24
libraries/lvgl/examples/widgets/scale/lv_example_scale_1.c
Normal file
24
libraries/lvgl/examples/widgets/scale/lv_example_scale_1.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* A simple horizontal scale
|
||||
*/
|
||||
void lv_example_scale_1(void)
|
||||
{
|
||||
lv_obj_t * scale = lv_scale_create(lv_screen_active());
|
||||
lv_obj_set_size(scale, lv_pct(80), 100);
|
||||
lv_scale_set_mode(scale, LV_SCALE_MODE_HORIZONTAL_BOTTOM);
|
||||
lv_obj_center(scale);
|
||||
|
||||
lv_scale_set_label_show(scale, true);
|
||||
|
||||
lv_scale_set_total_tick_count(scale, 31);
|
||||
lv_scale_set_major_tick_every(scale, 5);
|
||||
|
||||
lv_obj_set_style_length(scale, 5, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 10, LV_PART_INDICATOR);
|
||||
lv_scale_set_range(scale, 10, 40);
|
||||
}
|
||||
|
||||
#endif
|
||||
89
libraries/lvgl/examples/widgets/scale/lv_example_scale_2.c
Normal file
89
libraries/lvgl/examples/widgets/scale/lv_example_scale_2.c
Normal file
@@ -0,0 +1,89 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* An vertical scale with section and custom styling
|
||||
*/
|
||||
void lv_example_scale_2(void)
|
||||
{
|
||||
lv_obj_t * scale = lv_scale_create(lv_screen_active());
|
||||
lv_obj_set_size(scale, 60, 200);
|
||||
lv_scale_set_label_show(scale, true);
|
||||
lv_scale_set_mode(scale, LV_SCALE_MODE_VERTICAL_RIGHT);
|
||||
lv_obj_center(scale);
|
||||
|
||||
lv_scale_set_total_tick_count(scale, 21);
|
||||
lv_scale_set_major_tick_every(scale, 5);
|
||||
|
||||
lv_obj_set_style_length(scale, 10, LV_PART_INDICATOR);
|
||||
lv_obj_set_style_length(scale, 5, LV_PART_ITEMS);
|
||||
lv_scale_set_range(scale, 0, 100);
|
||||
|
||||
static const char * custom_labels[] = {"0 °C", "25 °C", "50 °C", "75 °C", "100 °C", NULL};
|
||||
lv_scale_set_text_src(scale, custom_labels);
|
||||
|
||||
static lv_style_t indicator_style;
|
||||
lv_style_init(&indicator_style);
|
||||
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(&indicator_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
|
||||
/* Major tick properties */
|
||||
lv_style_set_line_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
lv_style_set_width(&indicator_style, 10U); /*Tick length*/
|
||||
lv_style_set_line_width(&indicator_style, 2U); /*Tick width*/
|
||||
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
|
||||
|
||||
static lv_style_t minor_ticks_style;
|
||||
lv_style_init(&minor_ticks_style);
|
||||
lv_style_set_line_color(&minor_ticks_style, lv_palette_lighten(LV_PALETTE_BLUE, 2));
|
||||
lv_style_set_width(&minor_ticks_style, 5U); /*Tick length*/
|
||||
lv_style_set_line_width(&minor_ticks_style, 2U); /*Tick width*/
|
||||
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
|
||||
|
||||
static lv_style_t main_line_style;
|
||||
lv_style_init(&main_line_style);
|
||||
/* Main line properties */
|
||||
lv_style_set_line_color(&main_line_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
lv_style_set_line_width(&main_line_style, 2U); // Tick width
|
||||
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
|
||||
|
||||
/* Add a section */
|
||||
static lv_style_t section_minor_tick_style;
|
||||
static lv_style_t section_label_style;
|
||||
static lv_style_t section_main_line_style;
|
||||
|
||||
lv_style_init(§ion_label_style);
|
||||
lv_style_init(§ion_minor_tick_style);
|
||||
lv_style_init(§ion_main_line_style);
|
||||
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(§ion_label_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(§ion_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
|
||||
lv_style_set_line_color(§ion_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
lv_style_set_line_width(§ion_label_style, 5U); /*Tick width*/
|
||||
|
||||
lv_style_set_line_color(§ion_minor_tick_style, lv_palette_lighten(LV_PALETTE_RED, 2));
|
||||
lv_style_set_line_width(§ion_minor_tick_style, 4U); /*Tick width*/
|
||||
|
||||
/* Main line properties */
|
||||
lv_style_set_line_color(§ion_main_line_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
lv_style_set_line_width(§ion_main_line_style, 4U); /*Tick width*/
|
||||
|
||||
/* Configure section styles */
|
||||
lv_scale_section_t * section = lv_scale_add_section(scale);
|
||||
lv_scale_section_set_range(section, 75, 100);
|
||||
lv_scale_section_set_style(section, LV_PART_INDICATOR, §ion_label_style);
|
||||
lv_scale_section_set_style(section, LV_PART_ITEMS, §ion_minor_tick_style);
|
||||
lv_scale_section_set_style(section, LV_PART_MAIN, §ion_main_line_style);
|
||||
|
||||
lv_obj_set_style_bg_color(scale, lv_palette_main(LV_PALETTE_BLUE_GREY), 0);
|
||||
lv_obj_set_style_bg_opa(scale, LV_OPA_50, 0);
|
||||
lv_obj_set_style_pad_left(scale, 8, 0);
|
||||
lv_obj_set_style_radius(scale, 8, 0);
|
||||
lv_obj_set_style_pad_ver(scale, 20, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
100
libraries/lvgl/examples/widgets/scale/lv_example_scale_3.c
Normal file
100
libraries/lvgl/examples/widgets/scale/lv_example_scale_3.c
Normal file
@@ -0,0 +1,100 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
|
||||
|
||||
LV_IMAGE_DECLARE(img_hand);
|
||||
|
||||
lv_obj_t * needle_line;
|
||||
lv_obj_t * needle_img;
|
||||
|
||||
static void set_needle_line_value(void * obj, int32_t v)
|
||||
{
|
||||
lv_scale_set_line_needle_value(obj, needle_line, 60, v);
|
||||
}
|
||||
|
||||
static void set_needle_img_value(void * obj, int32_t v)
|
||||
{
|
||||
lv_scale_set_image_needle_value(obj, needle_img, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple round scale
|
||||
*/
|
||||
void lv_example_scale_3(void)
|
||||
{
|
||||
lv_obj_t * scale_line = lv_scale_create(lv_screen_active());
|
||||
|
||||
lv_obj_set_size(scale_line, 150, 150);
|
||||
lv_scale_set_mode(scale_line, LV_SCALE_MODE_ROUND_INNER);
|
||||
lv_obj_set_style_bg_opa(scale_line, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_bg_color(scale_line, lv_palette_lighten(LV_PALETTE_RED, 5), 0);
|
||||
lv_obj_set_style_radius(scale_line, LV_RADIUS_CIRCLE, 0);
|
||||
lv_obj_set_style_clip_corner(scale_line, true, 0);
|
||||
lv_obj_align(scale_line, LV_ALIGN_LEFT_MID, LV_PCT(2), 0);
|
||||
|
||||
lv_scale_set_label_show(scale_line, true);
|
||||
|
||||
lv_scale_set_total_tick_count(scale_line, 31);
|
||||
lv_scale_set_major_tick_every(scale_line, 5);
|
||||
|
||||
lv_obj_set_style_length(scale_line, 5, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale_line, 10, LV_PART_INDICATOR);
|
||||
lv_scale_set_range(scale_line, 10, 40);
|
||||
|
||||
lv_scale_set_angle_range(scale_line, 270);
|
||||
lv_scale_set_rotation(scale_line, 135);
|
||||
|
||||
needle_line = lv_line_create(scale_line);
|
||||
|
||||
lv_obj_set_style_line_width(needle_line, 6, LV_PART_MAIN);
|
||||
lv_obj_set_style_line_rounded(needle_line, true, LV_PART_MAIN);
|
||||
|
||||
lv_anim_t anim_scale_line;
|
||||
lv_anim_init(&anim_scale_line);
|
||||
lv_anim_set_var(&anim_scale_line, scale_line);
|
||||
lv_anim_set_exec_cb(&anim_scale_line, set_needle_line_value);
|
||||
lv_anim_set_duration(&anim_scale_line, 1000);
|
||||
lv_anim_set_repeat_count(&anim_scale_line, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_playback_duration(&anim_scale_line, 1000);
|
||||
lv_anim_set_values(&anim_scale_line, 10, 40);
|
||||
lv_anim_start(&anim_scale_line);
|
||||
|
||||
lv_obj_t * scale_img = lv_scale_create(lv_screen_active());
|
||||
|
||||
lv_obj_set_size(scale_img, 150, 150);
|
||||
lv_scale_set_mode(scale_img, LV_SCALE_MODE_ROUND_INNER);
|
||||
lv_obj_set_style_bg_opa(scale_img, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_bg_color(scale_img, lv_palette_lighten(LV_PALETTE_RED, 5), 0);
|
||||
lv_obj_set_style_radius(scale_img, LV_RADIUS_CIRCLE, 0);
|
||||
lv_obj_set_style_clip_corner(scale_img, true, 0);
|
||||
lv_obj_align(scale_img, LV_ALIGN_RIGHT_MID, LV_PCT(-2), 0);
|
||||
|
||||
lv_scale_set_label_show(scale_img, true);
|
||||
|
||||
lv_scale_set_total_tick_count(scale_img, 31);
|
||||
lv_scale_set_major_tick_every(scale_img, 5);
|
||||
|
||||
lv_obj_set_style_length(scale_img, 5, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale_img, 10, LV_PART_INDICATOR);
|
||||
lv_scale_set_range(scale_img, 10, 40);
|
||||
|
||||
lv_scale_set_angle_range(scale_img, 270);
|
||||
lv_scale_set_rotation(scale_img, 135);
|
||||
|
||||
/* image must point to the right. E.g. -O------>*/
|
||||
needle_img = lv_image_create(scale_img);
|
||||
lv_image_set_src(needle_img, &img_hand);
|
||||
lv_obj_align(needle_img, LV_ALIGN_CENTER, 47, -2);
|
||||
lv_image_set_pivot(needle_img, 3, 4);
|
||||
|
||||
lv_anim_t anim_scale_img;
|
||||
lv_anim_init(&anim_scale_img);
|
||||
lv_anim_set_var(&anim_scale_img, scale_img);
|
||||
lv_anim_set_exec_cb(&anim_scale_img, set_needle_img_value);
|
||||
lv_anim_set_duration(&anim_scale_img, 1000);
|
||||
lv_anim_set_repeat_count(&anim_scale_img, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_playback_duration(&anim_scale_img, 1000);
|
||||
lv_anim_set_values(&anim_scale_img, 10, 40);
|
||||
lv_anim_start(&anim_scale_img);
|
||||
}
|
||||
|
||||
#endif
|
||||
83
libraries/lvgl/examples/widgets/scale/lv_example_scale_4.c
Normal file
83
libraries/lvgl/examples/widgets/scale/lv_example_scale_4.c
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* A round scale with section and custom styling
|
||||
*/
|
||||
void lv_example_scale_4(void)
|
||||
{
|
||||
lv_obj_t * scale = lv_scale_create(lv_screen_active());
|
||||
lv_obj_set_size(scale, 150, 150);
|
||||
lv_scale_set_label_show(scale, true);
|
||||
lv_scale_set_mode(scale, LV_SCALE_MODE_ROUND_OUTER);
|
||||
lv_obj_center(scale);
|
||||
|
||||
lv_scale_set_total_tick_count(scale, 21);
|
||||
lv_scale_set_major_tick_every(scale, 5);
|
||||
|
||||
lv_obj_set_style_length(scale, 5, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 10, LV_PART_INDICATOR);
|
||||
lv_scale_set_range(scale, 0, 100);
|
||||
|
||||
static const char * custom_labels[] = {"0 °C", "25 °C", "50 °C", "75 °C", "100 °C", NULL};
|
||||
lv_scale_set_text_src(scale, custom_labels);
|
||||
|
||||
static lv_style_t indicator_style;
|
||||
lv_style_init(&indicator_style);
|
||||
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(&indicator_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
|
||||
/* Major tick properties */
|
||||
lv_style_set_line_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
lv_style_set_width(&indicator_style, 10U); /*Tick length*/
|
||||
lv_style_set_line_width(&indicator_style, 2U); /*Tick width*/
|
||||
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
|
||||
|
||||
static lv_style_t minor_ticks_style;
|
||||
lv_style_init(&minor_ticks_style);
|
||||
lv_style_set_line_color(&minor_ticks_style, lv_palette_lighten(LV_PALETTE_BLUE, 2));
|
||||
lv_style_set_width(&minor_ticks_style, 5U); /*Tick length*/
|
||||
lv_style_set_line_width(&minor_ticks_style, 2U); /*Tick width*/
|
||||
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
|
||||
|
||||
static lv_style_t main_line_style;
|
||||
lv_style_init(&main_line_style);
|
||||
/* Main line properties */
|
||||
lv_style_set_arc_color(&main_line_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
|
||||
lv_style_set_arc_width(&main_line_style, 2U); /*Tick width*/
|
||||
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
|
||||
|
||||
/* Add a section */
|
||||
static lv_style_t section_minor_tick_style;
|
||||
static lv_style_t section_label_style;
|
||||
static lv_style_t section_main_line_style;
|
||||
|
||||
lv_style_init(§ion_label_style);
|
||||
lv_style_init(§ion_minor_tick_style);
|
||||
lv_style_init(§ion_main_line_style);
|
||||
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(§ion_label_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(§ion_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
|
||||
lv_style_set_line_color(§ion_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
lv_style_set_line_width(§ion_label_style, 5U); /*Tick width*/
|
||||
|
||||
lv_style_set_line_color(§ion_minor_tick_style, lv_palette_lighten(LV_PALETTE_RED, 2));
|
||||
lv_style_set_line_width(§ion_minor_tick_style, 4U); /*Tick width*/
|
||||
|
||||
/* Main line properties */
|
||||
lv_style_set_arc_color(§ion_main_line_style, lv_palette_darken(LV_PALETTE_RED, 3));
|
||||
lv_style_set_arc_width(§ion_main_line_style, 4U); /*Tick width*/
|
||||
|
||||
/* Configure section styles */
|
||||
lv_scale_section_t * section = lv_scale_add_section(scale);
|
||||
lv_scale_section_set_range(section, 75, 100);
|
||||
lv_scale_section_set_style(section, LV_PART_INDICATOR, §ion_label_style);
|
||||
lv_scale_section_set_style(section, LV_PART_ITEMS, §ion_minor_tick_style);
|
||||
lv_scale_section_set_style(section, LV_PART_MAIN, §ion_main_line_style);
|
||||
}
|
||||
|
||||
#endif
|
||||
78
libraries/lvgl/examples/widgets/scale/lv_example_scale_5.c
Normal file
78
libraries/lvgl/examples/widgets/scale/lv_example_scale_5.c
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* An scale with section and custom styling
|
||||
*/
|
||||
void lv_example_scale_5(void)
|
||||
{
|
||||
lv_obj_t * scale = lv_scale_create(lv_screen_active());
|
||||
lv_obj_set_size(scale, lv_display_get_horizontal_resolution(NULL) / 2, lv_display_get_vertical_resolution(NULL) / 2);
|
||||
lv_scale_set_label_show(scale, true);
|
||||
|
||||
lv_scale_set_total_tick_count(scale, 10);
|
||||
lv_scale_set_major_tick_every(scale, 5);
|
||||
|
||||
lv_obj_set_style_length(scale, 5, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 10, LV_PART_INDICATOR);
|
||||
lv_scale_set_range(scale, 25, 35);
|
||||
|
||||
static const char * custom_labels[3] = {"One", "Two", NULL};
|
||||
lv_scale_set_text_src(scale, custom_labels);
|
||||
|
||||
static lv_style_t indicator_style;
|
||||
lv_style_init(&indicator_style);
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(&indicator_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(&indicator_style, lv_color_hex(0xff00ff));
|
||||
/* Major tick properties */
|
||||
lv_style_set_line_color(&indicator_style, lv_color_hex(0x00ff00));
|
||||
lv_style_set_width(&indicator_style, 10U); // Tick length
|
||||
lv_style_set_line_width(&indicator_style, 2U); // Tick width
|
||||
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
|
||||
|
||||
static lv_style_t minor_ticks_style;
|
||||
lv_style_init(&minor_ticks_style);
|
||||
lv_style_set_line_color(&minor_ticks_style, lv_color_hex(0xff0000));
|
||||
lv_style_set_width(&minor_ticks_style, 5U); // Tick length
|
||||
lv_style_set_line_width(&minor_ticks_style, 2U); // Tick width
|
||||
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
|
||||
|
||||
static lv_style_t main_line_style;
|
||||
lv_style_init(&main_line_style);
|
||||
/* Main line properties */
|
||||
lv_style_set_line_color(&main_line_style, lv_color_hex(0x0000ff));
|
||||
lv_style_set_line_width(&main_line_style, 2U); // Tick width
|
||||
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
|
||||
|
||||
lv_obj_center(scale);
|
||||
|
||||
/* Add a section */
|
||||
static lv_style_t section_minor_tick_style;
|
||||
static lv_style_t section_label_style;
|
||||
|
||||
lv_style_init(§ion_label_style);
|
||||
lv_style_init(§ion_minor_tick_style);
|
||||
|
||||
/* Label style properties */
|
||||
lv_style_set_text_font(§ion_label_style, LV_FONT_DEFAULT);
|
||||
lv_style_set_text_color(§ion_label_style, lv_color_hex(0xff0000));
|
||||
lv_style_set_text_letter_space(§ion_label_style, 10);
|
||||
lv_style_set_text_opa(§ion_label_style, LV_OPA_50);
|
||||
|
||||
lv_style_set_line_color(§ion_label_style, lv_color_hex(0xff0000));
|
||||
// lv_style_set_width(§ion_label_style, 20U); // Tick length
|
||||
lv_style_set_line_width(§ion_label_style, 5U); // Tick width
|
||||
|
||||
lv_style_set_line_color(§ion_minor_tick_style, lv_color_hex(0x0000ff));
|
||||
// lv_style_set_width(§ion_label_style, 20U); // Tick length
|
||||
lv_style_set_line_width(§ion_minor_tick_style, 4U); // Tick width
|
||||
|
||||
/* Configure section styles */
|
||||
lv_scale_section_t * section = lv_scale_add_section(scale);
|
||||
lv_scale_section_set_range(section, 25, 30);
|
||||
lv_scale_section_set_style(section, LV_PART_INDICATOR, §ion_label_style);
|
||||
lv_scale_section_set_style(section, LV_PART_ITEMS, §ion_minor_tick_style);
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user