mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
rename lv_objx/ to lv_widgets/
This commit is contained in:
parent
c9855c3028
commit
8a1a5e524f
66
lvgl.h
66
lvgl.h
@ -36,39 +36,39 @@ extern "C" {
|
||||
#include "src/lv_misc/lv_bidi.h"
|
||||
#include "src/lv_misc/lv_printf.h"
|
||||
|
||||
#include "src/lv_objx/lv_btn.h"
|
||||
#include "src/lv_objx/lv_imgbtn.h"
|
||||
#include "src/lv_objx/lv_img.h"
|
||||
#include "src/lv_objx/lv_label.h"
|
||||
#include "src/lv_objx/lv_line.h"
|
||||
#include "src/lv_objx/lv_page.h"
|
||||
#include "src/lv_objx/lv_cont.h"
|
||||
#include "src/lv_objx/lv_list.h"
|
||||
#include "src/lv_objx/lv_chart.h"
|
||||
#include "src/lv_objx/lv_table.h"
|
||||
#include "src/lv_objx/lv_checkbox.h"
|
||||
#include "src/lv_objx/lv_cpicker.h"
|
||||
#include "src/lv_objx/lv_bar.h"
|
||||
#include "src/lv_objx/lv_slider.h"
|
||||
#include "src/lv_objx/lv_led.h"
|
||||
#include "src/lv_objx/lv_btnmatrix.h"
|
||||
#include "src/lv_objx/lv_keyboard.h"
|
||||
#include "src/lv_objx/lv_dropdown.h"
|
||||
#include "src/lv_objx/lv_roller.h"
|
||||
#include "src/lv_objx/lv_textarea.h"
|
||||
#include "src/lv_objx/lv_canvas.h"
|
||||
#include "src/lv_objx/lv_win.h"
|
||||
#include "src/lv_objx/lv_tabview.h"
|
||||
#include "src/lv_objx/lv_tileview.h"
|
||||
#include "src/lv_objx/lv_msgbox.h"
|
||||
#include "src/lv_objx/lv_objmask.h"
|
||||
#include "src/lv_objx/lv_gauge.h"
|
||||
#include "src/lv_objx/lv_linemeter.h"
|
||||
#include "src/lv_objx/lv_switch.h"
|
||||
#include "src/lv_objx/lv_arc.h"
|
||||
#include "src/lv_objx/lv_preload.h"
|
||||
#include "src/lv_objx/lv_calendar.h"
|
||||
#include "src/lv_objx/lv_spinbox.h"
|
||||
#include "src/lv_widgets/lv_btn.h"
|
||||
#include "src/lv_widgets/lv_imgbtn.h"
|
||||
#include "src/lv_widgets/lv_img.h"
|
||||
#include "src/lv_widgets/lv_label.h"
|
||||
#include "src/lv_widgets/lv_line.h"
|
||||
#include "src/lv_widgets/lv_page.h"
|
||||
#include "src/lv_widgets/lv_cont.h"
|
||||
#include "src/lv_widgets/lv_list.h"
|
||||
#include "src/lv_widgets/lv_chart.h"
|
||||
#include "src/lv_widgets/lv_table.h"
|
||||
#include "src/lv_widgets/lv_checkbox.h"
|
||||
#include "src/lv_widgets/lv_cpicker.h"
|
||||
#include "src/lv_widgets/lv_bar.h"
|
||||
#include "src/lv_widgets/lv_slider.h"
|
||||
#include "src/lv_widgets/lv_led.h"
|
||||
#include "src/lv_widgets/lv_btnmatrix.h"
|
||||
#include "src/lv_widgets/lv_keyboard.h"
|
||||
#include "src/lv_widgets/lv_dropdown.h"
|
||||
#include "src/lv_widgets/lv_roller.h"
|
||||
#include "src/lv_widgets/lv_textarea.h"
|
||||
#include "src/lv_widgets/lv_canvas.h"
|
||||
#include "src/lv_widgets/lv_win.h"
|
||||
#include "src/lv_widgets/lv_tabview.h"
|
||||
#include "src/lv_widgets/lv_tileview.h"
|
||||
#include "src/lv_widgets/lv_msgbox.h"
|
||||
#include "src/lv_widgets/lv_objmask.h"
|
||||
#include "src/lv_widgets/lv_gauge.h"
|
||||
#include "src/lv_widgets/lv_linemeter.h"
|
||||
#include "src/lv_widgets/lv_switch.h"
|
||||
#include "src/lv_widgets/lv_arc.h"
|
||||
#include "src/lv_widgets/lv_preload.h"
|
||||
#include "src/lv_widgets/lv_calendar.h"
|
||||
#include "src/lv_widgets/lv_spinbox.h"
|
||||
|
||||
#include "src/lv_draw/lv_img_cache.h"
|
||||
|
||||
|
@ -1068,55 +1068,12 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
*--------------------*/
|
||||
|
||||
/**
|
||||
* Set a new style for an object
|
||||
* Add a new stye to the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param style_p pointer to the new style
|
||||
* @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_set_style(lv_obj_t * obj, const lv_style_t * style)
|
||||
//{
|
||||
// LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
// if(style) {
|
||||
// LV_ASSERT_STYLE(style);
|
||||
// }
|
||||
//
|
||||
// obj->style_p = style;
|
||||
//
|
||||
// /*Send a signal about style change to every children with NULL style*/
|
||||
// refresh_children_style(obj);
|
||||
//
|
||||
// /*Notify the object about the style change too*/
|
||||
// lv_obj_refresh_style(obj);
|
||||
//}
|
||||
|
||||
|
||||
void lv_obj_set_style_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_color(style_dsc, prop, color);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_int(style_dsc, prop, value);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_opa(style_dsc, prop, opa);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * p)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_ptr(style_dsc, prop, p);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
|
||||
{
|
||||
if(style == NULL) return;
|
||||
@ -1132,8 +1089,13 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
|
||||
void lv_obj_reset_style(lv_obj_t * obj, uint8_t part)
|
||||
/**
|
||||
* Remove all styles from the objects style list. Also reset the local styles
|
||||
* @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)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
if(style_dsc == NULL) {
|
||||
@ -1146,6 +1108,81 @@ void lv_obj_reset_style(lv_obj_t * obj, uint8_t part)
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_int(style_dsc, prop, value);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_color(style_dsc, prop, color);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_opa(style_dsc, prop, opa);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * p)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_ptr(style_dsc, prop, p);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify an object (and its children) about its style is modified
|
||||
@ -1312,6 +1349,11 @@ void lv_obj_set_parent_event(lv_obj_t * obj, bool en)
|
||||
obj->parent_event = (en == true ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base direction of the object
|
||||
* @param obj pointer to an object
|
||||
* @param dir the new base direction. `LV_BIDI_DIR_LTR/RTL/AUTO/INHERIT`
|
||||
*/
|
||||
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir)
|
||||
{
|
||||
if(dir != LV_BIDI_DIR_LTR && dir != LV_BIDI_DIR_RTL &&
|
||||
@ -1334,7 +1376,7 @@ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir)
|
||||
* @param obj pointer to an object
|
||||
* @param prot 'OR'-ed values from `lv_protect_t`
|
||||
*/
|
||||
void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot)
|
||||
void lv_obj_add_protect(lv_obj_t * obj, uint8_t prot)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
@ -1354,6 +1396,13 @@ void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot)
|
||||
obj->protect &= prot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state (fully overwrite) of an object.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the new state
|
||||
*/
|
||||
void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
{
|
||||
if(obj->state_dsc.act == new_state) return;
|
||||
@ -1395,6 +1444,13 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a given state or states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the state bits to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
@ -1405,6 +1461,13 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a given state or states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the state bits to remove. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
@ -1999,8 +2062,21 @@ lv_style_list_t * lv_obj_get_style_list(const lv_obj_t * obj, uint8_t part)
|
||||
return info.result;
|
||||
}
|
||||
|
||||
|
||||
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_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)
|
||||
{
|
||||
lv_style_property_t prop_ori = prop;
|
||||
|
||||
@ -2075,9 +2151,21 @@ lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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_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)
|
||||
{
|
||||
lv_style_property_t prop_ori = prop;
|
||||
|
||||
@ -2129,7 +2217,21 @@ lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_p
|
||||
return LV_COLOR_BLACK;
|
||||
}
|
||||
|
||||
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_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)
|
||||
{
|
||||
lv_style_property_t prop_ori = prop;
|
||||
|
||||
@ -2175,24 +2277,28 @@ lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prope
|
||||
/*Handle unset values*/
|
||||
prop = prop & (~LV_STYLE_STATE_MASK);
|
||||
switch(prop) {
|
||||
case LV_STYLE_OPA_SCALE:
|
||||
case LV_STYLE_TEXT_OPA:
|
||||
case LV_STYLE_IMAGE_OPA:
|
||||
case LV_STYLE_LINE_OPA:
|
||||
case LV_STYLE_BORDER_OPA:
|
||||
case LV_STYLE_OUTLINE_OPA:
|
||||
case LV_STYLE_SHADOW_OPA:
|
||||
case LV_STYLE_PATTERN_OPA:
|
||||
case LV_STYLE_VALUE_OPA:
|
||||
return LV_OPA_COVER;
|
||||
case LV_STYLE_BG_OPA:
|
||||
return LV_OPA_TRANSP;
|
||||
}
|
||||
|
||||
return LV_OPA_TRANSP;
|
||||
|
||||
return LV_OPA_COVER;
|
||||
}
|
||||
|
||||
|
||||
const void * lv_obj_get_style_ptr(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)
|
||||
{
|
||||
lv_style_property_t prop_ori = prop;
|
||||
|
||||
|
@ -477,23 +477,21 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
*--------------------*/
|
||||
|
||||
/**
|
||||
* Set a new style for an object
|
||||
* Add a new stye to the style list of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param style_p pointer to the new style
|
||||
* @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_set_style(lv_obj_t * obj, const lv_style_t * style);
|
||||
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
|
||||
|
||||
void lv_obj_set_style_color(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_color_t color);
|
||||
|
||||
void lv_obj_set_style_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_opa_t opa);
|
||||
|
||||
void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * p);
|
||||
|
||||
void lv_obj_add_style(lv_obj_t * obj, uint8_t type, lv_style_t * style);
|
||||
|
||||
void lv_obj_reset_style(lv_obj_t * obj, uint8_t type);
|
||||
/**
|
||||
* Remove all styles from the objects style list. Also reset the local styles
|
||||
* @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 about its style is modified
|
||||
@ -508,6 +506,62 @@ void lv_obj_refresh_style(lv_obj_t * obj);
|
||||
*/
|
||||
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_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_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_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_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * value);
|
||||
|
||||
/*-----------------
|
||||
* Attribute set
|
||||
*----------------*/
|
||||
@ -585,32 +639,19 @@ void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en);
|
||||
*/
|
||||
void lv_obj_set_parent_event(lv_obj_t * obj, bool en);
|
||||
|
||||
|
||||
/**
|
||||
* Set the base direction of the object
|
||||
* @param obj pointer to an object
|
||||
* @param dir the new base direction. `LV_BIDI_DIR_LTR/RTL/AUTO/INHERIT`
|
||||
*/
|
||||
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir);
|
||||
|
||||
/**
|
||||
* Set the opa scale enable parameter (required to set opa_scale with `lv_obj_set_opa_scale()`)
|
||||
* @param obj pointer to an object
|
||||
* @param en true: opa scaling is enabled for this object and all children; false: no opa scaling
|
||||
*/
|
||||
void lv_obj_set_opa_scale_enable(lv_obj_t * obj, bool en);
|
||||
|
||||
/**
|
||||
* Set the opa scale of an object.
|
||||
* The opacity of this object and all it's children will be scaled down with this factor.
|
||||
* `lv_obj_set_opa_scale_enable(obj, true)` needs to be called to enable it.
|
||||
* (not for all children just for the parent where to start the opa scaling)
|
||||
* @param obj pointer to an object
|
||||
* @param opa_scale a factor to scale down opacity [0..255]
|
||||
*/
|
||||
void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale);
|
||||
|
||||
/**
|
||||
* Set a bit or bits in the protect filed
|
||||
* @param obj pointer to an object
|
||||
* @param prot 'OR'-ed values from `lv_protect_t`
|
||||
*/
|
||||
void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot);
|
||||
void lv_obj_add_protect(lv_obj_t * obj, uint8_t prot);
|
||||
|
||||
/**
|
||||
* Clear a bit or bits in the protect filed
|
||||
@ -619,10 +660,31 @@ void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot);
|
||||
*/
|
||||
void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot);
|
||||
|
||||
/**
|
||||
* Set the state (fully overwrite) of an object.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the new state
|
||||
*/
|
||||
void lv_obj_set_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
* Add a given state or states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the state bits to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
* Remove a given state or states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles a transition animation will be started
|
||||
* from the previous state to the current
|
||||
* @param obj pointer to an object
|
||||
* @param state the state bits to remove. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
@ -869,113 +931,199 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
|
||||
* Appearance get
|
||||
*---------------*/
|
||||
|
||||
lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
||||
/**
|
||||
* Get the style list of an obejct'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);
|
||||
|
||||
lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t type, 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_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);
|
||||
|
||||
lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t type, 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);
|
||||
|
||||
const void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t type, 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);
|
||||
|
||||
lv_style_list_t * lv_obj_get_style_list(const lv_obj_t * obj, uint8_t type);
|
||||
/**
|
||||
* Macro to declare the most important style set/get API functions.
|
||||
*
|
||||
* - Get the value of a style property from an object in the object's current state.
|
||||
* If there is a transition animation in progress calculate the value accordingly.
|
||||
* If the property is not set in the object's style check the parent(s) if the property can be inherited
|
||||
* If still not found return a default value.
|
||||
* For example:
|
||||
* `lv_obj_get_style_border_width(btn1, LV_BTN_PART_MAIN);`
|
||||
*
|
||||
* - Set a local style property for an object in a given state
|
||||
* For example:
|
||||
* `lv_obj_set_style_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
|
||||
*
|
||||
* - Get the value from a style in a given state:
|
||||
* For example
|
||||
* `int16_t weight = lv_style_get_border_width(&style1, LV_STATE_PRESSED, &result);`
|
||||
* `if(weight > 0) ...the property is found and loaded into result...`
|
||||
*
|
||||
* - Set a value in a style in a given state
|
||||
* For example
|
||||
* `lv_style_set_border_width(&style1, LV_STATE_PRESSED, 2);`
|
||||
*/
|
||||
|
||||
#define LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type) \
|
||||
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type) \
|
||||
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
|
||||
{ \
|
||||
return (value_type) lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
||||
return (value_type) _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
||||
} \
|
||||
static inline void lv_obj_set_style_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
|
||||
{ \
|
||||
lv_obj_set_style##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||
_lv_obj_set_style##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||
} \
|
||||
static inline int16_t lv_style_get_##func_name (lv_style_t * style, lv_state_t state, void * res) \
|
||||
{ \
|
||||
return lv_style_get##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
||||
return _lv_style_get##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
||||
} \
|
||||
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
|
||||
{ \
|
||||
lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||
} \
|
||||
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t,_int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t , _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_X, shadow_offset_x, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_Y, shadow_offset_y, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int );
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int );
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int );
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, font, const lv_font_t * , _ptr);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_COLOR, scale_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color);
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color);
|
||||
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t,_int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t , _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_X, shadow_offset_x, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_Y, shadow_offset_y, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int );
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int );
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int );
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, font, const lv_font_t * , _ptr);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_COLOR, scale_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color);
|
||||
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color);
|
||||
|
||||
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
|
||||
/*-----------------
|
||||
* Attribute get
|
||||
*----------------*/
|
||||
|
@ -71,8 +71,7 @@ void lv_style_init(lv_style_t * style)
|
||||
*/
|
||||
void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
|
||||
{
|
||||
lv_style_init(style_dest);
|
||||
|
||||
if(style_src == NULL) return;
|
||||
if(style_src->map == NULL) return;
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style_src);
|
||||
@ -114,7 +113,7 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
|
||||
lv_style_t * local_style = get_local_style(list_dest);
|
||||
lv_style_copy(local_style, (lv_style_t *)get_local_style(list_src));
|
||||
lv_style_copy(local_style, get_local_style((lv_style_t *)list_src));
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,7 +249,17 @@ uint16_t lv_style_get_mem_size(const lv_style_t * style)
|
||||
return i + sizeof(lv_style_property_t);
|
||||
}
|
||||
|
||||
void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value)
|
||||
/**
|
||||
* Set an integer typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
@ -284,7 +293,17 @@ void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int
|
||||
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color)
|
||||
/**
|
||||
* Set a color typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
@ -319,7 +338,17 @@ void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t
|
||||
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa)
|
||||
/**
|
||||
* Set an opacity typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
@ -354,7 +383,17 @@ void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa
|
||||
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
|
||||
/**
|
||||
* Set a pointer typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_POINTER | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_width()`
|
||||
* @note for performance reasons it's not checked if the property is really has pointer type
|
||||
*/
|
||||
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
|
||||
{
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
@ -400,7 +439,7 @@ void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void *
|
||||
* Higher number is means better fit
|
||||
* -1 if the not found (`res` will be undefined)
|
||||
*/
|
||||
int16_t lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res)
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res)
|
||||
{
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
@ -419,8 +458,20 @@ int16_t lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int16_t lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res)
|
||||
/**
|
||||
* Get an opacity typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res)
|
||||
{
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
@ -439,7 +490,20 @@ int16_t lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_
|
||||
}
|
||||
}
|
||||
|
||||
int16_t lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res)
|
||||
/**
|
||||
* Get a color typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res)
|
||||
{
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
@ -458,8 +522,20 @@ int16_t lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, l
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res)
|
||||
/**
|
||||
* Get a pointer typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_text_font()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res)
|
||||
{
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
@ -479,32 +555,74 @@ int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, voi
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a local integer typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_int(local, prop, value);
|
||||
_lv_style_set_int(local, prop, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a local opacity typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_opa(local, prop, value);
|
||||
_lv_style_set_opa(local, prop, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a local color typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_color(local, prop, value);
|
||||
_lv_style_set_color(local, prop, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a local pointer typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @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 for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_ptr(local, prop, value);
|
||||
_lv_style_set_ptr(local, prop, value);
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * value)
|
||||
/**
|
||||
* Get an integer typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res)
|
||||
{
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
@ -521,16 +639,16 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_int(class, prop, &value_act);
|
||||
weight_act = _lv_style_get_int(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,8 +657,18 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
|
||||
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * value)
|
||||
/**
|
||||
* Get a color typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res)
|
||||
{
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
@ -557,16 +685,16 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_color(class, prop, &value_act);
|
||||
weight_act = _lv_style_get_color(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,9 +702,18 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * value)
|
||||
/**
|
||||
* Get an opacity typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA| (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res)
|
||||
{
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
@ -593,16 +730,16 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_opa(class, prop, &value_act);
|
||||
weight_act = _lv_style_get_opa(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
}
|
||||
}
|
||||
|
||||
@ -610,8 +747,18 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** value)
|
||||
/**
|
||||
* Get a pointer typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** res)
|
||||
{
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
@ -628,16 +775,16 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_ptr(class, prop, &value_act);
|
||||
weight_act = _lv_style_get_ptr(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
*res = value_act;
|
||||
}
|
||||
}
|
||||
|
||||
@ -649,6 +796,14 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get a property's index (byte index in `style->map`) from a style.
|
||||
* Return best matching property's index considering the state of `prop`
|
||||
* @param style pointer to a style
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @return
|
||||
*/
|
||||
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop)
|
||||
{
|
||||
if(style->map == NULL) return -1;
|
||||
@ -663,20 +818,20 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
|
||||
size_t i = 0;
|
||||
while(style->map[i] != _LV_STYLE_CLOSEING_PROP) {
|
||||
if(style->map[i] == id_to_find) {
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act.full = style->map[i + 1];
|
||||
lv_style_attr_t attr_i;
|
||||
attr_i.full = style->map[i + 1];
|
||||
|
||||
/*If the state perfectly matches return this property*/
|
||||
if(attr_act.bits.state == attr.bits.state) {
|
||||
if(attr_i.bits.state == attr.bits.state) {
|
||||
return i;
|
||||
}
|
||||
/* Be sure the property not specifies other state than the requested.
|
||||
* E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/
|
||||
else if((attr_act.bits.state & (~attr.bits.state)) == 0) {
|
||||
else if((attr_i.bits.state & (~attr.bits.state)) == 0) {
|
||||
/* Use this property if it describes better the requested state than the current candidate.
|
||||
* E.g. for HOVER+FOCUS+PRESS prefer HOVER+FOCUS over FOCUS*/
|
||||
if(attr_act.bits.state > weight) {
|
||||
weight = attr_act.bits.state;
|
||||
if(attr_i.bits.state > weight) {
|
||||
weight = attr_i.bits.state;
|
||||
id_guess = i;
|
||||
}
|
||||
}
|
||||
@ -694,13 +849,15 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
|
||||
return id_guess;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get he local style from a style list. Allocate it if not exists yet.
|
||||
* @param list pointer to a style list
|
||||
* @return pointer to the local style
|
||||
*/
|
||||
static lv_style_t * get_local_style(lv_style_list_t * list)
|
||||
{
|
||||
|
||||
if(list->has_local) return lv_style_list_get_style(list, 0);
|
||||
|
||||
|
||||
lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
LV_ASSERT_MEM(local_style);
|
||||
if(local_style == NULL) {
|
||||
|
@ -242,7 +242,6 @@ static inline lv_style_t * lv_style_list_get_style(lv_style_list_t * list, uint8
|
||||
if(list->style_cnt == 0 || id >= list->style_cnt) return NULL;
|
||||
|
||||
return list->style_list[id];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -266,35 +265,205 @@ uint16_t lv_style_get_mem_size(const lv_style_t * style);
|
||||
void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
|
||||
|
||||
/**
|
||||
* Mix two styles according to a given ratio
|
||||
* @param start start style
|
||||
* @param end end style
|
||||
* @param res store the result style here
|
||||
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
|
||||
* Set an integer typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t * res, uint16_t ratio);
|
||||
void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value);
|
||||
void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color);
|
||||
void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa);
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
|
||||
/**
|
||||
* Set a color typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color);
|
||||
|
||||
int16_t lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res);
|
||||
int16_t lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
|
||||
int16_t lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res);
|
||||
int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res);
|
||||
/**
|
||||
* Set an opacity typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa);
|
||||
|
||||
void lv_style_list_set_local_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t value);
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t value);
|
||||
void lv_style_list_set_local_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t value);
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * dsc, lv_style_property_t prop, const void * value);
|
||||
/**
|
||||
* Set a pointer typed property in a style.
|
||||
* @param style pointer to a style where the property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_POINTER | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note shouldn't be used directly. Use the specific property set functions instead.
|
||||
* For example: `lv_style_set_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
|
||||
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t * value);
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t * value);
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t * value);
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * dsc, lv_style_property_t prop, void ** value);
|
||||
/**
|
||||
* Get an integer typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res);
|
||||
|
||||
lv_opa_t lv_style_get_def_opa(lv_style_property_t prop);
|
||||
/**
|
||||
* Get a color typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res);
|
||||
|
||||
/**
|
||||
* Get an opacity typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
|
||||
|
||||
/**
|
||||
* Get a pointer typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result value
|
||||
* @return -1: the property wasn't found in the style.
|
||||
* The matching state bits of the desired state (in `prop`) and the best matching property's state
|
||||
* Higher value means match in higher precedence state.
|
||||
* @note shouldn't be used directly. Use the specific property get functions instead.
|
||||
* For example: `lv_style_get_text_font()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res);
|
||||
|
||||
/**
|
||||
* Set a local integer typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
/**
|
||||
* Set a local color typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value);
|
||||
|
||||
/**
|
||||
* Set a local opacity typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value);
|
||||
|
||||
/**
|
||||
* Set a local pointer typed property in a style list.
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @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 for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value);
|
||||
|
||||
/**
|
||||
* Get an integer typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res);
|
||||
|
||||
/**
|
||||
* Get a color typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res);
|
||||
|
||||
|
||||
/**
|
||||
* Get an opacity typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res);
|
||||
|
||||
/**
|
||||
* Get a pointer typed property from a style list.
|
||||
* It will return the property which match best with given state.
|
||||
* @param list pointer to a style list from where the property should be get
|
||||
* @param prop a style property ORed with a state.
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @param res pointer to a buffer to store the result
|
||||
* @return LV_RES_OK: there was a matching property in the list
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** res);
|
||||
|
||||
/*************************
|
||||
* GLOBAL VARIABLES
|
||||
@ -307,12 +476,13 @@ lv_opa_t lv_style_get_def_opa(lv_style_property_t prop);
|
||||
/**
|
||||
* Create and initialize a `static` style
|
||||
* Example:
|
||||
* LV_STYLE_CREATE(my_style, &lv_style_plain);
|
||||
* LV_STYLE_CREATE(my_style, &style_to_copy);
|
||||
* is equivalent to
|
||||
* static lv_style_t my_style;
|
||||
* lv_style_init(&my_style);
|
||||
* lv_style_copy(&my_style, &style_to_copy);
|
||||
*/
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name);
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -145,8 +145,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
disp->act_scr = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
|
||||
disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
|
||||
disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
|
||||
lv_obj_reset_style(disp->top_layer, LV_OBJ_PART_MAIN);
|
||||
lv_obj_reset_style(disp->sys_layer, LV_OBJ_PART_MAIN);
|
||||
lv_obj_reset_style_list(disp->top_layer, LV_OBJ_PART_MAIN);
|
||||
lv_obj_reset_style_list(disp->sys_layer, LV_OBJ_PART_MAIN);
|
||||
lv_obj_set_click(disp->top_layer, false);
|
||||
lv_obj_set_click(disp->sys_layer, false);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include "lv_theme.h"
|
||||
#include "../lv_objx/lv_img.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
|
||||
#if LV_USE_THEME_ALIEN
|
||||
@ -525,6 +525,10 @@ static void btnm_init(void)
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
lv_style_init(&kb_btn);
|
||||
lv_style_copy(&kb_btn, &btnm_btn);
|
||||
lv_style_set_radius(&kb_btn, LV_STATE_NORMAL, LV_DPI / 50);
|
||||
|
||||
lv_style_init(&kb_bg);
|
||||
lv_style_copy(&kb_bg, &panel);
|
||||
lv_style_set_pad_inner(&kb_bg, LV_STATE_NORMAL, LV_DPI/20);
|
||||
|
@ -391,7 +391,7 @@ void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t * btnm, lv_btnmatrix_ctrl_t ctrl)
|
||||
* @param btn_id 0 based index of the button to modify.
|
||||
* @param width Relative width compared to the buttons in the same row. [1..7]
|
||||
*/
|
||||
void lv_btnmatrix_set_btn_width(const lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
|
||||
void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
|
||||
{
|
||||
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
|
||||
|
@ -169,7 +169,7 @@ void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t * btnm, lv_btnmatrix_ctrl_t ctrl);
|
||||
* @param btn_id 0 based index of the button to modify.
|
||||
* @param width Relative width compared to the buttons in the same row. [1..7]
|
||||
*/
|
||||
void lv_btnmatrix_set_btn_width(const lv_obj_t * btnm, uint16_t btn_id, uint8_t width);
|
||||
void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width);
|
||||
|
||||
/**
|
||||
* Make the button matrix like a selector widget (only one button may be toggled at a time).
|
@ -18,7 +18,7 @@ extern "C" {
|
||||
#if LV_USE_CANVAS != 0
|
||||
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_objx/lv_img.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_draw/lv_draw_img.h"
|
||||
|
||||
/*********************
|
@ -81,7 +81,7 @@ lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_btn_set_layout(cb, LV_LAYOUT_ROW_MID);
|
||||
lv_btn_set_fit(cb, LV_FIT_TIGHT);
|
||||
lv_btn_set_checkable(cb, true);
|
||||
lv_obj_set_protect(cb, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(cb, LV_PROTECT_PRESS_LOST);
|
||||
|
||||
lv_theme_apply(cb, LV_THEME_CHECKBOX);
|
||||
|
@ -367,7 +367,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_obj_add_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
/* Align the children */
|
||||
lv_coord_t last_cord = top;
|
||||
LV_LL_READ_BACK(cont->child_ll, child)
|
||||
@ -416,7 +416,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_obj_add_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
lv_coord_t last_cord;
|
||||
@ -462,7 +462,7 @@ static void lv_cont_layout_center(lv_obj_t * cont)
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_obj_add_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
lv_coord_t last_cord = -(h_tot / 2);
|
||||
@ -495,7 +495,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
child_rs = lv_ll_get_tail(&cont->child_ll); /*Set the row starter child*/
|
||||
if(child_rs == NULL) return; /*Return if no child*/
|
||||
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_obj_add_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_coord_t left = lv_obj_get_style_pad_left(cont, LV_CONT_PART_MAIN);
|
||||
lv_coord_t right = lv_obj_get_style_pad_right(cont, LV_CONT_PART_MAIN);
|
||||
lv_coord_t inner = lv_obj_get_style_pad_inner(cont, LV_CONT_PART_MAIN);
|
||||
@ -598,7 +598,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
lv_obj_add_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
lv_coord_t left = lv_obj_get_style_pad_left(cont, LV_CONT_PART_MAIN);
|
@ -129,7 +129,7 @@ lv_obj_t * lv_cpicker_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*If no copy do the basic initialization*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(cpicker, LV_DPI * 2, LV_DPI * 2);
|
||||
lv_obj_set_protect(cpicker, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(cpicker, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_set_adv_hittest(cpicker, true);
|
||||
lv_theme_apply(cpicker, LV_THEME_CPICKER);
|
||||
}
|
@ -449,8 +449,8 @@ void lv_dropdown_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
if(ext->page) return;
|
||||
|
||||
ext->page = lv_page_create(lv_obj_get_screen(ddlist), NULL);
|
||||
lv_obj_set_protect(ext->page, LV_PROTECT_POS | LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_set_protect(lv_page_get_scrl(ext->page), LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_protect(ext->page, LV_PROTECT_POS | LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_protect(lv_page_get_scrl(ext->page), LV_PROTECT_CLICK_FOCUS);
|
||||
|
||||
if(ancestor_page_signal == NULL) ancestor_page_signal = lv_obj_get_signal_cb(ext->page);
|
||||
if(ancestor_page_scrl_signal == NULL) ancestor_page_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(ext->page));
|
||||
@ -486,10 +486,6 @@ void lv_dropdown_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
|
||||
pos_selected(ddlist);
|
||||
|
||||
lv_disp_t * disp = lv_obj_get_disp(ddlist);
|
||||
lv_coord_t vres = lv_disp_get_ver_res(disp);
|
||||
lv_coord_t hres = lv_disp_get_hor_res(disp);
|
||||
|
||||
if(ext->dir == LV_DROPDOWN_DIR_DOWN) lv_obj_align(ext->page, ddlist, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
else if(ext->dir == LV_DROPDOWN_DIR_UP) lv_obj_align(ext->page, ddlist, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
else if(ext->dir == LV_DROPDOWN_DIR_LEFT) lv_obj_align(ext->page, ddlist, LV_ALIGN_OUT_LEFT_TOP, 0, 0);
|
@ -26,9 +26,9 @@ extern "C" {
|
||||
#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_objx/lv_btn.h"
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_objx/lv_label.h"
|
||||
#include "../lv_widgets/lv_btn.h"
|
||||
#include "../lv_widgets/lv_page.h"
|
||||
#include "../lv_widgets/lv_label.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
@ -135,18 +135,6 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
|
||||
*/
|
||||
void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
|
||||
|
||||
/**
|
||||
* Set the styles of a gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param type which style should be set (can be only `LV_GAUGE_STYLE_MAIN`)
|
||||
* @param style set the style of the gauge
|
||||
* */
|
||||
static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style)
|
||||
{
|
||||
(void)type; /*Unused*/
|
||||
lv_obj_set_style(gauge, style);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
@ -146,7 +146,7 @@ lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_align(kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_set_event_cb(kb, lv_keyboard_def_event_cb);
|
||||
lv_obj_set_base_dir(kb, LV_BIDI_DIR_LTR);
|
||||
lv_obj_set_protect(kb, LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_protect(kb, LV_PROTECT_CLICK_FOCUS);
|
||||
|
||||
lv_btnmatrix_set_map(kb, kb_map[ext->mode]);
|
||||
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[ext->mode]);
|
@ -102,8 +102,6 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_theme_apply(list, LV_THEME_LIST);
|
||||
|
||||
} else {
|
||||
lv_list_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
|
||||
lv_obj_t * copy_btn = lv_list_get_next_btn(copy, NULL);
|
||||
while(copy_btn) {
|
||||
const void * img_src = NULL;
|
||||
@ -157,8 +155,6 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
|
||||
lv_coord_t pos_x_ori = lv_obj_get_x(list);
|
||||
lv_coord_t pos_y_ori = lv_obj_get_y(list);
|
||||
|
||||
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
/*Create a list element with the image an the text*/
|
||||
lv_obj_t * btn;
|
||||
btn = lv_btn_create(list, NULL);
|
||||
@ -187,7 +183,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
|
||||
}
|
||||
|
||||
|
||||
lv_obj_set_protect(btn, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_set_signal_cb(btn, lv_list_btn_signal);
|
||||
|
||||
#if LV_USE_IMG != 0
|
@ -149,7 +149,7 @@ void lv_msgbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
|
||||
if(ext->btnm == NULL) {
|
||||
ext->btnm = lv_btnmatrix_create(mbox, NULL);
|
||||
|
||||
lv_theme_alien_apply(mbox, LV_THEME_MSGBOX_BTNS);
|
||||
lv_theme_apply(mbox, LV_THEME_MSGBOX_BTNS);
|
||||
}
|
||||
|
||||
lv_btnmatrix_set_map(ext->btnm, btn_map);
|
@ -18,7 +18,7 @@ extern "C" {
|
||||
#if LV_USE_OBJMASK != 0
|
||||
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_objx/lv_cont.h"
|
||||
#include "../lv_widgets/lv_cont.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
@ -6,7 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_widgets/lv_page.h"
|
||||
#if LV_USE_PAGE != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
@ -118,7 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->scrl = lv_cont_create(page, NULL);
|
||||
lv_obj_set_drag(ext->scrl, true);
|
||||
lv_obj_set_drag_throw(ext->scrl, true);
|
||||
lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
||||
lv_cont_set_fit4(ext->scrl, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX);
|
||||
lv_obj_set_event_cb(ext->scrl, scrl_def_event_cb); /*Propagate some event to the background
|
||||
object by default for convenience */
|
@ -39,7 +39,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_design_res_t lv_spinner_design(lv_obj_t * preload, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_spinner_signal(lv_obj_t * preload, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@ -91,7 +90,6 @@ lv_obj_t * lv_spinner_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(preload, lv_spinner_signal);
|
||||
// lv_obj_set_design_cb(preload, lv_spinner_design);
|
||||
|
||||
/*Init the new spinner spinner*/
|
||||
if(copy == NULL) {
|
||||
@ -328,60 +326,6 @@ void lv_spinner_spinner_anim(void * ptr, lv_anim_value_t val)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the pre loaders
|
||||
* @param preload pointer to an object
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static lv_design_res_t lv_spinner_design(lv_obj_t * preload, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
// /*Return false if the object is not covers the mask_p area*/
|
||||
// if(mode == LV_DESIGN_COVER_CHK) {
|
||||
// return LV_DESIGN_RES_NOT_COVER;
|
||||
// }
|
||||
// /*Draw the object*/
|
||||
// else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
//
|
||||
// /*Draw a circle as background*/
|
||||
// const lv_style_t * style = lv_arc_get_style(preload, LV_ARC_STYLE_MAIN);
|
||||
// if(style->body.border.width > 0) {
|
||||
// lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(preload), lv_obj_get_height(preload))) / 2;
|
||||
// r -= LV_MATH_MIN(style->body.padding.left, style->body.padding.top);
|
||||
//
|
||||
// lv_coord_t x = preload->coords.x1 + lv_obj_get_width(preload) / 2;
|
||||
// lv_coord_t y = preload->coords.y1 + lv_obj_get_height(preload) / 2;
|
||||
//
|
||||
// lv_style_t bg_style;
|
||||
// lv_style_copy(&bg_style, &lv_style_plain);
|
||||
// bg_style.body.opa = LV_OPA_TRANSP;
|
||||
// bg_style.body.radius = LV_RADIUS_CIRCLE;
|
||||
// bg_style.body.border.color = style->body.border.color;
|
||||
// bg_style.body.border.width = style->body.border.width;
|
||||
// bg_style.body.border.opa = style->body.border.opa;
|
||||
//
|
||||
// lv_area_t bg_area;
|
||||
// bg_area.x1 = x - r;
|
||||
// bg_area.y1 = y - r;
|
||||
// bg_area.x2 = x + r;
|
||||
// bg_area.y2 = y + r;
|
||||
//
|
||||
// lv_draw_rect(&bg_area, clip_area, &bg_style, lv_obj_get_opa_scale(preload));
|
||||
// }
|
||||
// /*Draw the arc above the background circle */
|
||||
// ancestor_design(preload, clip_area, mode);
|
||||
// }
|
||||
// /*Post draw when the children are drawn*/
|
||||
// else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
// }
|
||||
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal function of the pre loader
|
||||
* @param preload pointer to a pre loader object
|
@ -88,7 +88,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Init the new slider slider*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_slider, true);
|
||||
lv_obj_set_protect(new_slider, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(new_slider, LV_PROTECT_PRESS_LOST);
|
||||
|
||||
lv_theme_apply(new_slider, LV_THEME_SLIDER);
|
||||
lv_obj_set_height(new_slider, LV_DPI / 15);
|
@ -23,7 +23,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_objx/lv_ta.h"
|
||||
#include "../lv_widgets/lv_ta.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
@ -88,7 +88,7 @@ lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Init the new switch switch*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(sw, true);
|
||||
lv_obj_set_protect(sw, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_protect(sw, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_set_size(sw, LV_DPI / 2, LV_DPI / 4);
|
||||
lv_bar_set_range(sw, 0, 1);
|
||||
|
@ -27,8 +27,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_objx/lv_win.h"
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_widgets/lv_win.h"
|
||||
#include "../lv_widgets/lv_page.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
@ -762,7 +762,7 @@ void lv_textarea_set_one_line(lv_obj_t * ta, bool en)
|
||||
|
||||
placeholder_update(ta);
|
||||
/* `refr_cursor_area` is called at the end of lv_ta_set_text_align */
|
||||
lv_ta_set_text_align(ta, old_align);
|
||||
lv_textarea_set_text_align(ta, old_align);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1684,8 +1684,8 @@ static void refr_cursor_area(lv_obj_t * ta)
|
||||
{
|
||||
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TEXTAREA_PART_BG, LV_STYLE_TEXT_FONT);
|
||||
lv_style_int_t line_space = lv_obj_get_style_int(ta, LV_TEXTAREA_PART_BG, LV_STYLE_TEXT_LINE_SPACE);
|
||||
const lv_font_t * font = _lv_obj_get_style_ptr(ta, LV_TEXTAREA_PART_BG, LV_STYLE_TEXT_FONT);
|
||||
lv_style_int_t line_space = _lv_obj_get_style_int(ta, LV_TEXTAREA_PART_BG, LV_STYLE_TEXT_LINE_SPACE);
|
||||
|
||||
uint16_t cur_pos = lv_textarea_get_cursor_pos(ta);
|
||||
const char * txt = lv_label_get_text(ext->label);
|
@ -112,17 +112,13 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
lv_obj_set_size(new_tileview, w, h);
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> dev-7.0
|
||||
lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), true);
|
||||
lv_obj_set_drag_dir(lv_page_get_scrl(new_tileview), LV_DRAG_DIR_ONE);
|
||||
|
||||
lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT);
|
||||
|
||||
lv_obj_reset_style(new_tileview, LV_PAGE_PART_SCRL);
|
||||
lv_theme_alien_apply(new_tileview, LV_THEME_TILEVIEW);
|
||||
lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCRL);
|
||||
lv_theme_apply(new_tileview, LV_THEME_TILEVIEW);
|
||||
}
|
||||
/*Copy an existing tileview*/
|
||||
else {
|
@ -17,7 +17,7 @@ extern "C" {
|
||||
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_widgets/lv_page.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
@ -93,14 +93,14 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_size(new_win, w, h);
|
||||
|
||||
ext->page = lv_page_create(new_win, NULL);
|
||||
lv_obj_set_protect(ext->page, LV_PROTECT_PARENT);
|
||||
lv_obj_add_protect(ext->page, LV_PROTECT_PARENT);
|
||||
lv_page_set_sb_mode(ext->page, LV_SB_MODE_AUTO);
|
||||
lv_style_list_reset(lv_obj_get_style_list(ext->page, LV_PAGE_PART_BG));
|
||||
|
||||
/*Create a holder for the header*/
|
||||
ext->header = lv_obj_create(new_win, NULL);
|
||||
/*Move back to window background because it's automatically moved to the content page*/
|
||||
lv_obj_set_protect(ext->header, LV_PROTECT_PARENT);
|
||||
lv_obj_add_protect(ext->header, LV_PROTECT_PARENT);
|
||||
lv_obj_set_parent(ext->header, new_win);
|
||||
if(ancestor_header_design == NULL) ancestor_header_design= lv_obj_get_design_cb(ext->header);
|
||||
lv_obj_set_height(ext->header, LV_DPI / 2);
|
||||
@ -467,7 +467,6 @@ static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t *
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(header, LV_OBJ_PART_MAIN);
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(header, LV_OBJ_PART_MAIN);
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
Loading…
x
Reference in New Issue
Block a user