1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

replaced #ifdef to #if

This commit is contained in:
František Horínek 2020-05-19 15:45:09 +02:00
parent 2712f0aeaa
commit 10ca6d4215
5 changed files with 30 additions and 25 deletions

View File

@ -257,6 +257,12 @@
#define LV_USE_GROUP 1
#endif
#if LV_USE_GROUP
/* 1: Enable to apply focus style to different object */
#ifndef LV_USE_GROUP_FOCUS_PARENT
#define LV_USE_GROUP_FOCUS_PARENT 1
#endif
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/

View File

@ -543,7 +543,7 @@ static void obj_to_foreground(lv_obj_t * obj)
}
#ifdef LV_USE_GROUP_FOCUS_PARENT
#if LV_USE_GROUP_FOCUS_PARENT
/**
* Set focus parent for the object (focus style will apply to parent, when child is focused)
* @param child Child object
@ -551,14 +551,13 @@ static void obj_to_foreground(lv_obj_t * obj)
*/
void lv_group_set_focus_parent(lv_obj_t * child, lv_obj_t * parent)
{
child->group_focus_parent = parent;
child->group_focus_parent = parent;
/*if the child is in focused state right now, set focus state to parent*/
if (lv_obj_is_focused(child))
{
lv_obj_clear_state(child, LV_STATE_FOCUSED | LV_STATE_EDITED);
lv_obj_set_state(parent, LV_STATE_FOCUSED);
}
/*if the child is in focused state right now, set focus state to parent*/
if(lv_obj_is_focused(child)) {
lv_obj_clear_state(child, LV_STATE_FOCUSED | LV_STATE_EDITED);
lv_obj_set_state(parent, LV_STATE_FOCUSED);
}
}
/**
@ -567,7 +566,7 @@ void lv_group_set_focus_parent(lv_obj_t * child, lv_obj_t * parent)
*/
void lv_group_remove_focus_parent(lv_obj_t * obj)
{
obj->group_focus_parent = NULL;
obj->group_focus_parent = NULL;
}
#endif

View File

@ -228,7 +228,7 @@ bool lv_group_get_click_focus(const lv_group_t * group);
*/
bool lv_group_get_wrap(lv_group_t * group);
#ifdef LV_USE_GROUP_FOCUS_PARENT
#if LV_USE_GROUP_FOCUS_PARENT
/**
* Set focus parent for the object (focus style will apply to parent, when child is focused)
* @param child Child object

View File

@ -299,7 +299,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->group_p = NULL;
#if LV_USE_GROUP_FOCUS_PARENT
new_obj->group_focus_parent = NULL;
new_obj->group_focus_parent = NULL;
#endif
#endif
@ -3621,9 +3621,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
#if LV_USE_GROUP_FOCUS_PARENT
/*if using focus mode, change target to parent*/
if (obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
if(obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
#endif
lv_obj_add_state(obj, state);
@ -3631,10 +3631,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
else {
#if LV_USE_GROUP_FOCUS_PARENT
/*if using focus mode, change target to parent*/
if (obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
/*if using focus mode, change target to parent*/
if(obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
#endif
lv_obj_add_state(obj, LV_STATE_FOCUSED);
lv_obj_clear_state(obj, LV_STATE_EDITED);
@ -3643,10 +3643,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_DEFOCUS) {
#if LV_USE_GROUP_FOCUS_PARENT
/*if using focus mode, change target to parent*/
if (obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
/*if using focus mode, change target to parent*/
if(obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
#endif
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED);

View File

@ -485,10 +485,10 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_
lv_anim_del(ext->scrl, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
#ifdef LV_USE_GROUP_FOCUS_PARENT
#if LV_USE_GROUP_FOCUS_PARENT
/*if using focus mode, change target to parent*/
if (obj->group_focus_parent) {
obj = obj->group_focus_parent;
if(obj->group_focus_parent) {
obj = obj->group_focus_parent;
}
#endif