refactor: flexbox, btnmatrix, chart refactoring
This commit is contained in:
@@ -63,16 +63,16 @@ void lv_obj_set_flex_dir(lv_obj_t * obj, lv_flex_dir_t flex_dir)
|
||||
_lv_flex_refresh(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t item_place, lv_flex_place_t track_place)
|
||||
void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place)
|
||||
{
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
if(obj->spec_attr->flex_cont.item_place == item_place &&
|
||||
obj->spec_attr->flex_cont.track_place == track_place) {
|
||||
if(obj->spec_attr->flex_cont.main_place == main_place &&
|
||||
obj->spec_attr->flex_cont.cross_place == cross_place) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj->spec_attr->flex_cont.item_place = item_place;
|
||||
obj->spec_attr->flex_cont.track_place = track_place;
|
||||
obj->spec_attr->flex_cont.main_place = main_place;
|
||||
obj->spec_attr->flex_cont.cross_place = cross_place;
|
||||
|
||||
_lv_flex_refresh(obj);
|
||||
}
|
||||
@@ -120,13 +120,13 @@ lv_flex_dir_t lv_obj_get_flex_dir(const lv_obj_t * obj)
|
||||
|
||||
lv_flex_place_t lv_obj_get_flex_item_place(const lv_obj_t * obj)
|
||||
{
|
||||
if(obj->spec_attr) return obj->spec_attr->flex_cont.item_place;
|
||||
if(obj->spec_attr) return obj->spec_attr->flex_cont.main_place;
|
||||
else return LV_FLEX_PLACE_START;
|
||||
}
|
||||
|
||||
lv_flex_place_t lv_obj_get_flex_track_place(const lv_obj_t * obj)
|
||||
{
|
||||
if(obj->spec_attr) return obj->spec_attr->flex_cont.track_place;
|
||||
if(obj->spec_attr) return obj->spec_attr->flex_cont.cross_place;
|
||||
else return LV_FLEX_PLACE_START;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ void _lv_flex_refresh(lv_obj_t * cont)
|
||||
lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_x(cont);
|
||||
|
||||
lv_flex_place_t cross_place = lv_obj_get_flex_track_place(cont);
|
||||
lv_flex_place_t main_place = cont->spec_attr->flex_cont.item_place;
|
||||
lv_flex_place_t main_place = cont->spec_attr->flex_cont.main_place;
|
||||
lv_ll_t * ll = _lv_obj_get_child_ll(cont);
|
||||
lv_coord_t * cross_pos = (row ? &abs_y : &abs_x);
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ typedef struct {
|
||||
uint8_t dir :2;
|
||||
uint8_t wrap :1;
|
||||
uint8_t rev :1;
|
||||
uint8_t item_place :3;
|
||||
uint8_t track_place :3;
|
||||
uint8_t main_place :3;
|
||||
uint8_t cross_place :3;
|
||||
}lv_flex_cont_t;
|
||||
|
||||
/**********************
|
||||
@@ -85,12 +85,19 @@ void lv_obj_set_flex_dir(struct _lv_obj_t * obj, lv_flex_dir_t flex_dir);
|
||||
|
||||
/**
|
||||
* Set how to place the items and the tracks
|
||||
* @param obj point to a flex container
|
||||
* @param item_place tells how to distribute the free space among the items in the same track
|
||||
* @param track_place tells how to distribute the free space among the tracks
|
||||
* @param obj pointer to a flex container
|
||||
* @param main_place tells how to distribute the free space among the items in the same track
|
||||
* @param cross_place tells how to distribute the free space among the tracks
|
||||
* @note if the base direction is RTL and the direction is ROW, LV_FLEX_START means the right side
|
||||
*/
|
||||
void lv_obj_set_flex_place(struct _lv_obj_t * obj, lv_flex_place_t item_place, lv_flex_place_t track_place);
|
||||
void lv_obj_set_flex_place(struct _lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place);
|
||||
|
||||
/**
|
||||
* Set a minimal gap between items in the main direction.
|
||||
* @param obj pointer to a flex container
|
||||
* @param gap the gap in pixels
|
||||
*/
|
||||
void lv_obj_set_flex_gap(struct _lv_obj_t * obj, lv_coord_t gap);
|
||||
|
||||
/**
|
||||
* Make an object flex item, i.e. allow setting it's coordinate according to the parent's flex settings.
|
||||
|
||||
@@ -131,7 +131,7 @@ void lv_obj_report_grid_change(const lv_grid_t * grid)
|
||||
*/
|
||||
void _lv_grid_calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out)
|
||||
{
|
||||
lv_grid_t * g = lv_obj_get_grid(cont);
|
||||
const lv_grid_t * g = lv_obj_get_grid(cont);
|
||||
if(g == NULL) return;
|
||||
if(g->col_dsc == NULL || g->row_dsc == NULL) return;
|
||||
if(g->col_dsc_len == 0 || g->row_dsc_len == 0) return;
|
||||
@@ -176,7 +176,7 @@ void _lv_grid_calc_free(_lv_grid_calc_t * calc)
|
||||
*/
|
||||
bool _lv_grid_has_fr_col(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_grid_t * g = lv_obj_get_grid(obj);
|
||||
const lv_grid_t * g = lv_obj_get_grid(obj);
|
||||
if(g->col_dsc == NULL) return false;
|
||||
|
||||
uint32_t i;
|
||||
@@ -194,7 +194,7 @@ bool _lv_grid_has_fr_col(struct _lv_obj_t * obj)
|
||||
*/
|
||||
bool _lv_grid_has_fr_row(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_grid_t * g = lv_obj_get_grid(obj);
|
||||
const lv_grid_t * g = lv_obj_get_grid(obj);
|
||||
if(g == NULL) return false;
|
||||
if(g->row_dsc == NULL) return false;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_txt.h"
|
||||
#include "../lv_misc/lv_txt_ap.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
typedef struct {
|
||||
/*New data for this widget */
|
||||
lv_style_list_t style_bullet;
|
||||
char * txt;
|
||||
const char * txt;
|
||||
uint32_t static_txt :1;
|
||||
} lv_checkbox_ext_t;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
#include "../lv_misc/lv_txt.h"
|
||||
#include "../lv_misc/lv_txt_ap.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
#include "../lv_misc/lv_printf.h"
|
||||
|
||||
Reference in New Issue
Block a user