add lv_components as src/extra and minor fixes
This commit is contained in:
48
examples/styles/lv_style_example.h
Normal file
48
examples/styles/lv_style_example.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file lv_ex_widgets.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EX_STYLE_H
|
||||
#define LV_EX_STYLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_ex_style_1(void);
|
||||
void lv_ex_style_2(void);
|
||||
void lv_ex_style_3(void);
|
||||
void lv_ex_style_4(void);
|
||||
void lv_ex_style_5(void);
|
||||
void lv_ex_style_6(void);
|
||||
void lv_ex_style_7(void);
|
||||
void lv_ex_style_8(void);
|
||||
void lv_ex_style_9(void);
|
||||
void lv_ex_style_10(void);
|
||||
void lv_ex_style_11(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_STYLE_H*/
|
||||
28
examples/styles/lv_style_example_1.c
Normal file
28
examples/styles/lv_style_example_1.c
Normal file
@@ -0,0 +1,28 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the background style properties
|
||||
// */
|
||||
//void lv_ex_style_1(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
//
|
||||
// /*Make a gradient*/
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
// lv_style_set_bg_grad_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_bg_grad_dir(&style, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
|
||||
//
|
||||
// /*Shift the gradient to the bottom*/
|
||||
// lv_style_set_bg_main_stop(&style, LV_STATE_DEFAULT, 128);
|
||||
// lv_style_set_bg_grad_stop(&style, LV_STATE_DEFAULT, 192);
|
||||
//
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
35
examples/styles/lv_style_example_10.c
Normal file
35
examples/styles/lv_style_example_10.c
Normal file
@@ -0,0 +1,35 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the transitions style properties
|
||||
// */
|
||||
//void lv_ex_style_10(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Set different background color in pressed state*/
|
||||
// lv_style_set_bg_color(&style, LV_STATE_PRESSED, LV_COLOR_GRAY);
|
||||
//
|
||||
// /*Set different transition time in default and pressed state
|
||||
// *fast press, slower revert to default*/
|
||||
// lv_style_set_transition_time(&style, LV_STATE_DEFAULT, 500);
|
||||
// lv_style_set_transition_time(&style, LV_STATE_PRESSED, 200);
|
||||
//
|
||||
// /*Small delay to make transition more visible*/
|
||||
// lv_style_set_transition_delay(&style, LV_STATE_DEFAULT, 100);
|
||||
//
|
||||
// /*Add `bg_color` to transitioned properties*/
|
||||
// lv_style_set_transition_prop_1(&style, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
36
examples/styles/lv_style_example_11.c
Normal file
36
examples/styles/lv_style_example_11.c
Normal file
@@ -0,0 +1,36 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the scale style properties
|
||||
// */
|
||||
//void lv_ex_style_11(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Set some paddings*/
|
||||
// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 20);
|
||||
// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 5);
|
||||
//
|
||||
// lv_style_set_scale_end_color(&style, LV_STATE_DEFAULT, LV_COLOR_RED);
|
||||
// lv_style_set_line_color(&style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
// lv_style_set_scale_grad_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_line_width(&style, LV_STATE_DEFAULT, 2);
|
||||
// lv_style_set_scale_end_line_width(&style, LV_STATE_DEFAULT, 4);
|
||||
// lv_style_set_scale_end_border_width(&style, LV_STATE_DEFAULT, 4);
|
||||
//
|
||||
// /*Gauge has a needle but for simplicity its style is not initialized here*/
|
||||
//#if LV_USE_GAUGE
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_gauge_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_GAUGE_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//#endif
|
||||
//}
|
||||
//
|
||||
27
examples/styles/lv_style_example_2.c
Normal file
27
examples/styles/lv_style_example_2.c
Normal file
@@ -0,0 +1,27 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the border style properties
|
||||
// */
|
||||
//void lv_ex_style_2(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 20);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Add border to the bottom+right*/
|
||||
// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_border_opa(&style, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
// lv_style_set_border_side(&style, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_RIGHT);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
26
examples/styles/lv_style_example_3.c
Normal file
26
examples/styles/lv_style_example_3.c
Normal file
@@ -0,0 +1,26 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the outline style properties
|
||||
// */
|
||||
//void lv_ex_style_3(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Add outline*/
|
||||
// lv_style_set_outline_width(&style, LV_STATE_DEFAULT, 2);
|
||||
// lv_style_set_outline_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_outline_pad(&style, LV_STATE_DEFAULT, 8);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
27
examples/styles/lv_style_example_4.c
Normal file
27
examples/styles/lv_style_example_4.c
Normal file
@@ -0,0 +1,27 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the Shadow style properties
|
||||
// */
|
||||
//void lv_ex_style_4(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Add a shadow*/
|
||||
// lv_style_set_shadow_width(&style, LV_STATE_DEFAULT, 8);
|
||||
// lv_style_set_shadow_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_shadow_ofs_x(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_shadow_ofs_y(&style, LV_STATE_DEFAULT, 20);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
27
examples/styles/lv_style_example_5.c
Normal file
27
examples/styles/lv_style_example_5.c
Normal file
@@ -0,0 +1,27 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the pattern style properties
|
||||
// */
|
||||
//void lv_ex_style_5(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Add a repeating pattern*/
|
||||
// lv_style_set_pattern_image(&style, LV_STATE_DEFAULT, LV_SYMBOL_OK);
|
||||
// lv_style_set_pattern_recolor(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_pattern_opa(&style, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
// lv_style_set_pattern_repeat(&style, LV_STATE_DEFAULT, true);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
30
examples/styles/lv_style_example_6.c
Normal file
30
examples/styles/lv_style_example_6.c
Normal file
@@ -0,0 +1,30 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the value style properties
|
||||
// */
|
||||
//void lv_ex_style_6(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
//
|
||||
// /*Add a value text properties*/
|
||||
// lv_style_set_value_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_value_align(&style, LV_STATE_DEFAULT, LV_ALIGN_IN_BOTTOM_RIGHT);
|
||||
// lv_style_set_value_ofs_x(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_value_ofs_y(&style, LV_STATE_DEFAULT, 10);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//
|
||||
// /*Add a value text to the local style. This way every object can have different text*/
|
||||
// lv_obj_set_style_local_value_str(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, "Text");
|
||||
//}
|
||||
//
|
||||
34
examples/styles/lv_style_example_7.c
Normal file
34
examples/styles/lv_style_example_7.c
Normal file
@@ -0,0 +1,34 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the text style properties
|
||||
// */
|
||||
//void lv_ex_style_7(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 2);
|
||||
// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
//
|
||||
// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_bottom(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 10);
|
||||
//
|
||||
// lv_style_set_text_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_text_letter_space(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_text_line_space(&style, LV_STATE_DEFAULT, 20);
|
||||
// lv_style_set_text_decor(&style, LV_STATE_DEFAULT, LV_TEXT_DECOR_UNDERLINE);
|
||||
//
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_label_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_LABEL_PART_MAIN, &style);
|
||||
// lv_label_set_text(obj, "Text of\n"
|
||||
// "a label");
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//}
|
||||
//
|
||||
24
examples/styles/lv_style_example_8.c
Normal file
24
examples/styles/lv_style_example_8.c
Normal file
@@ -0,0 +1,24 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the line style properties
|
||||
// */
|
||||
//void lv_ex_style_8(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// lv_style_set_line_color(&style, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||
// lv_style_set_line_width(&style, LV_STATE_DEFAULT, 6);
|
||||
// lv_style_set_line_rounded(&style, LV_STATE_DEFAULT, true);
|
||||
//#if LV_USE_LINE
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_line_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_LINE_PART_MAIN, &style);
|
||||
//
|
||||
// static lv_point_t p[] = {{10, 30}, {30, 50}, {100, 0}};
|
||||
// lv_line_set_points(obj, p, 3);
|
||||
//
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//#endif
|
||||
//}
|
||||
35
examples/styles/lv_style_example_9.c
Normal file
35
examples/styles/lv_style_example_9.c
Normal file
@@ -0,0 +1,35 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Using the image style properties
|
||||
// */
|
||||
//void lv_ex_style_9(void)
|
||||
//{
|
||||
// static lv_style_t style;
|
||||
// lv_style_init(&style);
|
||||
//
|
||||
// /*Set a background color and a radius*/
|
||||
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
|
||||
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
// lv_style_set_border_width(&style, LV_STATE_DEFAULT, 2);
|
||||
// lv_style_set_border_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
//
|
||||
// lv_style_set_pad_top(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_bottom(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_left(&style, LV_STATE_DEFAULT, 10);
|
||||
// lv_style_set_pad_right(&style, LV_STATE_DEFAULT, 10);
|
||||
//
|
||||
// lv_style_set_image_recolor(&style, LV_STATE_DEFAULT, LV_COLOR_BLUE);
|
||||
// lv_style_set_image_recolor_opa(&style, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
//
|
||||
//#if LV_USE_IMG
|
||||
// /*Create an object with the new style*/
|
||||
// lv_obj_t * obj = lv_img_create(lv_scr_act(), NULL);
|
||||
// lv_obj_add_style(obj, LV_IMG_PART_MAIN, &style);
|
||||
// LV_IMG_DECLARE(img_cogwheel_argb);
|
||||
// lv_img_set_src(obj, &img_cogwheel_argb);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//#endif
|
||||
//}
|
||||
//
|
||||
Reference in New Issue
Block a user