diff --git a/index.html b/index.html index 4006b30..4d5b62b 100644 --- a/index.html +++ b/index.html @@ -928,7 +928,7 @@
Written for v6.0
Application Your application which creates the GUI and handles the specific tasks.
LittlevGL @@ -1382,7 +1382,7 @@
Setting the //glass style property will prevent inheriting that style//. You should use it if the style is transparent so that its children use colors and others from its parent.
There are several built-in styles in the library:
- +As you can see there is a style for screens, for buttons, plain and pretty styles and transparent styles as well. The lv_style_transp
, lv_style_transp_fit
and lv_style_transp_tight
differ only in paddings: for lv_style_transp_tight
all padings are zero, for lv_style_transp_fit
only hor and ver paddings are zero.
The built in styles are global lv_style_t variables so you can use them like: lv_btn_set_style(obj, LV_BTN_STYLE_REL, &lv_style_btn_rel)
You can modify the built-in styles or you can create new styles. When creating new styles it is recommended to first copy a built-in style to be sure all fields are initialized with a proper value. The lv_style_copy(&dest_style, &src_style) can be used to copy styles.
@@ -1400,7 +1400,7 @@The example below demonstrates the above-described style usage
- +/*Create a style*/
static lv_style_t style1;
lv_style_copy(&style1, &lv_style_plain); /*Copy a built-in style to initialize the new style*/
@@ -1437,7 +1437,7 @@ Style animations
theme.btn.tgl_pr /*Toggled pressed button style*/
theme.btn.ina /*Inactive button style*/
A theme can initialized by: lv_theme_xxx_init(hue, font)
. Where xxx is the name of the theme, hue is a Hue value from HSV color space (0..360) and font is the font applied in the theme (NULL
to use the LV_FONT_DEFAULT
default font)
When a theme is initialized its styles can be used like this:
- +/*Create a default slider*/
lv_obj_t *slider = lv_slider_create(lv_scr_act(), NULL);
lv_slider_set_value(slider, 70);
@@ -1860,7 +1860,7 @@ Notes
/*Create style for the Arcs*/
lv_style_t style;
lv_style_copy(&style, &lv_style_plain);
@@ -1901,7 +1901,7 @@ Notes
/*Create a default bar*/
lv_obj_t * bar1 = lv_bar_create(lv_scr_act(), NULL);
lv_obj_set_size(bar1, 200, 30);
@@ -1956,7 +1956,7 @@ Overview
The object size can be modified with lv_obj_set_width(obj, new_width)
and lv_obj_set_height(obj, new_height)
or in one function with lv_obj_set_size(obj, new_width, new_height)
.
Note that these functions only work for objects with a parent. Screens do not have a parent, and attempting to use these functions will result in undefined behavior.
You can align the object to an other with lv_obj_align(obj1, obj2, LV_ALIGN_TYPE, x_shift, y_shift)
. The last two argument means an x and y shift after the alignment. The second argument is another object on which to align the first (NULL
means: align to the parent). The third argument is the type of alignment:
-
+
The alignment types build like: LV_ALIGN_OUT_TOP_MID
. For example to align a text below an image: lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)
. Or to align a text in the middle of its parent: lv_obj_align(text, NULL, LV_ALIGN_CENTER, 0, 0)
.
You can set a new parent for an object with lv_obj_set_parent(obj, new_parent)
.
To get the children of an object use lv_obj_get_child(obj, child_prev)
(from last to first) or lv_obj_get_child_back(obj, child_prev)
(from first to last). To get the first child pass NULL as the second parameter and then the previous child (return value). The function will return with NULL when there are no more children.
@@ -1999,7 +1999,7 @@ Overview
Style usage
All style.body properties are used. Default for screens _lv_style_plain_ and _lv_style_plain_color_ for normal objects
Example
-
+
/*Create a simple base object*/
lv_obj_t * obj1;
obj1 = lv_obj_create(lv_scr_act(), NULL);
@@ -2064,7 +2064,7 @@ Notes
static lv_res_t btn_click_action(lv_obj_t * btn)
{
uint8_t id = lv_obj_get_free_num(btn);
@@ -2147,7 +2147,7 @@ Notes
/*Called when a button is released ot long pressed*/
static lv_res_t btnm_action(lv_obj_t * btnm, const char *txt)
{
@@ -2233,7 +2233,7 @@ Style usage
body
and text
properties are used to set the style of the today box/*Create a Calendar object*/
lv_obj_t * calendar = lv_calendar_create(lv_scr_act(), NULL);
lv_obj_set_size(calendar, 240, 220);
@@ -2332,7 +2332,7 @@ Style usage
The series related parameters can be set directly for each chart with lv_chart_set_series_width()
, lv_chart_set_series_opa()
and lv_chart_set_series_dark()
.
Example
-
+
/*Create a style for the chart*/
static lv_style_t style;
lv_style_copy(&style, &lv_style_pretty);
@@ -2385,7 +2385,7 @@ Style usage
static lv_res_t cb_release_action(lv_obj_t * cb)
{
/*A check box is clicked*/
@@ -2466,7 +2466,7 @@ Notes
lv_obj_t * box1;
box1 = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_style(box1, &lv_style_pretty);
@@ -2524,7 +2524,7 @@ Style usage
static lv_res_t ddlist_action(lv_obj_t * ddlist)
{
uint8_t id = lv_obj_get_free_num(ddlist);
@@ -2583,7 +2583,7 @@ Style usage
/*Create a style*/
static lv_style_t style;
lv_style_copy(&style, &lv_style_pretty_color);
@@ -2643,7 +2643,7 @@ Notes
/*Declare a cogwheel image variable*/
LV_IMG_DECLARE(img_cw);
@@ -2729,7 +2729,7 @@ Style usage
Notes
Example
-
+
/*Create style to make the button darker when pressed*/
lv_style_t style_pr;
lv_style_copy(&style_pr, &lv_style_plain);
@@ -2787,7 +2787,7 @@ Style usage
/*Create styles for the keyboard*/
static lv_style_t rel_style, pr_style;
@@ -2840,7 +2840,7 @@ Notes
/*Will be called on click of a button of a list*/
static lv_res_t list_release_action(lv_obj_t * list_btn)
{
@@ -2933,7 +2933,7 @@ Notes
/*Create a style for the LED*/
static lv_style_t style_led;
lv_style_copy(&style_led, &lv_style_pretty_color);
@@ -2986,7 +2986,7 @@ Style usage
Notes
Example
-
+
/*Create an array for the points of the line*/
static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} };
@@ -3040,7 +3040,7 @@ Notes
/*******************************
* Create 3 similar line meter
*******************************/
@@ -3149,7 +3149,7 @@ Style usage
Notes
The label's click enable attribute is disabled by default. You can enable clicking with lv_obj_set_click(label, true)
Example
-
+
/*Create label on the screen. By default it will inherit the style of the screen*/
lv_obj_t * title = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(title, "Title Label");
@@ -3197,7 +3197,7 @@ Notes
/*Called when a button is clicked*/
static lv_res_t mbox_apply_action(lv_obj_t * mbox, const char * txt)
{
@@ -3301,7 +3301,7 @@ Notes
/*Create a scroll bar style*/
static lv_style_t style_sb;
lv_style_copy(&style_sb, &lv_style_plain);
@@ -3346,7 +3346,7 @@ Style usage
body.border
properties including body.padding.hor/ver
(smaller is used) to give a smaller radius for the border./*Create a style for the Preloader*/
static lv_style_t style;
lv_style_copy(&style, &lv_style_plain);
@@ -3379,7 +3379,7 @@ Style usage
/*Create a default roller*/
lv_obj_t *roller1 = lv_roller_create(lv_scr_act(), NULL);
lv_roller_set_options(roller1, "Apple\n"
@@ -3455,7 +3455,7 @@ Keys
/*Called when a new value id set on the slider*/
static lv_res_t slider_action(lv_obj_t * slider)
{
@@ -3565,7 +3565,7 @@ Notes
/*Create styles for the switch*/
static lv_style_t bg_style;
static lv_style_t indic_style;
@@ -3629,7 +3629,7 @@ Style usage
Notes
Example
-
+
/*Create a Tab view object*/
lv_obj_t *tabview;
tabview = lv_tabview_create(lv_scr_act(), NULL);
@@ -3699,7 +3699,7 @@ Notes
lv_ta_get_text(ta)
gives the real text and not the asterisk characters/*Create a scroll bar style*/
static lv_style_t style_sb;
lv_style_copy(&style_sb, &lv_style_plain);
@@ -3756,7 +3756,7 @@ Style usage
Notes
Example
-
+
/*Create a scroll bar style*/
static lv_style_t style_sb;
lv_style_copy(&style_sb, &lv_style_plain);