mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
move some part of lv_obj.c to lv_obj_pos.v and lv_obj_scroll.c
This commit is contained in:
parent
9c638950bb
commit
10e0727015
@ -230,8 +230,8 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
/*Be sure both screens are in a normal position*/
|
||||
lv_obj_set_pos(new_scr, 0, 0);
|
||||
lv_obj_set_pos(lv_scr_act(), 0, 0);
|
||||
lv_style_remove_prop(lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
lv_style_remove_prop(lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
lv_style_remove_prop(_lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
lv_style_remove_prop(_lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
|
||||
lv_anim_t a_new;
|
||||
lv_anim_init(&a_new);
|
||||
@ -395,6 +395,6 @@ static void scr_anim_ready(lv_anim_t * a)
|
||||
|
||||
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
|
||||
d->prev_scr = NULL;
|
||||
lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
lv_style_remove_prop(_lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
}
|
||||
#endif
|
||||
|
@ -98,6 +98,166 @@ bool _lv_grid_has_fr_row(struct _lv_obj_t * obj)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void _grid_item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc, uint32_t * child_id_ext, lv_point_t * grid_abs)
|
||||
{
|
||||
if(_lv_obj_is_grid_item(item) == false) return;
|
||||
|
||||
uint32_t col_pos;
|
||||
uint32_t col_span;
|
||||
uint32_t row_pos;
|
||||
uint32_t row_span;
|
||||
|
||||
if(cont->grid->row_dsc && cont->grid->col_dsc) {
|
||||
col_pos = _GRID_GET_CELL_POS(item->x_set);
|
||||
col_span = _GRID_GET_CELL_SPAN(item->x_set);
|
||||
row_pos = _GRID_GET_CELL_POS(item->y_set);
|
||||
row_span = _GRID_GET_CELL_SPAN(item->y_set);
|
||||
} else {
|
||||
col_span = 1;
|
||||
row_span = 1;
|
||||
|
||||
uint32_t child_id = 0;
|
||||
if(child_id_ext) child_id = *child_id_ext;
|
||||
else {
|
||||
lv_obj_t * child = lv_obj_get_child_back(cont, NULL);
|
||||
|
||||
while(child) {
|
||||
if(child == item) break;
|
||||
if(_GRID_IS_CELL(child->x_set) && _GRID_IS_CELL(child->y_set)) {
|
||||
child_id++;
|
||||
}
|
||||
child = lv_obj_get_child_back(cont, child);
|
||||
}
|
||||
}
|
||||
|
||||
if(cont->grid->row_dsc == NULL) {
|
||||
col_pos = child_id % cont->grid->col_dsc_len;
|
||||
row_pos = child_id / cont->grid->col_dsc_len;
|
||||
} else {
|
||||
col_pos = child_id / cont->grid->row_dsc_len;
|
||||
row_pos = child_id % cont->grid->row_dsc_len;
|
||||
}
|
||||
}
|
||||
|
||||
lv_coord_t col_w = calc->col_dsc[col_pos + col_span] - calc->col_dsc[col_pos];
|
||||
lv_coord_t row_h = calc->row_dsc[row_pos + row_span] - calc->row_dsc[row_pos];
|
||||
|
||||
uint8_t x_flag = _GRID_GET_CELL_FLAG(item->x_set);
|
||||
uint8_t y_flag = _GRID_GET_CELL_FLAG(item->y_set);
|
||||
|
||||
lv_coord_t x;
|
||||
lv_coord_t y;
|
||||
lv_coord_t w = lv_obj_get_width(item);
|
||||
lv_coord_t h = lv_obj_get_height(item);
|
||||
|
||||
switch(x_flag) {
|
||||
case LV_GRID_START:
|
||||
x = calc->col_dsc[col_pos];
|
||||
break;
|
||||
case LV_GRID_STRETCH:
|
||||
x = calc->col_dsc[col_pos];
|
||||
w = col_w;
|
||||
item->w_set = LV_SIZE_STRETCH;
|
||||
break;
|
||||
case LV_GRID_CENTER:
|
||||
x = calc->col_dsc[col_pos] + (col_w - w) / 2;
|
||||
break;
|
||||
case LV_GRID_END:
|
||||
x = calc->col_dsc[col_pos + 1] - lv_obj_get_width(item);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(y_flag) {
|
||||
case LV_GRID_START:
|
||||
y = calc->row_dsc[row_pos];
|
||||
break;
|
||||
case LV_GRID_STRETCH:
|
||||
y = calc->row_dsc[row_pos];
|
||||
item->h_set = LV_SIZE_STRETCH;
|
||||
h = row_h;
|
||||
break;
|
||||
case LV_GRID_CENTER:
|
||||
y = calc->row_dsc[row_pos] + (row_h - h) / 2;
|
||||
break;
|
||||
case LV_GRID_END:
|
||||
y = calc->row_dsc[row_pos + 1] - lv_obj_get_height(item);
|
||||
break;
|
||||
}
|
||||
|
||||
/*Set a new size if required*/
|
||||
if(lv_obj_get_width(item) != w || lv_obj_get_height(item) != h) {
|
||||
lv_area_t old_coords;
|
||||
lv_area_copy(&old_coords, &item->coords);
|
||||
lv_obj_invalidate(item);
|
||||
lv_area_set_width(&item->coords, w);
|
||||
lv_area_set_height(&item->coords, h);
|
||||
lv_obj_invalidate(item);
|
||||
item->signal_cb(item, LV_SIGNAL_COORD_CHG, &old_coords);
|
||||
|
||||
/* If a children is a grid container and has an FR field it also needs to be updated
|
||||
* because the FR cell size will change with child size change. */
|
||||
lv_obj_t * child = lv_obj_get_child(item, NULL);
|
||||
while(child) {
|
||||
if(_lv_grid_has_fr_col(child) || _lv_grid_has_fr_row(child)) {
|
||||
lv_grid_full_refr(child);
|
||||
}
|
||||
child = lv_obj_get_child(item, child);
|
||||
}
|
||||
}
|
||||
bool moved = true;
|
||||
if(grid_abs) {
|
||||
if(grid_abs->x + x == item->coords.x1 && grid_abs->y + y == item->coords.y1) moved = false;
|
||||
}
|
||||
|
||||
if(moved) _lv_obj_move_to(item, x, y, false);
|
||||
}
|
||||
|
||||
void lv_grid_full_refr(lv_obj_t * cont)
|
||||
{
|
||||
/*Calculate the grid*/
|
||||
if(cont->grid == NULL) return;
|
||||
_lv_grid_calc_t calc;
|
||||
grid_calc(cont, &calc);
|
||||
|
||||
/* Calculate the grids absolute x and y coordinates.
|
||||
* It will be used as helper during item repositioning to avoid calculating this value for every children*/
|
||||
lv_point_t grid_abs;
|
||||
lv_coord_t pad_left = lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN);
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(cont, LV_OBJ_PART_MAIN);
|
||||
grid_abs.x = pad_left + cont->coords.x1 - lv_obj_get_scroll_left(cont);
|
||||
grid_abs.y = pad_top + cont->coords.y1 - lv_obj_get_scroll_top(cont);
|
||||
|
||||
uint32_t child_id = 0;
|
||||
lv_obj_t * item = lv_obj_get_child_back(cont, NULL);
|
||||
while(item) {
|
||||
if(_GRID_IS_CELL(item->x_set) && _GRID_IS_CELL(item->y_set)) {
|
||||
_grid_item_repos(cont, item, &calc, &child_id, &grid_abs);
|
||||
child_id++;
|
||||
}
|
||||
item = lv_obj_get_child_back(cont, item);
|
||||
}
|
||||
grid_calc_free(&calc);
|
||||
|
||||
if(cont->w_set == LV_SIZE_AUTO || cont->h_set == LV_SIZE_AUTO) {
|
||||
lv_obj_set_size(cont, cont->w_set, cont->h_set);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_grid_item_refr_pos(lv_obj_t * item)
|
||||
{
|
||||
/*Calculate the grid*/
|
||||
lv_obj_t * cont = lv_obj_get_parent(item);
|
||||
if(cont->grid == NULL) return;
|
||||
_lv_grid_calc_t calc;
|
||||
grid_calc(cont, &calc);
|
||||
|
||||
_grid_item_repos(cont, item, &calc, NULL, NULL);
|
||||
|
||||
grid_calc_free(&calc);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -75,6 +75,7 @@ extern "C" {
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
struct _lv_obj_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
/**
|
||||
* Describe how to flow LV_GRID_POS_AUTO elements
|
||||
@ -120,6 +121,12 @@ bool _lv_grid_has_fr_col(struct _lv_obj_t * obj);
|
||||
|
||||
bool _lv_grid_has_fr_row(struct _lv_obj_t * obj);
|
||||
|
||||
void lv_grid_full_refr(lv_obj_t * cont);
|
||||
|
||||
void lv_grid_item_refr_pos(lv_obj_t * item);
|
||||
|
||||
bool _lv_obj_is_grid_item(lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "lv_indev.h"
|
||||
#include "lv_disp.h"
|
||||
#include "lv_obj.h"
|
||||
#include "lv_scroll.h"
|
||||
#include "lv_indev_scroll.h"
|
||||
#include "lv_group.h"
|
||||
#include "lv_refr.h"
|
||||
|
||||
#include "../lv_hal/lv_hal_tick.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_misc/lv_task.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@ extern "C" {
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "../lv_hal/lv_hal_indev.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "lv_group.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -6,8 +6,8 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_scroll.h"
|
||||
#include "lv_indev.h"
|
||||
#include "lv_indev_scroll.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -228,7 +228,7 @@ void _lv_scroll_handler(lv_indev_proc_t * proc)
|
||||
/*Respect the scroll limit area*/
|
||||
scroll_limit_diff(proc, &diff_x, &diff_y);
|
||||
|
||||
lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y);
|
||||
_lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y);
|
||||
proc->types.pointer.scroll_sum.x += diff_x;
|
||||
proc->types.pointer.scroll_sum.y += diff_y;
|
||||
}
|
||||
@ -265,7 +265,7 @@ void _lv_scroll_throw_handler(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.scroll_throw_vect.y = proc->types.pointer.scroll_throw_vect.y >> 1;
|
||||
}
|
||||
|
||||
lv_obj_scroll_by_raw(scroll_obj, 0, proc->types.pointer.scroll_throw_vect.y);
|
||||
_lv_obj_scroll_by_raw(scroll_obj, 0, proc->types.pointer.scroll_throw_vect.y);
|
||||
}
|
||||
/*With snapping find the nearest snap point and scroll there*/
|
||||
else {
|
||||
@ -291,7 +291,7 @@ void _lv_scroll_throw_handler(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.scroll_throw_vect.x = proc->types.pointer.scroll_throw_vect.x >> 1;
|
||||
}
|
||||
|
||||
lv_obj_scroll_by_raw(scroll_obj, proc->types.pointer.scroll_throw_vect.x, 0);
|
||||
_lv_obj_scroll_by_raw(scroll_obj, proc->types.pointer.scroll_throw_vect.x, 0);
|
||||
}
|
||||
/*With snapping find the nearest snap point and scroll there*/
|
||||
else {
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file lv_scroll.h
|
||||
* @file lv_indev_scroll.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SCROLL_H
|
||||
#define LV_SCROLL_H
|
||||
#ifndef LV_INDEV_SCROLL_H
|
||||
#define LV_INDEV_SCROLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -48,4 +48,4 @@ void _lv_scroll_throw_handler(lv_indev_proc_t * proc);
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_SCROLL_H*/
|
||||
#endif /*LV_INDEV_SCROLL_H*/
|
2568
src/lv_core/lv_obj.c
2568
src/lv_core/lv_obj.c
File diff suppressed because it is too large
Load Diff
@ -184,14 +184,6 @@ enum {
|
||||
|
||||
typedef uint8_t lv_dir_t;
|
||||
|
||||
enum {
|
||||
LV_SCROLL_SNAP_ALIGN_NONE,
|
||||
LV_SCROLL_SNAP_ALIGN_START,
|
||||
LV_SCROLL_SNAP_ALIGN_END,
|
||||
LV_SCROLL_SNAP_ALIGN_CENTER
|
||||
};
|
||||
typedef uint8_t lv_scroll_snap_align_t;
|
||||
|
||||
|
||||
enum {
|
||||
LV_OBJ_FLAG_HIDDEN = (1 << 0),
|
||||
@ -207,14 +199,10 @@ enum {
|
||||
};
|
||||
typedef uint16_t lv_obj_flag_t;
|
||||
|
||||
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
enum {
|
||||
LV_SCROLL_MODE_OFF = 0x0, /**< Never show scroll bars*/
|
||||
LV_SCROLL_MODE_ON = 0x1, /**< Always show scroll bars*/
|
||||
LV_SCROLL_MODE_ACTIVE = 0x2, /**< Show scroll bars when object is being scrolled*/
|
||||
LV_SCROLL_MODE_AUTO = 0x3, /**< Show scroll bars when the content is large enough to be scrolled*/
|
||||
};
|
||||
typedef uint8_t lv_scroll_mode_t;
|
||||
|
||||
#include "lv_obj_pos.h"
|
||||
#include "lv_obj_scroll.h"
|
||||
|
||||
|
||||
typedef struct _lv_obj_t {
|
||||
struct _lv_obj_t * parent; /**< Pointer to the parent object*/
|
||||
@ -420,171 +408,6 @@ void lv_obj_move_background(lv_obj_t * obj);
|
||||
* Coordinate set
|
||||
* ------------------*/
|
||||
|
||||
/**
|
||||
* Set relative the position of an object (relative to the parent)
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent
|
||||
* @param y new distance from the top of the parent
|
||||
*/
|
||||
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent
|
||||
*/
|
||||
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent
|
||||
*/
|
||||
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y);
|
||||
|
||||
|
||||
void _lv_obj_calc_auto_size(lv_obj_t * obj, lv_coord_t * w, lv_coord_t * h);
|
||||
|
||||
/**
|
||||
* Set the size of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w new width
|
||||
* @param h new height
|
||||
*/
|
||||
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w new width
|
||||
*/
|
||||
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @param h new height
|
||||
*/
|
||||
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @param w the width without paddings
|
||||
*/
|
||||
void lv_obj_set_width_fit(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height reduced by the top and bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @param h the height without paddings
|
||||
*/
|
||||
void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins
|
||||
*/
|
||||
void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins
|
||||
*/
|
||||
void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
*/
|
||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* It doesn't take into account any limits so any values are possible
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* Limits the scroll to the bounding box of the children.
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given y coordinate to the top side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
|
||||
/**
|
||||
* Return the height of the area above the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_top(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the height of the area below the parent.
|
||||
* That is the number of pixels the object can be scrolled up.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_bottom(const lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Return the weight of the area on the left the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_left(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the width of the area below the object.
|
||||
* That is the number of pixels the object can be scrolled left.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_right(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the size of an extended clickable area
|
||||
* @param obj pointer to an object
|
||||
@ -599,134 +422,6 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
* Appearance set
|
||||
*--------------------*/
|
||||
|
||||
/**
|
||||
* Add a new style to the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param style pointer to a style to add (Only its pointer will be saved)
|
||||
*/
|
||||
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Remove a style from the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param style pointer to a style to remove
|
||||
*/
|
||||
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Reset a style to the default (empty) state.
|
||||
* Release all used memories and cancel pending related transitions.
|
||||
* Typically used in `LV_SIGN_CLEAN_UP.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style list should be reseted.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
*/
|
||||
void lv_obj_clean_style_list(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Reset a style to the default (empty) state.
|
||||
* Release all used memories and cancel pending related transitions.
|
||||
* Also notifies the object about the style change.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style list should be reseted.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
*/
|
||||
void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Notify an object (and its children) about its style is modified
|
||||
* @param obj pointer to an object
|
||||
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed.
|
||||
*/
|
||||
void lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Notify all object if a style is modified
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_report_style_mod(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * value);
|
||||
|
||||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be removed.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @note shouldn't be used directly. Use the specific property remove functions instead.
|
||||
* For example: `lv_obj_style_remove_border_opa()`
|
||||
* @return true: the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Enable/disable the use of style cahche for an object
|
||||
* @param obj pointer to an object
|
||||
* @param dis true: disable; false: enable (re-enable)
|
||||
*/
|
||||
void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis);
|
||||
|
||||
/*-----------------
|
||||
* Attribute set
|
||||
*----------------*/
|
||||
@ -738,14 +433,6 @@ void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis);
|
||||
*/
|
||||
void lv_obj_set_adv_hittest(lv_obj_t * obj, bool en);
|
||||
|
||||
|
||||
/**
|
||||
* Set how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @param mode: LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
void lv_obj_set_scroll_mode(lv_obj_t * obj, lv_scroll_mode_t mode);
|
||||
|
||||
/**
|
||||
* Set the base direction of the object
|
||||
* @param obj pointer to an object
|
||||
@ -783,14 +470,6 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state);
|
||||
*/
|
||||
void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/**
|
||||
* Finish all pending transitions on a part of an object
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g `LV_BRN_PART_MAIN` or `LV_OBJ_PART_ALL` for all parts
|
||||
*/
|
||||
void lv_obj_finish_transitions(lv_obj_t * obj, uint8_t part);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set a an event handler function for an object.
|
||||
@ -947,104 +626,6 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj);
|
||||
* Coordinate get
|
||||
*--------------------*/
|
||||
|
||||
/**
|
||||
* Copy the coordinates of an object to an area
|
||||
* @param obj pointer to an object
|
||||
* @param cords_p pointer to an area to store the coordinates
|
||||
*/
|
||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
|
||||
|
||||
/**
|
||||
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
||||
* (Without the size of the border or other extra graphical elements)
|
||||
* @param coords_p store the result area here
|
||||
*/
|
||||
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p);
|
||||
|
||||
/**
|
||||
* Get the x coordinate of object
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the left side of its parent
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the y coordinate of object
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the top of its parent
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the width
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the height
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get that width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get that height reduced by the top an bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_margin(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Divide the width of the object and get the width of a given number of columns.
|
||||
* Take paddings into account.
|
||||
* @param obj pointer to an object
|
||||
* @param div indicates how many columns are assumed.
|
||||
* If 1 the width will be set the the parent's width
|
||||
* If 2 only half parent width - inner padding of the parent
|
||||
* If 3 only third parent width - 2 * inner padding of the parent
|
||||
* @param span how many columns are combined
|
||||
* @return the width according to the given parameters
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_grid(lv_obj_t * obj, uint8_t div, uint8_t span);
|
||||
|
||||
/**
|
||||
* Divide the height of the object and get the width of a given number of columns.
|
||||
* Take paddings into account.
|
||||
* @param obj pointer to an object
|
||||
* @param div indicates how many rows are assumed.
|
||||
* If 1 the height will be set the the parent's height
|
||||
* If 2 only half parent height - inner padding of the parent
|
||||
* If 3 only third parent height - 2 * inner padding of the parent
|
||||
* @param span how many rows are combined
|
||||
* @return the height according to the given parameters
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_grid(lv_obj_t * obj, uint8_t div, uint8_t span);
|
||||
|
||||
/**
|
||||
* Get the left padding of extended clickable area
|
||||
* @param obj pointer to an object
|
||||
@ -1084,97 +665,13 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
|
||||
* Appearance get
|
||||
*---------------*/
|
||||
|
||||
/**
|
||||
* Get the style list of an object's part.
|
||||
* @param obj pointer to an object.
|
||||
* @param part part the part of the object which style list should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @return pointer to the style list. (Can be `NULL`)
|
||||
*/
|
||||
lv_style_list_t * lv_obj_get_style_list(const lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_WIDTH`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_COLOR`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_OPA`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_TEXT_FONT`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get the local style of a part of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @return pointer to the local style if exists else `NULL`.
|
||||
*/
|
||||
lv_style_t * lv_obj_get_local_style(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
|
||||
#include "lv_obj_style_dec.h"
|
||||
|
||||
/*-----------------
|
||||
* Attribute get
|
||||
*----------------*/
|
||||
|
||||
|
||||
bool lv_obj_has_flag(lv_obj_t * obj, lv_obj_flag_t f);
|
||||
bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f);
|
||||
|
||||
/**
|
||||
* Get whether advanced hit-testing is enabled on an object
|
||||
@ -1326,21 +823,6 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t
|
||||
*/
|
||||
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Fade in (from transparent to fully cover) an object and all its children using an `opa_scale` animation.
|
||||
* @param obj the object to fade in
|
||||
* @param time duration of the animation [ms]
|
||||
* @param delay wait before the animation starts [ms]
|
||||
*/
|
||||
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Fade out (from fully cover to transparent) an object and all its children using an `opa_scale` animation.
|
||||
* @param obj the object to fade in
|
||||
* @param time duration of the animation [ms]
|
||||
* @param delay wait before the animation starts [ms]
|
||||
*/
|
||||
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Check if any object has a given type
|
||||
@ -1358,6 +840,9 @@ bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
|
||||
*/
|
||||
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
|
||||
|
||||
void _lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff);
|
||||
|
||||
#include "lv_obj_style.h"
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
670
src/lv_core/lv_obj_pos.c
Normal file
670
src/lv_core/lv_obj_pos.c
Normal file
@ -0,0 +1,670 @@
|
||||
/**
|
||||
* @file lv_obj_pos.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set relative the position of an object (relative to the parent)
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent plus the parent's left padding or a grid cell
|
||||
* @param y new distance from the top side of the parent plus the parent's right padding or a grid cell
|
||||
* @note Zero value value means place the object is on the left padding of the parent, and not on the left edge.
|
||||
* @note A grid cell can be and explicit placement with cell position and span:
|
||||
* `LV_GRID_CELL_START/END/CENTER/STRETCH(pos, span)`
|
||||
* or "auto" to place the object on the grid in the creation order of other children
|
||||
* `LV_GRID_AUTO_START/END/CENTER/STRETCH`
|
||||
* @note to use grid placement the parent needs have a defined grid with `lv_obj_set_grid`
|
||||
*/
|
||||
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
obj->x_set = x;
|
||||
obj->y_set = y;
|
||||
|
||||
bool gi = _lv_obj_is_grid_item(obj);
|
||||
|
||||
/*For consistency set the size to stretched if the objects is stretched on the grid*/
|
||||
if(gi) {
|
||||
if(_GRID_GET_CELL_FLAG(obj->x_set) == LV_GRID_STRETCH) obj->w_set = LV_SIZE_STRETCH;
|
||||
if(_GRID_GET_CELL_FLAG(obj->y_set) == LV_GRID_STRETCH) obj->h_set = LV_SIZE_STRETCH;
|
||||
}
|
||||
|
||||
/*If not grid item but has grid position set the position to 0*/
|
||||
if(!gi) {
|
||||
if(_GRID_IS_CELL(x)) {
|
||||
obj->x_set = 0;
|
||||
x = 0;
|
||||
}
|
||||
if(_GRID_IS_CELL(y)) {
|
||||
obj->y_set = 0;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*If the object is on a grid item let the grid to position it. */
|
||||
if(gi) {
|
||||
lv_area_t old_area;
|
||||
lv_area_copy(&old_area, &obj->coords);
|
||||
lv_grid_item_refr_pos(obj);
|
||||
|
||||
lv_obj_t * cont = lv_obj_get_parent(obj);
|
||||
|
||||
/*If the item was moved and grid is implicit in the changed direction refresh the whole grid.*/
|
||||
if((cont->grid->col_dsc == NULL && (old_area.x1 != obj->coords.x1 || old_area.x2 != obj->coords.x2)) ||
|
||||
(cont->grid->row_dsc == NULL && (old_area.y1 != obj->coords.y1 || old_area.y2 != obj->coords.y2)))
|
||||
{
|
||||
lv_grid_full_refr(cont);
|
||||
}
|
||||
} else {
|
||||
_lv_obj_move_to(obj, x, y, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent plus the parent's left padding or a grid cell
|
||||
*/
|
||||
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_pos(obj, x, lv_obj_get_y(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent plus the parent's top padding or a grid cell
|
||||
*/
|
||||
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_pos(obj, lv_obj_get_x(obj), y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param w new width in pixels or `LV_SIZE_AUTO` to set the size to involve all children
|
||||
* @param h new height in pixels or `LV_SIZE_AUTO` to set the size to involve all children
|
||||
*/
|
||||
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
bool gi = _lv_obj_is_grid_item(obj);
|
||||
bool x_stretch = false;
|
||||
bool y_stretch = false;
|
||||
|
||||
if(gi) {
|
||||
x_stretch = _GRID_GET_CELL_FLAG(obj->x_set) == LV_GRID_STRETCH ? true : false;
|
||||
y_stretch = _GRID_GET_CELL_FLAG(obj->y_set) == LV_GRID_STRETCH ? true : false;
|
||||
if(x_stretch) w = LV_SIZE_STRETCH;
|
||||
if(y_stretch) h = LV_SIZE_STRETCH;
|
||||
}
|
||||
|
||||
obj->w_set = w;
|
||||
obj->h_set = h;
|
||||
|
||||
/*If both stretched it was already managed by the grid*/
|
||||
if(x_stretch && y_stretch) return;
|
||||
|
||||
if(x_stretch) w = lv_obj_get_width(obj);
|
||||
if(y_stretch) h = lv_obj_get_height(obj);
|
||||
|
||||
/*Calculate the required auto sizes*/
|
||||
bool x_auto = obj->w_set == LV_SIZE_AUTO ? true : false;
|
||||
bool y_auto = obj->h_set == LV_SIZE_AUTO ? true : false;
|
||||
|
||||
lv_coord_t auto_w;
|
||||
lv_coord_t auto_h;
|
||||
if(x_auto && y_auto) {
|
||||
_lv_obj_calc_auto_size(obj, &auto_w, &auto_h);
|
||||
w = auto_w;
|
||||
h = auto_h;
|
||||
}
|
||||
else if(x_auto) {
|
||||
_lv_obj_calc_auto_size(obj, &auto_w, NULL);
|
||||
w = auto_w;
|
||||
}
|
||||
else if(y_auto) {
|
||||
_lv_obj_calc_auto_size(obj, NULL, &auto_h);
|
||||
h = auto_h;
|
||||
}
|
||||
|
||||
refr_size(obj, w, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w new width in pixels or `LV_SIZE_AUTO` to set the size to involve all children
|
||||
*/
|
||||
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_size(obj, w, lv_obj_get_height(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @param h new height in pixels or `LV_SIZE_AUTO` to set the size to involve all children
|
||||
*/
|
||||
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_set_size(obj, lv_obj_get_width(obj), h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @param w the width without paddings in pixels
|
||||
*/
|
||||
void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w)
|
||||
{
|
||||
lv_style_int_t pleft = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t pright = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
lv_obj_set_width(obj, w + pleft + pright);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height reduced by the top and bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @param h the height without paddings in pixels
|
||||
*/
|
||||
void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h)
|
||||
{
|
||||
lv_style_int_t ptop = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
lv_obj_set_height(obj, h + ptop + pbottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
|
||||
{
|
||||
lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
lv_obj_set_width(obj, w - mleft - mright);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h)
|
||||
{
|
||||
lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
lv_obj_set_height(obj, h - mtop - mbottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
*/
|
||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(base == NULL) base = lv_obj_get_parent(obj);
|
||||
|
||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||
|
||||
lv_point_t new_pos;
|
||||
_lv_area_align(&base->coords, &obj->coords, align, &new_pos);
|
||||
|
||||
/*Bring together the coordination system of base and obj*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
lv_coord_t par_abs_x = par->coords.x1;
|
||||
lv_coord_t par_abs_y = par->coords.y1;
|
||||
new_pos.x += x_ofs;
|
||||
new_pos.y += y_ofs;
|
||||
new_pos.x -= par_abs_x;
|
||||
new_pos.y -= par_abs_y;
|
||||
|
||||
lv_obj_set_pos(obj, new_pos.x, new_pos.y);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy the coordinates of an object to an area
|
||||
* @param obj pointer to an object
|
||||
* @param coords_out pointer to an area to store the coordinates
|
||||
*/
|
||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords_out)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_area_copy(coords_out, &obj->coords);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
||||
* (Without the size of the border or other extra graphical elements)
|
||||
* @param coords_out store the result area here
|
||||
*/
|
||||
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_out)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_border_side_t part = lv_obj_get_style_border_side(obj, LV_OBJ_PART_MAIN);
|
||||
lv_coord_t w = lv_obj_get_style_border_width(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
if(part & LV_BORDER_SIDE_LEFT) coords_out->x1 += w;
|
||||
if(part & LV_BORDER_SIDE_RIGHT) coords_out->x2 -= w;
|
||||
if(part & LV_BORDER_SIDE_TOP) coords_out->y1 += w;
|
||||
if(part & LV_BORDER_SIDE_BOTTOM) coords_out->y2 -= w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the x coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the left side of its parent plus the parent's left padding
|
||||
* @note Zero return value means the object is on the left padding of the parent, and not on the left edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if the position is grid cell or other special value.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t rel_x;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent) {
|
||||
rel_x = obj->coords.x1 - parent->coords.x1;
|
||||
rel_x += lv_obj_get_scroll_left(parent);
|
||||
rel_x -= lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
|
||||
}
|
||||
else {
|
||||
rel_x = obj->coords.x1;
|
||||
}
|
||||
return rel_x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the y coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the top side of its parent plus the parent's top padding
|
||||
* @note Zero return value means the object is on the top padding of the parent, and not on the top edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if the position is grid cell or other special value.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t rel_y;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent) {
|
||||
rel_y = obj->coords.y1 - parent->coords.y1;
|
||||
rel_y += lv_obj_get_scroll_top(parent);
|
||||
rel_y -= lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
|
||||
}
|
||||
else {
|
||||
rel_y = obj->coords.y1;
|
||||
}
|
||||
return rel_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the width in pixels
|
||||
* @note The returned value is always the width in pixels even if the width is set to `LV_SIZE_AUTO` or other special value.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return lv_area_get_width(&obj->coords);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the height in pixels
|
||||
* @note The returned value is always the width in pixels even if the width is set to `LV_SIZE_AUTO` or other special value.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return lv_area_get_height(&obj->coords);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the width which still fits into the container without causing overflow
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
return lv_obj_get_width(obj) - left - right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that height reduced by the top an bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the height which still fits into the container without causing overflow
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top((lv_obj_t *)obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t bottom = lv_obj_get_style_pad_bottom((lv_obj_t *)obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
return lv_obj_get_height(obj) - top - bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj)
|
||||
{
|
||||
lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
return lv_obj_get_height(obj) + mtop + mbottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_margin(lv_obj_t * obj)
|
||||
{
|
||||
lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
return lv_obj_get_width(obj) + mleft + mright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given screen-space point is on an object's coordinates.
|
||||
*
|
||||
* This method is intended to be used mainly by advanced hit testing algorithms to check
|
||||
* whether the point is even within the object (as an optimization).
|
||||
* @param obj object to check
|
||||
* @param point screen-space point
|
||||
*/
|
||||
bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point)
|
||||
{
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
lv_area_t ext_area;
|
||||
ext_area.x1 = obj->coords.x1 - obj->ext_click_pad_hor;
|
||||
ext_area.x2 = obj->coords.x2 + obj->ext_click_pad_hor;
|
||||
ext_area.y1 = obj->coords.y1 - obj->ext_click_pad_ver;
|
||||
ext_area.y2 = obj->coords.y2 + obj->ext_click_pad_ver;
|
||||
|
||||
if(!_lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
lv_area_t ext_area;
|
||||
ext_area.x1 = obj->coords.x1 - obj->ext_click_pad.x1;
|
||||
ext_area.x2 = obj->coords.x2 + obj->ext_click_pad.x2;
|
||||
ext_area.y1 = obj->coords.y1 - obj->ext_click_pad.y1;
|
||||
ext_area.y2 = obj->coords.y2 + obj->ext_click_pad.y2;
|
||||
|
||||
if(!_lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
#else
|
||||
if(!_lv_area_is_point_on(&obj->coords, point, 0)) {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the "auto size". It's `auto_size = max(gird_size, children_size)`
|
||||
* @param obj pointer to an object
|
||||
* @param w_out store the width here. NULL to not calculate width
|
||||
* @param h_out store the height here. NULL to not calculate height
|
||||
*/
|
||||
void _lv_obj_calc_auto_size(lv_obj_t * obj, lv_coord_t * w_out, lv_coord_t * h_out)
|
||||
{
|
||||
if(!w_out && !h_out) return;
|
||||
|
||||
/*If no other effect the auto-size of zero by default*/
|
||||
if(w_out) *w_out = 0;
|
||||
if(h_out) *h_out = 0;
|
||||
|
||||
/*Get the grid size of the object has a defined grid*/
|
||||
lv_coord_t grid_w = 0;
|
||||
lv_coord_t grid_h = 0;
|
||||
if(obj->grid) {
|
||||
_lv_grid_calc_t calc;
|
||||
grid_calc(obj, &calc);
|
||||
grid_w = calc.col_dsc[calc.col_dsc_len - 1] + lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN) + + lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
|
||||
grid_h = calc.row_dsc[calc.row_dsc_len - 1] + lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN) + lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);;
|
||||
grid_calc_free(&calc);
|
||||
}
|
||||
|
||||
/*Get the children's most right and bottom position*/
|
||||
lv_coord_t children_w = 0;
|
||||
lv_coord_t children_h = 0;
|
||||
if(w_out) {
|
||||
lv_obj_scroll_to_x(obj, 0, LV_ANIM_OFF);
|
||||
lv_coord_t scroll_right = lv_obj_get_scroll_right(obj);
|
||||
children_w = lv_obj_get_width(obj) + scroll_right;
|
||||
}
|
||||
|
||||
if(h_out) {
|
||||
lv_obj_scroll_to_y(obj, 0, LV_ANIM_OFF);
|
||||
lv_coord_t scroll_bottom = lv_obj_get_scroll_bottom(obj);
|
||||
children_h = lv_obj_get_height(obj) + scroll_bottom;
|
||||
}
|
||||
|
||||
|
||||
/*auto_size = max(gird_size, children_size)*/
|
||||
if(w_out) *w_out = LV_MATH_MAX(children_w, grid_w);
|
||||
if(h_out) *h_out = LV_MATH_MAX(children_h, grid_h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move an object to a given x and y coordinate.
|
||||
* It's the core function to move objects but user should use `lv_obj_set_pos/x/y/..` etc.
|
||||
* @param obj pointer to an object to move
|
||||
* @param x the new x coordinate in pixels
|
||||
* @param y the new y coordinate in pixels
|
||||
* @param notify_parent true: send `LV_SIGNAL_CHILD_CHG` to the parent if `obj` moved; false: do not notify the parent
|
||||
*/
|
||||
void _lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify_parent)
|
||||
{
|
||||
/*Convert x and y to absolute coordinates*/
|
||||
lv_obj_t * parent = obj->parent;
|
||||
|
||||
if(parent) {
|
||||
lv_coord_t pad_left = lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
|
||||
|
||||
x += pad_left + parent->coords.x1 - lv_obj_get_scroll_left(parent);
|
||||
y += pad_top + parent->coords.y1 - lv_obj_get_scroll_top(parent);
|
||||
} else {
|
||||
/*If no parent then it's screen but screen can't be on a grid*/
|
||||
if(_GRID_IS_CELL(obj->x_set) || _GRID_IS_CELL(obj->x_set)) {
|
||||
obj->x_set = 0;
|
||||
obj->y_set = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*Calculate and set the movement*/
|
||||
lv_point_t diff;
|
||||
diff.x = x - obj->coords.x1;
|
||||
diff.y = y - obj->coords.y1;
|
||||
|
||||
/* Do nothing if the position is not changed */
|
||||
/* It is very important else recursive positioning can
|
||||
* occur without position change*/
|
||||
if(diff.x == 0 && diff.y == 0) return;
|
||||
|
||||
/*Invalidate the original area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/*Save the original coordinates*/
|
||||
lv_area_t ori;
|
||||
lv_obj_get_coords(obj, &ori);
|
||||
|
||||
obj->coords.x1 += diff.x;
|
||||
obj->coords.y1 += diff.y;
|
||||
obj->coords.x2 += diff.x;
|
||||
obj->coords.y2 += diff.y;
|
||||
|
||||
_lv_obj_move_children_by(obj, diff.x, diff.y);
|
||||
|
||||
/*Inform the object about its new coordinates*/
|
||||
obj->signal_cb(obj, LV_SIGNAL_COORD_CHG, &ori);
|
||||
|
||||
/*Send a signal to the parent too*/
|
||||
if(parent && notify_parent) parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reposition the children of an object. (Called recursively)
|
||||
* @param obj pointer to an object which children will be repositioned
|
||||
* @param x_diff x coordinate shift
|
||||
* @param y_diff y coordinate shift
|
||||
*/
|
||||
void _lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
i->coords.x1 += x_diff;
|
||||
i->coords.y1 += y_diff;
|
||||
i->coords.x2 += x_diff;
|
||||
i->coords.y2 += y_diff;
|
||||
|
||||
_lv_obj_move_children_by(i, x_diff, y_diff);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an object is valid grid item or not.
|
||||
* @param obj pointer to an object to check
|
||||
* @return true: grid item; false: not grid item
|
||||
*/
|
||||
bool _lv_obj_is_grid_item(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_get_parent(obj);
|
||||
if(cont == NULL) return false;
|
||||
if(cont->grid == NULL) return false;
|
||||
if(_GRID_IS_CELL(obj->x_set) && _GRID_IS_CELL(obj->y_set)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set the size of an object.
|
||||
* It's the core function to set the size of objects but user should use `lv_obj_set_size/width/height/..` etc.
|
||||
* @param obj pointer to an object
|
||||
* @param w the new width in pixels
|
||||
* @param h the new height in pixels
|
||||
* @return true: the size was changed; false: `w` and `h` was equal to the current width and height so nothing happened.
|
||||
*/
|
||||
static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
{
|
||||
/* Do nothing if the size is not changed */
|
||||
/* It is very important else recursive resizing can
|
||||
* occur without size change*/
|
||||
if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) {
|
||||
return false;
|
||||
}
|
||||
/*Invalidate the original area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/*Save the original coordinates*/
|
||||
lv_area_t ori;
|
||||
lv_obj_get_coords(obj, &ori);
|
||||
|
||||
/*Set the length and height*/
|
||||
obj->coords.y2 = obj->coords.y1 + h - 1;
|
||||
if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) {
|
||||
obj->coords.x1 = obj->coords.x2 - w + 1;
|
||||
}
|
||||
else {
|
||||
obj->coords.x2 = obj->coords.x1 + w - 1;
|
||||
}
|
||||
|
||||
/*Send a signal to the object with its new coordinates*/
|
||||
obj->signal_cb(obj, LV_SIGNAL_COORD_CHG, &ori);
|
||||
|
||||
/*Send a signal to the parent too*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par != NULL) par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
return true;
|
||||
}
|
||||
|
241
src/lv_core/lv_obj_pos.h
Normal file
241
src/lv_core/lv_obj_pos.h
Normal file
@ -0,0 +1,241 @@
|
||||
/**
|
||||
* @file lv_obj_pos.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_POS_H
|
||||
#define LV_OBJ_POS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
struct _lv_obj_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set relative the position of an object (relative to the parent)
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent
|
||||
* @param y new distance from the top of the parent
|
||||
*/
|
||||
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent
|
||||
*/
|
||||
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent
|
||||
*/
|
||||
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y);
|
||||
|
||||
|
||||
void _lv_obj_calc_auto_size(lv_obj_t * obj, lv_coord_t * w, lv_coord_t * h);
|
||||
|
||||
/**
|
||||
* Set the size of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w new width
|
||||
* @param h new height
|
||||
*/
|
||||
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w new width
|
||||
*/
|
||||
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @param h new height
|
||||
*/
|
||||
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @param w the width without paddings
|
||||
*/
|
||||
void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height reduced by the top and bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @param h the height without paddings
|
||||
*/
|
||||
void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins
|
||||
*/
|
||||
void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins
|
||||
*/
|
||||
void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
*/
|
||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
|
||||
|
||||
/**
|
||||
* Copy the coordinates of an object to an area
|
||||
* @param obj pointer to an object
|
||||
* @param cords_p pointer to an area to store the coordinates
|
||||
*/
|
||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
|
||||
|
||||
/**
|
||||
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
||||
* (Without the size of the border or other extra graphical elements)
|
||||
* @param coords_p store the result area here
|
||||
*/
|
||||
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p);
|
||||
|
||||
/**
|
||||
* Get the x coordinate of object
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the left side of its parent
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the y coordinate of object
|
||||
* @param obj pointer to an object
|
||||
* @return distance of 'obj' from the top of its parent
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the width
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the height
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get that width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get that height reduced by the top an bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_margin(lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Check if a given screen-space point is on an object's coordinates.
|
||||
*
|
||||
* This method is intended to be used mainly by advanced hit testing algorithms to check
|
||||
* whether the point is even within the object (as an optimization).
|
||||
* @param obj object to check
|
||||
* @param point screen-space point
|
||||
*/
|
||||
bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point);
|
||||
|
||||
/**
|
||||
* Divide the width of the object and get the width of a given number of columns.
|
||||
* Take paddings into account.
|
||||
* @param obj pointer to an object
|
||||
* @param div indicates how many columns are assumed.
|
||||
* If 1 the width will be set the the parent's width
|
||||
* If 2 only half parent width - inner padding of the parent
|
||||
* If 3 only third parent width - 2 * inner padding of the parent
|
||||
* @param span how many columns are combined
|
||||
* @return the width according to the given parameters
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_grid(lv_obj_t * obj, uint8_t div, uint8_t span);
|
||||
|
||||
/**
|
||||
* Divide the height of the object and get the width of a given number of columns.
|
||||
* Take paddings into account.
|
||||
* @param obj pointer to an object
|
||||
* @param div indicates how many rows are assumed.
|
||||
* If 1 the height will be set the the parent's height
|
||||
* If 2 only half parent height - inner padding of the parent
|
||||
* If 3 only third parent height - 2 * inner padding of the parent
|
||||
* @param span how many rows are combined
|
||||
* @return the height according to the given parameters
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_grid(lv_obj_t * obj, uint8_t div, uint8_t span);
|
||||
|
||||
void _lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify_parent);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_POS_H*/
|
246
src/lv_core/lv_obj_scroll.c
Normal file
246
src/lv_core/lv_obj_scroll.c
Normal file
@ -0,0 +1,246 @@
|
||||
/**
|
||||
* @file lv_obj_scroll.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj_scroll.h"
|
||||
#include "lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define SCROLL_ANIM_TIME_MIN 100 /*ms*/
|
||||
#define SCROLL_ANIM_TIME_MAX 300 /*ms*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @param mode: LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
void lv_obj_set_scroll_mode(lv_obj_t * obj, lv_scroll_mode_t mode)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
if(obj->scroll_mode == mode) return;
|
||||
obj->scroll_mode = mode;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @return mode: LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
lv_scroll_mode_t lv_obj_get_scroll_mode(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->scroll_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* It doesn't take into account any limits so any values are possible
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
obj->scroll.x += x;
|
||||
obj->scroll.y += y;
|
||||
|
||||
_lv_obj_move_children_by(obj, x, y);
|
||||
lv_res_t res = lv_signal_send(obj, LV_SIGNAL_SCROLL, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* Limits the scroll to the bounding box of the children.
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
{
|
||||
if(x == 0 && y == 0) return;
|
||||
|
||||
if(anim_en == LV_ANIM_ON) {
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_ease_out);
|
||||
|
||||
if(x) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_hor_res(d) * 3) >> 2, 0, x);
|
||||
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
|
||||
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
|
||||
lv_anim_set_time(&a, t);
|
||||
lv_anim_set_values(&a, obj->scroll.x, obj->scroll.x + x);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) scroll_anim_x_cb);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
if(y) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_ver_res(d) * 3) >> 2, 0, y);
|
||||
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
|
||||
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
|
||||
lv_anim_set_time(&a, t);
|
||||
lv_anim_set_values(&a, obj->scroll.y, obj->scroll.y + y);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) scroll_anim_y_cb);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
} else {
|
||||
_lv_obj_scroll_by_raw(obj, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
|
||||
{
|
||||
lv_obj_scroll_by(obj, -x - obj->scroll.x, 0, anim_en);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the a given y coordinate to the top side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
{
|
||||
lv_obj_scroll_by(obj, 0, -y - obj->scroll.y, anim_en);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the height of the area above the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_top(const lv_obj_t * obj)
|
||||
{
|
||||
return -obj->scroll.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the height of the area below the parent.
|
||||
* That is the number of pixels the object can be scrolled up.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_bottom(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t y2 = LV_COORD_MIN;
|
||||
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
if(child == NULL) return 0;
|
||||
|
||||
while(child) {
|
||||
y2 = LV_MATH_MAX(y2, child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_OBJ_PART_MAIN));
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
||||
return y2 - obj->coords.y2 + lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the weight of the area on the left the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_left(const lv_obj_t * obj)
|
||||
{
|
||||
return -obj->scroll.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the width of the area below the object.
|
||||
* That is the number of pixels the object can be scrolled left.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_right(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t x2 = LV_COORD_MIN;
|
||||
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
if(child == NULL) return 0;
|
||||
|
||||
while(child) {
|
||||
x2 = LV_MATH_MAX(x2, child->coords.x2 + lv_obj_get_style_margin_right(child, LV_OBJ_PART_MAIN));
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
||||
return x2 - obj->coords.x2 + lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
_lv_obj_scroll_by_raw(obj, v - obj->scroll.x, 0);
|
||||
}
|
||||
|
||||
static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
_lv_obj_scroll_by_raw(obj, 0, v - obj->scroll.y);
|
||||
}
|
153
src/lv_core/lv_obj_scroll.h
Normal file
153
src/lv_core/lv_obj_scroll.h
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @file lv_obj_scroll.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_SCROLL_H
|
||||
#define LV_OBJ_SCROLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
enum {
|
||||
LV_SCROLL_MODE_OFF = 0x0, /**< Never show scroll bars*/
|
||||
LV_SCROLL_MODE_ON = 0x1, /**< Always show scroll bars*/
|
||||
LV_SCROLL_MODE_ACTIVE = 0x2, /**< Show scroll bars when object is being scrolled*/
|
||||
LV_SCROLL_MODE_AUTO = 0x3, /**< Show scroll bars when the content is large enough to be scrolled*/
|
||||
};
|
||||
typedef uint8_t lv_scroll_mode_t;
|
||||
|
||||
|
||||
enum {
|
||||
LV_SCROLL_SNAP_ALIGN_NONE,
|
||||
LV_SCROLL_SNAP_ALIGN_START,
|
||||
LV_SCROLL_SNAP_ALIGN_END,
|
||||
LV_SCROLL_SNAP_ALIGN_CENTER
|
||||
};
|
||||
typedef uint8_t lv_scroll_snap_align_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @param mode: LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
void lv_obj_set_scroll_mode(lv_obj_t * obj, lv_scroll_mode_t mode);
|
||||
|
||||
/**
|
||||
* Get how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @return mode: LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
lv_scroll_mode_t lv_obj_get_scroll_mode(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* It doesn't take into account any limits so any values are possible
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Moves all children with horizontally or vertically.
|
||||
* Limits the scroll to the bounding box of the children.
|
||||
* @param obj pointer to an object whose children should be moved
|
||||
* @param x pixel to move horizontally
|
||||
* @param y pixels to move vertically
|
||||
*/
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given x coordinate to the left side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param x the x coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll the a given y coordinate to the top side of obj.
|
||||
* @param obj pointer to an object which should be scrolled
|
||||
* @param y the y coordinate to scroll to
|
||||
*/
|
||||
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
|
||||
/**
|
||||
* Return the height of the area above the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_top(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the height of the area below the parent.
|
||||
* That is the number of pixels the object can be scrolled up.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_bottom(const lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Return the weight of the area on the left the parent.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_left(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the width of the area below the object.
|
||||
* That is the number of pixels the object can be scrolled left.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_right(const lv_obj_t * obj);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_SCROLL_H*/
|
1366
src/lv_core/lv_obj_style.c
Normal file
1366
src/lv_core/lv_obj_style.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,305 @@
|
||||
|
||||
/**
|
||||
* @file lv_obj_style_dec.h
|
||||
* @file lv_obj_style.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_STYLE_DEC_H
|
||||
#define LV_OBJ_STYLE_DEC_H
|
||||
#ifndef LV_OBJ_STYLE_H
|
||||
#define LV_OB_STYLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
struct _lv_obj_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the object related style manager module.
|
||||
* Called by LVGL in `lv_init()`
|
||||
*/
|
||||
void _lv_obj_style_init(void);
|
||||
|
||||
/**
|
||||
* Add a new style to the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param style pointer to a style to add (Only its pointer will be saved)
|
||||
*/
|
||||
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Remove a style from the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param style pointer to a style to remove
|
||||
*/
|
||||
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Reset a style to the default (empty) state.
|
||||
* Release all used memories and cancel pending related transitions.
|
||||
* Also notifies the object about the style change.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style list should be reseted.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
*/
|
||||
void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Notify all object if a style is modified
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_report_style_change(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be removed.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @return true: the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
|
||||
/**
|
||||
* Fade in (from transparent to fully cover) an object and all its children using an `opa_scale` animation.
|
||||
* @param obj the object to fade in
|
||||
* @param time duration of the animation [ms]
|
||||
* @param delay wait before the animation starts [ms]
|
||||
*/
|
||||
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Fade out (from fully cover to transparent) an object and all its children using an `opa_scale` animation.
|
||||
* @param obj the object to fade in
|
||||
* @param time duration of the animation [ms]
|
||||
* @param delay wait before the animation starts [ms]
|
||||
*/
|
||||
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the style list of part of an object
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @return pointer to the style list
|
||||
*/
|
||||
lv_style_list_t * _lv_obj_get_style_list(const lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Enable/disable the use of style cache for an object
|
||||
* @param obj pointer to an object
|
||||
* @param dis true: disable; false: enable (re-enable)
|
||||
*/
|
||||
void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_WIDTH`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_COLOR`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_BORDER_OPA`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get a style property of a part of an object in the object's current state.
|
||||
* If there is a running transitions it is taken into account
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop the property to get. E.g. `LV_STYLE_TEXT_FONT`.
|
||||
* The state of the object will be added internally
|
||||
* @return the value of the property of the given part in the current state.
|
||||
* If the property is not found a default value will be returned.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Get the local style of a part of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @return pointer to the local style if exists else `NULL`.
|
||||
*/
|
||||
lv_style_t * _lv_obj_get_local_style(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Set a local style property of a part of an object in a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be set.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_obj_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * value);
|
||||
|
||||
/**
|
||||
* Reset a style to the default (empty) state.
|
||||
* Release all used memories and cancel pending related transitions.
|
||||
* Typically used in `LV_SIGNAL_CLEAN_UP.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style list should be reseted.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
*/
|
||||
void _lv_obj_reset_style_list_no_refr(lv_obj_t * obj, uint8_t part);
|
||||
|
||||
/**
|
||||
* Notify an object and its children about its style is modified
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be refreshed.
|
||||
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed.
|
||||
*/
|
||||
void _lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/**
|
||||
* Remove all transitions from an object
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void _lv_obj_remove_style_trans(lv_obj_t * obj);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
|
||||
/**
|
||||
* Allocate and initialize a transition for a property of an object if the properties value is different in the new state.
|
||||
* It allocates `lv_style_trans_t` in `_lv_obj_style_trans_ll` and set only `start/end_values`. No animation will be created here.
|
||||
* @param obj and object to add the transition
|
||||
* @param prop the property to apply the transaction
|
||||
* @param part the part of the object to apply the transaction
|
||||
* @param prev_state the previous state of the objects
|
||||
* @param new_state the new state of the object
|
||||
* @param time duration of transition in [ms]
|
||||
* @param delay delay before starting the transition in [ms]
|
||||
* @param path the path of the transition
|
||||
* @return pointer to the allocated `the transaction` variable or `NULL` if no transition created
|
||||
*/
|
||||
void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state, uint32_t time, uint32_t delay, lv_anim_path_t * path);
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Macro to declare the most important style set/get API functions.
|
||||
*
|
||||
@ -309,4 +594,4 @@ static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state,
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_H*/
|
||||
#endif /*LV_TEMPL_H*/
|
@ -73,7 +73,7 @@ typedef struct _lv_font_struct {
|
||||
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
|
||||
|
||||
int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/
|
||||
int8_t underline_thickness; /**< Thickness of the underline*/
|
||||
int8_t underline_thickness; /**< Thickness of the underline*/
|
||||
|
||||
void * dsc; /**< Store implementation specific or run_time data or caching here*/
|
||||
#if LV_USE_USER_DATA
|
||||
|
@ -206,269 +206,269 @@ static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
|
||||
case LV_THEME_SCR:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTN
|
||||
case LV_THEME_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTN_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
case LV_THEME_BTNMATRIX:
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTNMATRIX_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTNMATRIX_PART_BTN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_KEYBOARD
|
||||
case LV_THEME_KEYBOARD:
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_KEYBOARD_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_KEYBOARD_PART_BTN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BAR
|
||||
case LV_THEME_BAR:
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BAR_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BAR_PART_INDIC);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
case LV_THEME_SWITCH:
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_KNOB);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CANVAS
|
||||
case LV_THEME_CANVAS:
|
||||
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CANVAS_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMG
|
||||
case LV_THEME_IMAGE:
|
||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMGBTN
|
||||
case LV_THEME_IMGBTN:
|
||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LABEL
|
||||
case LV_THEME_LABEL:
|
||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINE
|
||||
case LV_THEME_LINE:
|
||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ARC
|
||||
case LV_THEME_ARC:
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_ARC_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_ARC_PART_INDIC);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
case LV_THEME_SPINNER:
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SPINNER_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SPINNER_PART_INDIC);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
case LV_THEME_SLIDER:
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_KNOB);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
case LV_THEME_CHECKBOX:
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CHECKBOX_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CHECKBOX_PART_BULLET);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_MSGBOX
|
||||
case LV_THEME_MSGBOX:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_MSGBOX_PART_BG);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_MSGBOX_PART_BTN);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if LV_USE_LED
|
||||
case LV_THEME_LED:
|
||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LED_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_PAGE_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABVIEW_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABVIEW_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_PAGE_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TILEVIEW
|
||||
case LV_THEME_TILEVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TILEVIEW_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
case LV_THEME_ROLLER:
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_ROLLER_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_ROLLER_PART_SELECTED);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_OBJMASK
|
||||
case LV_THEME_OBJMASK:
|
||||
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_OBJMASK_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
case LV_THEME_LIST:
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LIST_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LIST_PART_SCROLLABLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LIST_PART_SCROLLBAR);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTN_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
case LV_THEME_DROPDOWN:
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
case LV_THEME_CHART:
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_SERIES_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_SERIES);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL1);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL2);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL3);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL4);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN
|
||||
case LV_THEME_WIN:
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_WIN_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_WIN_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_WIN_PART_HEADER);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTN_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
case LV_THEME_TEXTAREA:
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_SPINBOX
|
||||
case LV_THEME_SPINBOX:
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SPINBOX_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_SPINBOX_PART_CURSOR);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_BTN_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
case LV_THEME_CALENDAR:
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CALENDAR_PART_BG);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CALENDAR_PART_DATE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CALENDAR_PART_HEADER);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CPICKER_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_CPICKER_PART_KNOB);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
case LV_THEME_LINEMETER:
|
||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_LINEMETER_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_MAJOR);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_NEEDLE);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -99,7 +99,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
LV_UNUSED(th);
|
||||
if(name == LV_THEME_SCR) {
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
|
||||
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
|
||||
}
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
|
||||
inited = true;
|
||||
|
||||
lv_obj_report_style_mod(NULL);
|
||||
lv_obj_report_style_change(NULL);
|
||||
|
||||
return &theme;
|
||||
}
|
||||
@ -978,34 +978,34 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
|
||||
case LV_THEME_SCR:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTN
|
||||
case LV_THEME_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
case LV_THEME_BTNMATRIX:
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->bg_click);
|
||||
break;
|
||||
@ -1013,11 +1013,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_KEYBOARD
|
||||
case LV_THEME_KEYBOARD:
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
_lv_style_list_add_style(list, &styles->kb_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->bg_click);
|
||||
break;
|
||||
@ -1025,23 +1025,23 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_BAR
|
||||
case LV_THEME_BAR:
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
case LV_THEME_SWITCH:
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->sw_knob);
|
||||
break;
|
||||
#endif
|
||||
@ -1073,14 +1073,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_ARC
|
||||
case LV_THEME_ARC:
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->bg_click);
|
||||
_lv_style_list_add_style(list, &styles->arc_knob);
|
||||
@ -1089,34 +1089,34 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
case LV_THEME_SPINNER:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
case LV_THEME_SLIDER:
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||
_lv_style_list_add_style(list, &styles->slider_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->slider_knob);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
case LV_THEME_CHECKBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->cb_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->cb_bullet);
|
||||
break;
|
||||
@ -1124,60 +1124,60 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_MSGBOX
|
||||
case LV_THEME_MSGBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->mbox_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if LV_USE_LED
|
||||
case LV_THEME_LED:
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->led);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->edge_flash);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->tabview_indic);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
_lv_style_list_add_style(list, &styles->tabview_btns);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
||||
|
||||
break;
|
||||
@ -1185,14 +1185,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_TILEVIEW
|
||||
case LV_THEME_TILEVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->edge_flash);
|
||||
#endif
|
||||
break;
|
||||
@ -1201,125 +1201,125 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
case LV_THEME_ROLLER:
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->roller_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->roller_sel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_OBJMASK
|
||||
case LV_THEME_OBJMASK:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
case LV_THEME_LIST:
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->list_bg);
|
||||
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->list_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
case LV_THEME_DROPDOWN:
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->bg_click);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->ddlist_page);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->ddlist_sel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
case LV_THEME_CHART:
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->chart_bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
_lv_style_list_add_style(list, &styles->chart_series_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_style_list_add_style(list, &styles->chart_series);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
_lv_style_list_add_style(list, &styles->table_cell);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
_lv_style_list_add_style(list, &styles->table_cell);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
_lv_style_list_add_style(list, &styles->table_cell);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
_lv_style_list_add_style(list, &styles->table_cell);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN
|
||||
case LV_THEME_WIN:
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->tabview_btns);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
case LV_THEME_TEXTAREA:
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
_lv_style_list_add_style(list, &styles->ta_placeholder);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->ta_cursor);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
break;
|
||||
|
||||
@ -1328,16 +1328,16 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SPINBOX
|
||||
case LV_THEME_SPINBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->spinbox_cursor);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->bg_click);
|
||||
break;
|
||||
@ -1345,46 +1345,46 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
case LV_THEME_CALENDAR:
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
_lv_style_list_add_style(list, &styles->calendar_date_nums);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->calendar_header);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
_lv_style_list_add_style(list, &styles->calendar_daynames);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->cpicker_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->cpicker_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
case LV_THEME_LINEMETER:
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->lmeter);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->gauge_main);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
_lv_style_list_add_style(list, &styles->gauge_strong);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
_lv_style_list_add_style(list, &styles->gauge_needle);
|
||||
break;
|
||||
#endif
|
||||
@ -1392,7 +1392,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
}
|
||||
|
||||
lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -577,23 +577,23 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
|
||||
case LV_THEME_SCR:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTN
|
||||
case LV_THEME_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
@ -602,10 +602,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
case LV_THEME_BTNMATRIX:
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
@ -614,11 +614,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_KEYBOARD
|
||||
case LV_THEME_KEYBOARD:
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -626,12 +626,12 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_BAR
|
||||
case LV_THEME_BAR:
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
@ -640,16 +640,16 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
case LV_THEME_SWITCH:
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
@ -658,51 +658,51 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CANVAS
|
||||
case LV_THEME_CANVAS:
|
||||
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMG
|
||||
case LV_THEME_IMAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMGBTN
|
||||
case LV_THEME_IMGBTN:
|
||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LABEL
|
||||
case LV_THEME_LABEL:
|
||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINE
|
||||
case LV_THEME_LINE:
|
||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ARC
|
||||
case LV_THEME_ARC:
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
case LV_THEME_SPINNER:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
@ -711,15 +711,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
case LV_THEME_SLIDER:
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
@ -729,10 +729,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
case LV_THEME_CHECKBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
@ -741,15 +741,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_MSGBOX
|
||||
case LV_THEME_MSGBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
@ -758,40 +758,40 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
#endif
|
||||
#if LV_USE_LED
|
||||
case LV_THEME_LED:
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->scr);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
_lv_style_list_add_style(list, &styles->tab_bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->pad_normal);
|
||||
|
||||
break;
|
||||
@ -799,13 +799,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_TILEVIEW
|
||||
case LV_THEME_TILEVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
@ -813,11 +813,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
case LV_THEME_ROLLER:
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->big_line_space);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
@ -827,23 +827,23 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_OBJMASK
|
||||
case LV_THEME_OBJMASK:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
case LV_THEME_LIST:
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
_lv_style_list_add_style(list, &styles->clip_corner);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->list_btn);
|
||||
@ -854,18 +854,18 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
case LV_THEME_DROPDOWN:
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->big_line_space);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
@ -874,35 +874,35 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CHART
|
||||
case LV_THEME_CHART:
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->border_none);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_style_list_add_style(list, &styles->chart_series);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
break;
|
||||
@ -910,21 +910,21 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_WIN
|
||||
case LV_THEME_WIN:
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -932,13 +932,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
case LV_THEME_TEXTAREA:
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->ta_cursor);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
break;
|
||||
#endif
|
||||
@ -946,10 +946,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SPINBOX
|
||||
case LV_THEME_SPINBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
@ -958,7 +958,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
@ -967,31 +967,31 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
case LV_THEME_CALENDAR:
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
_lv_style_list_add_style(list, &styles->border_none);
|
||||
_lv_style_list_add_style(list, &styles->calendar_date);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->pad_normal);
|
||||
_lv_style_list_add_style(list, &styles->border_none);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
@ -999,7 +999,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
case LV_THEME_LINEMETER:
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
_lv_style_list_add_style(list, &styles->linemeter);
|
||||
@ -1007,14 +1007,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
_lv_style_list_add_style(list, &styles->gauge_major);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
_lv_style_list_add_style(list, &styles->gauge_needle);
|
||||
break;
|
||||
#endif
|
||||
@ -1023,7 +1023,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
}
|
||||
|
||||
|
||||
lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
|
||||
|
||||
}
|
||||
|
@ -420,24 +420,24 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
|
||||
case LV_THEME_SCR:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTN
|
||||
case LV_THEME_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -445,10 +445,10 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
case LV_THEME_BTNMATRIX:
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -456,10 +456,10 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_KEYBOARD
|
||||
case LV_THEME_KEYBOARD:
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -467,11 +467,11 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_BAR
|
||||
case LV_THEME_BAR:
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
@ -479,16 +479,16 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
case LV_THEME_SWITCH:
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
@ -497,42 +497,42 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CANVAS
|
||||
case LV_THEME_CANVAS:
|
||||
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMG
|
||||
case LV_THEME_IMAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMGBTN
|
||||
case LV_THEME_IMGBTN:
|
||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LABEL
|
||||
case LV_THEME_LABEL:
|
||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINE
|
||||
case LV_THEME_LINE:
|
||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ARC
|
||||
case LV_THEME_ARC:
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
@ -541,11 +541,11 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
case LV_THEME_SPINNER:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
@ -554,14 +554,14 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
case LV_THEME_SLIDER:
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
@ -569,9 +569,9 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
case LV_THEME_CHECKBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -579,15 +579,15 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_MSGBOX
|
||||
case LV_THEME_MSGBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -595,7 +595,7 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
#endif
|
||||
#if LV_USE_LED
|
||||
case LV_THEME_LED:
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
@ -603,44 +603,44 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->gray);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->gray);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
break;
|
||||
@ -648,13 +648,13 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_TILEVIEW
|
||||
case LV_THEME_TILEVIEW:
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = _lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
@ -662,10 +662,10 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
case LV_THEME_ROLLER:
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
@ -674,23 +674,23 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_OBJMASK
|
||||
case LV_THEME_OBJMASK:
|
||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
case LV_THEME_LIST:
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -698,17 +698,17 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
case LV_THEME_DROPDOWN:
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
@ -716,53 +716,53 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CHART
|
||||
case LV_THEME_CHART:
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN
|
||||
case LV_THEME_WIN:
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -770,17 +770,17 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
case LV_THEME_TEXTAREA:
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
_lv_style_list_add_style(list, &styles->gray);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
@ -788,15 +788,15 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_SPINBOX
|
||||
case LV_THEME_SPINBOX:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
@ -804,28 +804,28 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
case LV_THEME_CALENDAR:
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = _lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = _lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
@ -833,21 +833,21 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
case LV_THEME_LINEMETER:
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
@ -855,7 +855,7 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
}
|
||||
|
||||
lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -161,7 +161,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->dot_end = copy_ext->dot_end;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(new_label, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(new_label, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("label created");
|
||||
|
Loading…
x
Reference in New Issue
Block a user