minor fixes
This commit is contained in:
@@ -203,7 +203,7 @@ lv_color_t color = lv_obj_get_style_bg_color(btn, LV_PART_MAIN);
|
||||
Besides "normal" styles, the objects can store local styles too. This concept is similar to inline styles in CSS (e.g. `<div style="color:red">`) with some modification.
|
||||
|
||||
So local styles are like normal styles but they can't be shared among other objects. If used, local styles are allocated automatically, and freed when the object is deleted.
|
||||
They are usuful to add local customization to the object.
|
||||
They are useful to add local customization to the object.
|
||||
|
||||
Unlike in CSS, in LVGL local styles can be assigned to states (*pseudo-classes*) and parts (pseudo-elements).
|
||||
|
||||
|
||||
43
examples/layouts/flex/index.rst
Normal file
43
examples/layouts/flex/index.rst
Normal file
@@ -0,0 +1,43 @@
|
||||
C
|
||||
^
|
||||
A simple row and a column layout with flexbox
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_1
|
||||
:language: c
|
||||
|
||||
Arrange items in rows with wrap and even spacing
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_2
|
||||
:language: c
|
||||
|
||||
Demonstrate flex grow
|
||||
"""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_3
|
||||
:language: c
|
||||
|
||||
Demonstrate flex grow.
|
||||
"""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_4
|
||||
:language: c
|
||||
|
||||
Demonstrate column and row gap style properties
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_5
|
||||
:language: c
|
||||
|
||||
RTL base direction changes order of the items
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_flex_6
|
||||
:language: c
|
||||
|
||||
|
||||
MicroPython
|
||||
^^^^^^^^^^^
|
||||
|
||||
No examples yet.
|
||||
43
examples/layouts/grid/index.rst
Normal file
43
examples/layouts/grid/index.rst
Normal file
@@ -0,0 +1,43 @@
|
||||
C
|
||||
^
|
||||
A simple grid
|
||||
"""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_1
|
||||
:language: c
|
||||
|
||||
Demonstrate cell placement and span
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_2
|
||||
:language: c
|
||||
|
||||
Demonstrate grid's "free unit"
|
||||
""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_3
|
||||
:language: c
|
||||
|
||||
Demonstrate track placement
|
||||
"""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_4
|
||||
:language: c
|
||||
|
||||
Demonstrate column and row gap
|
||||
""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_5
|
||||
:language: c
|
||||
|
||||
Demonstrate RTL direction on grid
|
||||
""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: layouts/fley/lv_example_grid_6
|
||||
:language: c
|
||||
|
||||
|
||||
MicroPython
|
||||
^^^^^^^^^^^
|
||||
|
||||
No examples yet.
|
||||
@@ -76,8 +76,8 @@ lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
|
||||
lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN;
|
||||
lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
|
||||
lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_POS;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_SPAN;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN;
|
||||
@@ -107,8 +107,8 @@ void lv_grid_init(void)
|
||||
|
||||
LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_ROW_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_COL_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_COL_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_COLUMN_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_COLUMN_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_X_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_CELL_Y_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_SPAN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN;
|
||||
@@ -134,7 +134,7 @@ static inline void lv_style_set_grid_cell_column_pos(lv_style_t * style, lv_coor
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_CELL_COL_POS, v);
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_CELL_COLUMN_POS, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value)
|
||||
@@ -142,7 +142,7 @@ static inline void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coo
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_CELL_COL_SPAN, v);
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_CELL_COLUMN_SPAN, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_grid_cell_row_pos(lv_style_t * style, lv_coord_t value)
|
||||
@@ -216,7 +216,7 @@ static inline void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, lv_coor
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COL_POS, v, selector);
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COLUMN_POS, v, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@@ -224,7 +224,7 @@ static inline void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coo
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COL_SPAN, v, selector);
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COLUMN_SPAN, v, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@@ -285,13 +285,13 @@ static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _l
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COL_POS);
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COL_SPAN);
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,6 +1046,7 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
p1.y = cursor->dir & LV_DIR_TOP ? obj->coords.y1 : cy;
|
||||
p2.x = p1.x;
|
||||
p2.y = cursor->dir & LV_DIR_BOTTOM ? obj->coords.y2 : cy;
|
||||
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &dsc);
|
||||
lv_draw_line(&p1, &p2, clip_area, &line_dsc_tmp);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc);
|
||||
@@ -1106,10 +1107,6 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
minor_len *= -1;
|
||||
}
|
||||
|
||||
lv_obj_draw_part_dsc_t dsc;
|
||||
lv_obj_draw_dsc_init(&dsc, clip_area);
|
||||
dsc.id = axis;
|
||||
dsc.part = LV_PART_TICKS;
|
||||
|
||||
lv_draw_line_dsc_t line_dsc;
|
||||
lv_draw_line_dsc_init(&line_dsc);
|
||||
@@ -1119,6 +1116,13 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
lv_obj_init_draw_label_dsc(obj, LV_PART_TICKS, &label_dsc);
|
||||
|
||||
lv_obj_draw_part_dsc_t dsc;
|
||||
lv_obj_draw_dsc_init(&dsc, clip_area);
|
||||
dsc.id = axis;
|
||||
dsc.part = LV_PART_TICKS;
|
||||
dsc.line_dsc = &line_dsc;
|
||||
dsc.label_dsc = &label_dsc;
|
||||
|
||||
uint32_t total_tick_num = (t->major_cnt - 1) * (t->minor_cnt);
|
||||
for(i = 0; i <= total_tick_num; i++) {
|
||||
/*draw a line at moving y position*/
|
||||
@@ -1174,6 +1178,7 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
{
|
||||
lv_draw_label(&a, clip_area, &label_dsc, dsc.text, NULL);
|
||||
}
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1216,6 +1221,8 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
lv_obj_draw_dsc_init(&dsc, clip_area);
|
||||
dsc.id = LV_CHART_AXIS_X;
|
||||
dsc.part = LV_PART_TICKS;
|
||||
dsc.label_dsc = &label_dsc;
|
||||
dsc.line_dsc = &line_dsc;
|
||||
|
||||
/*The columns ticks should be aligned to the center of blocks*/
|
||||
if(chart->type == LV_CHART_TYPE_BAR) {
|
||||
@@ -1266,6 +1273,7 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
{
|
||||
lv_draw_label(&a, clip_area, &label_dsc, dsc.text, NULL);
|
||||
}
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE);
|
||||
enum {
|
||||
LV_CHART_TYPE_NONE = 0x00, /**< Don't draw the series*/
|
||||
LV_CHART_TYPE_LINE = 0x01, /**< Connect the points with lines*/
|
||||
LV_CHART_TYPE_BAR = 0x02, /**< Draw columns*/
|
||||
LV_CHART_TYPE_BAR = 0x02, /**< Draw columns*/
|
||||
};
|
||||
typedef uint8_t lv_chart_type_t;
|
||||
|
||||
@@ -218,7 +218,7 @@ uint16_t lv_chart_get_point_count(const lv_obj_t * obj);
|
||||
uint16_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser);
|
||||
|
||||
/**
|
||||
* Get the position of point of the an index relative to the chart.
|
||||
* Get the position of a point to the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to series
|
||||
* @param id the index.
|
||||
|
||||
Reference in New Issue
Block a user