BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
350ceddf
Commit
350ceddf
authored
Nov 15, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
name fixes
parent
86daac14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
177 additions
and
159 deletions
+177
-159
lv_obj.c
lv_obj/lv_obj.c
+35
-33
lv_obj.h
lv_obj/lv_obj.h
+8
-16
lv_style.c
lv_obj/lv_style.c
+44
-44
lv_style.h
lv_obj/lv_style.h
+5
-5
lv_btn.c
lv_objx/lv_btn.c
+5
-5
lv_btnm.c
lv_objx/lv_btnm.c
+5
-5
lv_line.c
lv_objx/lv_line.c
+1
-1
lv_list.c
lv_objx/lv_list.c
+6
-6
lv_list.h
lv_objx/lv_list.h
+1
-1
lv_mbox.c
lv_objx/lv_mbox.c
+16
-4
lv_mbox.h
lv_objx/lv_mbox.h
+7
-0
lv_slider.c
lv_objx/lv_slider.c
+1
-1
lv_slider.h
lv_objx/lv_slider.h
+1
-1
lv_sw.c
lv_objx/lv_sw.c
+1
-1
lv_sw.h
lv_objx/lv_sw.h
+1
-1
lv_win.c
lv_objx/lv_win.c
+0
-0
lv_win.h
lv_objx/lv_win.h
+40
-35
No files found.
lv_obj/lv_obj.c
View file @
350ceddf
...
...
@@ -34,6 +34,7 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj);
static
void
refresh_childen_style
(
lv_obj_t
*
obj
);
static
void
delete_children
(
lv_obj_t
*
obj
);
static
bool
lv_obj_design
(
lv_obj_t
*
obj
,
const
area_t
*
mask_p
,
lv_design_mode_t
mode
);
static
lv_res_t
lv_obj_signal
(
lv_obj_t
*
obj
,
lv_signal_t
sign
,
void
*
param
);
/**********************
* STATIC VARIABLES
...
...
@@ -247,8 +248,9 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
/**
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
* @preturn LV_RES_INV beacuse the object is deleted
*/
void
lv_obj_del
(
lv_obj_t
*
obj
)
lv_res_t
lv_obj_del
(
lv_obj_t
*
obj
)
{
lv_obj_invalidate
(
obj
);
...
...
@@ -308,6 +310,8 @@ void lv_obj_del(lv_obj_t * obj)
if
(
par
!=
NULL
)
{
par
->
signal_func
(
par
,
LV_SIGNAL_CHILD_CHG
,
NULL
);
}
return
LV_RES_INV
;
}
/**
...
...
@@ -322,41 +326,9 @@ void lv_obj_clear(lv_obj_t *obj)
lv_obj_del
(
child
);
child
=
lv_obj_get_child
(
obj
,
child
);
}
}
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return false: the object become invalid (e.g. deleted)
*/
bool
lv_obj_signal
(
lv_obj_t
*
obj
,
lv_signal_t
sign
,
void
*
param
)
{
bool
valid
=
true
;
lv_style_t
*
style
=
lv_obj_get_style
(
obj
);
switch
(
sign
)
{
case
LV_SIGNAL_CHILD_CHG
:
/*Return 'invalid' if the child change signal is not enabled*/
if
(
lv_obj_is_protected
(
obj
,
LV_PROTECT_CHILD_CHG
)
!=
false
)
valid
=
false
;
break
;
case
LV_SIGNAL_REFR_EXT_SIZE
:
if
(
style
->
body
.
shadow
.
width
>
obj
->
ext_size
)
obj
->
ext_size
=
style
->
body
.
shadow
.
width
;
break
;
case
LV_SIGNAL_STYLE_CHG
:
lv_obj_refresh_ext_size
(
obj
);
break
;
default:
break
;
}
return
valid
;
}
/**
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object
*/
...
...
@@ -1524,6 +1496,36 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
}
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static
lv_res_t
lv_obj_signal
(
lv_obj_t
*
obj
,
lv_signal_t
sign
,
void
*
param
)
{
lv_res_t
res
=
LV_RES_OK
;
lv_style_t
*
style
=
lv_obj_get_style
(
obj
);
switch
(
sign
)
{
case
LV_SIGNAL_CHILD_CHG
:
/*Return 'invalid' if the child change signal is not enabled*/
if
(
lv_obj_is_protected
(
obj
,
LV_PROTECT_CHILD_CHG
)
!=
false
)
res
=
LV_RES_INV
;
break
;
case
LV_SIGNAL_REFR_EXT_SIZE
:
if
(
style
->
body
.
shadow
.
width
>
obj
->
ext_size
)
obj
->
ext_size
=
style
->
body
.
shadow
.
width
;
break
;
case
LV_SIGNAL_STYLE_CHG
:
lv_obj_refresh_ext_size
(
obj
);
break
;
default:
break
;
}
return
res
;
}
/**
* Reposition the children of an object. (Called recursively)
* @param obj pointer to an object which children will be repositioned
* @param x_diff x coordinate shift
...
...
lv_obj/lv_obj.h
View file @
350ceddf
...
...
@@ -72,6 +72,12 @@ typedef bool (* lv_design_func_t) (struct __LV_OBJ_T * obj, const area_t * mask_
typedef
enum
{
LV_RES_INV
=
0
,
/*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK
,
/*The object is valid (no deleted) after the action*/
}
lv_res_t
;
typedef
enum
{
/*General signals*/
LV_SIGNAL_CLEANUP
,
LV_SIGNAL_CHILD_CHG
,
...
...
@@ -95,7 +101,7 @@ typedef enum
LV_SIGNAL_CONTROLL
,
}
lv_signal_t
;
typedef
bool
(
*
lv_signal_func_t
)
(
struct
__LV_OBJ_T
*
obj
,
lv_signal_t
sign
,
void
*
param
);
typedef
lv_res_t
(
*
lv_signal_func_t
)
(
struct
__LV_OBJ_T
*
obj
,
lv_signal_t
sign
,
void
*
param
);
typedef
struct
__LV_OBJ_T
{
...
...
@@ -134,12 +140,6 @@ typedef struct __LV_OBJ_T
#endif
}
lv_obj_t
;
typedef
enum
{
LV_RES_INV
=
0
,
/*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK
,
/*The object is valid (no deleted) after the action*/
}
lv_res_t
;
typedef
lv_res_t
(
*
lv_action_t
)
(
struct
__LV_OBJ_T
*
obj
);
/*Protect some attributes (max. 8 bit)*/
...
...
@@ -210,7 +210,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
*/
void
lv_obj_del
(
lv_obj_t
*
obj
);
lv_res_t
lv_obj_del
(
lv_obj_t
*
obj
);
/**
* Delete all children of an object
...
...
@@ -218,14 +218,6 @@ void lv_obj_del(lv_obj_t * obj);
*/
void
lv_obj_clear
(
lv_obj_t
*
obj
);
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return false: the object become invalid (e.g. deleted)
*/
bool
lv_obj_signal
(
lv_obj_t
*
obj
,
lv_signal_t
sign
,
void
*
param
);
/**
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
...
...
lv_obj/lv_style.c
View file @
350ceddf
...
...
@@ -45,11 +45,11 @@ lv_style_t lv_style_plain;
lv_style_t
lv_style_plain_color
;
lv_style_t
lv_style_pretty
;
lv_style_t
lv_style_pretty_color
;
lv_style_t
lv_style_btn_rel
eased
;
lv_style_t
lv_style_btn_pr
essed
;
lv_style_t
lv_style_btn_tgl_rel
eased
;
lv_style_t
lv_style_btn_tgl_pr
essed
;
lv_style_t
lv_style_btn_ina
ctive
;
lv_style_t
lv_style_btn_rel
;
lv_style_t
lv_style_btn_pr
;
lv_style_t
lv_style_btn_tgl_rel
;
lv_style_t
lv_style_btn_tgl_pr
;
lv_style_t
lv_style_btn_ina
;
/**********************
* MACROS
...
...
@@ -148,53 +148,53 @@ void lv_style_init (void)
lv_style_transp_tight
.
body
.
padding
.
inner
=
0
;
/*Button released style*/
memcpy
(
&
lv_style_btn_rel
eased
,
&
lv_style_plain
,
sizeof
(
lv_style_t
));
lv_style_btn_rel
eased
.
body
.
color_main
=
COLOR_MAKE
(
0x76
,
0xa2
,
0xd0
);
lv_style_btn_rel
eased
.
body
.
color_gradient
=
COLOR_MAKE
(
0x19
,
0x3a
,
0x5d
);
lv_style_btn_rel
eased
.
body
.
radius
=
LV_DPI
/
15
;
lv_style_btn_rel
eased
.
body
.
padding
.
hor
=
LV_DPI
/
4
;
lv_style_btn_rel
eased
.
body
.
padding
.
ver
=
LV_DPI
/
6
;
lv_style_btn_rel
eased
.
body
.
padding
.
inner
=
LV_DPI
/
10
;
lv_style_btn_rel
eased
.
body
.
border
.
color
=
COLOR_MAKE
(
0x0b
,
0x19
,
0x28
);
lv_style_btn_rel
eased
.
body
.
border
.
width
=
LV_DPI
/
50
>=
1
?
LV_DPI
/
50
:
1
;
lv_style_btn_rel
eased
.
body
.
border
.
opa
=
OPA_70
;
lv_style_btn_rel
eased
.
text
.
color
=
COLOR_MAKE
(
0xff
,
0xff
,
0xff
);
lv_style_btn_rel
eased
.
body
.
shadow
.
color
=
COLOR_GRAY
;
lv_style_btn_rel
eased
.
body
.
shadow
.
width
=
0
;
memcpy
(
&
lv_style_btn_rel
,
&
lv_style_plain
,
sizeof
(
lv_style_t
));
lv_style_btn_rel
.
body
.
color_main
=
COLOR_MAKE
(
0x76
,
0xa2
,
0xd0
);
lv_style_btn_rel
.
body
.
color_gradient
=
COLOR_MAKE
(
0x19
,
0x3a
,
0x5d
);
lv_style_btn_rel
.
body
.
radius
=
LV_DPI
/
15
;
lv_style_btn_rel
.
body
.
padding
.
hor
=
LV_DPI
/
4
;
lv_style_btn_rel
.
body
.
padding
.
ver
=
LV_DPI
/
6
;
lv_style_btn_rel
.
body
.
padding
.
inner
=
LV_DPI
/
10
;
lv_style_btn_rel
.
body
.
border
.
color
=
COLOR_MAKE
(
0x0b
,
0x19
,
0x28
);
lv_style_btn_rel
.
body
.
border
.
width
=
LV_DPI
/
50
>=
1
?
LV_DPI
/
50
:
1
;
lv_style_btn_rel
.
body
.
border
.
opa
=
OPA_70
;
lv_style_btn_rel
.
text
.
color
=
COLOR_MAKE
(
0xff
,
0xff
,
0xff
);
lv_style_btn_rel
.
body
.
shadow
.
color
=
COLOR_GRAY
;
lv_style_btn_rel
.
body
.
shadow
.
width
=
0
;
/*Button pressed style*/
memcpy
(
&
lv_style_btn_pr
essed
,
&
lv_style_btn_released
,
sizeof
(
lv_style_t
));
lv_style_btn_pr
essed
.
body
.
color_main
=
COLOR_MAKE
(
0x33
,
0x62
,
0x94
);
lv_style_btn_pr
essed
.
body
.
color_gradient
=
COLOR_MAKE
(
0x10
,
0x26
,
0x3c
);
lv_style_btn_pr
essed
.
text
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_pr
essed
.
image
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_pr
essed
.
line
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
memcpy
(
&
lv_style_btn_pr
,
&
lv_style_btn_rel
,
sizeof
(
lv_style_t
));
lv_style_btn_pr
.
body
.
color_main
=
COLOR_MAKE
(
0x33
,
0x62
,
0x94
);
lv_style_btn_pr
.
body
.
color_gradient
=
COLOR_MAKE
(
0x10
,
0x26
,
0x3c
);
lv_style_btn_pr
.
text
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_pr
.
image
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_pr
.
line
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
/*Button toggle released style*/
memcpy
(
&
lv_style_btn_tgl_rel
eased
,
&
lv_style_btn_released
,
sizeof
(
lv_style_t
));
lv_style_btn_tgl_rel
eased
.
body
.
color_main
=
COLOR_MAKE
(
0x0a
,
0x11
,
0x22
);
lv_style_btn_tgl_rel
eased
.
body
.
color_gradient
=
COLOR_MAKE
(
0x37
,
0x62
,
0x90
);
lv_style_btn_tgl_rel
eased
.
body
.
border
.
color
=
COLOR_MAKE
(
0x01
,
0x07
,
0x0d
);
lv_style_btn_tgl_rel
eased
.
text
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
lv_style_btn_tgl_rel
eased
.
image
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
lv_style_btn_tgl_rel
eased
.
line
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
memcpy
(
&
lv_style_btn_tgl_rel
,
&
lv_style_btn_rel
,
sizeof
(
lv_style_t
));
lv_style_btn_tgl_rel
.
body
.
color_main
=
COLOR_MAKE
(
0x0a
,
0x11
,
0x22
);
lv_style_btn_tgl_rel
.
body
.
color_gradient
=
COLOR_MAKE
(
0x37
,
0x62
,
0x90
);
lv_style_btn_tgl_rel
.
body
.
border
.
color
=
COLOR_MAKE
(
0x01
,
0x07
,
0x0d
);
lv_style_btn_tgl_rel
.
text
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
lv_style_btn_tgl_rel
.
image
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
lv_style_btn_tgl_rel
.
line
.
color
=
COLOR_MAKE
(
0xc8
,
0xdd
,
0xf4
);
/*Button toggle pressed style*/
memcpy
(
&
lv_style_btn_tgl_pr
essed
,
&
lv_style_btn_tgl_released
,
sizeof
(
lv_style_t
));
lv_style_btn_tgl_pr
essed
.
body
.
color_main
=
COLOR_MAKE
(
0x02
,
0x14
,
0x27
);
lv_style_btn_tgl_pr
essed
.
body
.
color_gradient
=
COLOR_MAKE
(
0x2b
,
0x4c
,
0x70
);
lv_style_btn_tgl_pr
essed
.
text
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_tgl_pr
essed
.
image
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_tgl_pr
essed
.
line
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
memcpy
(
&
lv_style_btn_tgl_pr
,
&
lv_style_btn_tgl_rel
,
sizeof
(
lv_style_t
));
lv_style_btn_tgl_pr
.
body
.
color_main
=
COLOR_MAKE
(
0x02
,
0x14
,
0x27
);
lv_style_btn_tgl_pr
.
body
.
color_gradient
=
COLOR_MAKE
(
0x2b
,
0x4c
,
0x70
);
lv_style_btn_tgl_pr
.
text
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_tgl_pr
.
image
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
lv_style_btn_tgl_pr
.
line
.
color
=
COLOR_MAKE
(
0xa4
,
0xb5
,
0xc6
);
/*Button inactive style*/
memcpy
(
&
lv_style_btn_ina
ctive
,
&
lv_style_btn_released
,
sizeof
(
lv_style_t
));
lv_style_btn_ina
ctive
.
body
.
color_main
=
COLOR_MAKE
(
0xd8
,
0xd8
,
0xd8
);
lv_style_btn_ina
ctive
.
body
.
color_gradient
=
COLOR_MAKE
(
0xd8
,
0xd8
,
0xd8
);
lv_style_btn_ina
ctive
.
body
.
border
.
color
=
COLOR_MAKE
(
0x90
,
0x90
,
0x90
);
lv_style_btn_ina
ctive
.
text
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
lv_style_btn_ina
ctive
.
image
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
lv_style_btn_ina
ctive
.
line
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
memcpy
(
&
lv_style_btn_ina
,
&
lv_style_btn_rel
,
sizeof
(
lv_style_t
));
lv_style_btn_ina
.
body
.
color_main
=
COLOR_MAKE
(
0xd8
,
0xd8
,
0xd8
);
lv_style_btn_ina
.
body
.
color_gradient
=
COLOR_MAKE
(
0xd8
,
0xd8
,
0xd8
);
lv_style_btn_ina
.
body
.
border
.
color
=
COLOR_MAKE
(
0x90
,
0x90
,
0x90
);
lv_style_btn_ina
.
text
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
lv_style_btn_ina
.
image
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
lv_style_btn_ina
.
line
.
color
=
COLOR_MAKE
(
0x70
,
0x70
,
0x70
);
}
...
...
lv_obj/lv_style.h
View file @
350ceddf
...
...
@@ -149,11 +149,11 @@ extern lv_style_t lv_style_plain;
extern
lv_style_t
lv_style_plain_color
;
extern
lv_style_t
lv_style_pretty
;
extern
lv_style_t
lv_style_pretty_color
;
extern
lv_style_t
lv_style_btn_rel
eased
;
extern
lv_style_t
lv_style_btn_pr
essed
;
extern
lv_style_t
lv_style_btn_tgl_rel
eased
;
extern
lv_style_t
lv_style_btn_tgl_pr
essed
;;
extern
lv_style_t
lv_style_btn_ina
ctive
;
extern
lv_style_t
lv_style_btn_rel
;
extern
lv_style_t
lv_style_btn_pr
;
extern
lv_style_t
lv_style_btn_tgl_rel
;
extern
lv_style_t
lv_style_btn_tgl_pr
;;
extern
lv_style_t
lv_style_btn_ina
;
/**********************
* MACROS
...
...
lv_objx/lv_btn.c
View file @
350ceddf
...
...
@@ -67,11 +67,11 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
actions
[
LV_BTN_ACTION_LONG_PRESS
]
=
NULL
;
ext
->
actions
[
LV_BTN_ACTION_LONG_PRESS_REPEATE
]
=
NULL
;
ext
->
styles
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
eased
;
ext
->
styles
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
essed
;
ext
->
styles
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
eased
;
ext
->
styles
[
LV_BTN_STATE_TGL_PR
]
=
&
lv_style_btn_tgl_pr
essed
;
ext
->
styles
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
ctive
;
ext
->
styles
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
;
ext
->
styles
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
;
ext
->
styles
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
;
ext
->
styles
[
LV_BTN_STATE_TGL_PR
]
=
&
lv_style_btn_tgl_pr
;
ext
->
styles
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
;
ext
->
long_press_action_executed
=
0
;
ext
->
toggle
=
0
;
...
...
lv_objx/lv_btnm.c
View file @
350ceddf
...
...
@@ -78,11 +78,11 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
action
=
NULL
;
ext
->
map_p
=
NULL
;
ext
->
toggle
=
0
;
ext
->
styles_btn
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
eased
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
essed
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
eased
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_PR
]
=
&
lv_style_btn_tgl_pr
essed
;
ext
->
styles_btn
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
ctive
;
ext
->
styles_btn
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_PR
]
=
&
lv_style_btn_tgl_pr
;
ext
->
styles_btn
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
;
if
(
ancestor_design_f
==
NULL
)
ancestor_design_f
=
lv_obj_get_design_func
(
new_btnm
);
...
...
lv_objx/lv_line.c
View file @
350ceddf
...
...
@@ -278,7 +278,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
lv_res_t
res
;
/* Include the ancient signal function */
res
=
lv_obj
_signal
(
line
,
sign
,
param
);
res
=
ancestor
_signal
(
line
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
return
res
;
...
...
lv_objx/lv_list.c
View file @
350ceddf
...
...
@@ -66,11 +66,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
dm_assert
(
ext
);
ext
->
style_img
=
NULL
;
ext
->
styles_btn
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
eased
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
essed
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
eased
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_tgl_pr
essed
;
ext
->
styles_btn
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
ctive
;
ext
->
styles_btn
[
LV_BTN_STATE_REL
]
=
&
lv_style_btn_rel
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_pr
;
ext
->
styles_btn
[
LV_BTN_STATE_TGL_REL
]
=
&
lv_style_btn_tgl_rel
;
ext
->
styles_btn
[
LV_BTN_STATE_PR
]
=
&
lv_style_btn_tgl_pr
;
ext
->
styles_btn
[
LV_BTN_STATE_INA
]
=
&
lv_style_btn_ina
;
ext
->
anim_time
=
LV_LIST_FOCUS_TIME
;
lv_obj_set_signal_func
(
new_list
,
lv_list_signal
);
...
...
@@ -311,7 +311,7 @@ uint16_t lv_list_get_anim_time(lv_obj_t *list)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t
*
lv_list_get_style
(
lv_obj_t
*
list
,
lv_
btn
_style_t
type
)
lv_style_t
*
lv_list_get_style
(
lv_obj_t
*
list
,
lv_
list
_style_t
type
)
{
lv_list_ext_t
*
ext
=
lv_obj_get_ext_attr
(
list
);
...
...
lv_objx/lv_list.h
View file @
350ceddf
...
...
@@ -167,7 +167,7 @@ static inline lv_page_sb_mode_t lv_list_get_sb_mode(lv_obj_t * list)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t
*
lv_list_get_style
(
lv_obj_t
*
list
,
lv_
btn
_style_t
type
);
lv_style_t
*
lv_list_get_style
(
lv_obj_t
*
list
,
lv_
list
_style_t
type
);
/*=====================
* Other functions
...
...
lv_objx/lv_mbox.c
View file @
350ceddf
...
...
@@ -136,6 +136,19 @@ void lv_mbox_set_text(lv_obj_t * mbox, const char * txt)
mbox_realign
(
mbox
);
}
/**
* Stop the action to call when button is released
* @param mbox pointer to a message box object
* @param pointer to an 'lv_btnm_action_t' action
*/
void
lv_mbox_set_action
(
lv_obj_t
*
mbox
,
lv_btnm_action_t
action
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext_attr
(
mbox
);
lv_btnm_set_action
(
ext
->
btnm
,
action
);
}
/**
* Set animation duration
* @param mbox pointer to a message box object
...
...
@@ -159,12 +172,12 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
if
(
ext
->
anim_time
!=
0
)
{
/*Add shrinking animations*/
lv_obj_animate
(
mbox
,
LV_ANIM_GROW_H
|
ANIM_OUT
,
ext
->
anim_time
,
delay
,
NULL
);
lv_obj_animate
(
mbox
,
LV_ANIM_GROW_V
|
ANIM_OUT
,
ext
->
anim_time
,
delay
,
lv_obj_del
);
lv_obj_animate
(
mbox
,
LV_ANIM_GROW_V
|
ANIM_OUT
,
ext
->
anim_time
,
delay
,
(
anim_cb_t
)
lv_obj_del
);
/*Disable fit to let shrinking work*/
lv_cont_set_fit
(
mbox
,
false
,
false
);
}
else
{
lv_obj_animate
(
mbox
,
LV_ANIM_NONE
,
ext
->
anim_time
,
delay
,
lv_obj_del
);
lv_obj_animate
(
mbox
,
LV_ANIM_NONE
,
ext
->
anim_time
,
delay
,
(
anim_cb_t
)
lv_obj_del
);
}
}
...
...
@@ -238,8 +251,7 @@ const char * lv_mbox_get_text(lv_obj_t * mbox)
*/
lv_obj_t
*
lv_mbox_get_from_btn
(
lv_obj_t
*
btn
)
{
lv_obj_t
*
btnh
=
lv_obj_get_parent
(
btn
);
lv_obj_t
*
mbox
=
lv_obj_get_parent
(
btnh
);
lv_obj_t
*
mbox
=
lv_obj_get_parent
(
btn
);
return
mbox
;
}
...
...
lv_objx/lv_mbox.h
View file @
350ceddf
...
...
@@ -103,6 +103,13 @@ void lv_mbox_set_btns(lv_obj_t * mbox, const char **btn_map, lv_btnm_action_t ac
void
lv_mbox_set_text
(
lv_obj_t
*
mbox
,
const
char
*
txt
);
/**
* Stop the action to call when button is released
* @param mbox pointer to a message box object
* @param pointer to an 'lv_btnm_action_t' action
*/
void
lv_mbox_set_action
(
lv_obj_t
*
mbox
,
lv_btnm_action_t
action
);
/**
* Set animation duration
* @param mbox pointer to a message box object
* @param time animation length in milliseconds (0: no animation)
...
...
lv_objx/lv_slider.c
View file @
350ceddf
...
...
@@ -186,7 +186,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t
*
lv_slider_get_style
(
lv_obj_t
*
slider
,
lv_
ba
r_style_t
type
)
lv_style_t
*
lv_slider_get_style
(
lv_obj_t
*
slider
,
lv_
slide
r_style_t
type
)
{
lv_slider_ext_t
*
ext
=
lv_obj_get_ext_attr
(
slider
);
...
...
lv_objx/lv_slider.h
View file @
350ceddf
...
...
@@ -179,7 +179,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t
*
lv_slider_get_style
(
lv_obj_t
*
slider
,
lv_
ba
r_style_t
type
);
lv_style_t
*
lv_slider_get_style
(
lv_obj_t
*
slider
,
lv_
slide
r_style_t
type
);
/**********************
* MACROS
...
...
lv_objx/lv_sw.c
View file @
350ceddf
...
...
@@ -148,7 +148,7 @@ void lv_sw_set_style(lv_obj_t *sw, lv_sw_style_t type, lv_style_t *style)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t
*
lv_sw_get_style
(
lv_obj_t
*
sw
,
lv_
bar
_style_t
type
)
lv_style_t
*
lv_sw_get_style
(
lv_obj_t
*
sw
,
lv_
sw
_style_t
type
)
{
lv_sw_ext_t
*
ext
=
lv_obj_get_ext_attr
(
sw
);
...
...
lv_objx/lv_sw.h
View file @
350ceddf
...
...
@@ -124,7 +124,7 @@ static inline lv_action_t lv_sw_get_action(lv_obj_t * slider)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t
*
lv_sw_get_style
(
lv_obj_t
*
sw
,
lv_
bar
_style_t
type
);
lv_style_t
*
lv_sw_get_style
(
lv_obj_t
*
sw
,
lv_
sw
_style_t
type
);
/**********************
* MACROS
...
...
lv_objx/lv_win.c
View file @
350ceddf
This diff is collapsed.
Click to expand it.
lv_objx/lv_win.h
View file @
350ceddf
...
...
@@ -57,13 +57,21 @@ typedef struct
lv_obj_t
*
page
;
/*Pointer to a page which holds the content*/
lv_obj_t
*
header
;
/*Pointer to the header container of the window*/
lv_obj_t
*
title
;
/*Pointer to the title label of the window*/
lv_obj_t
*
btnh
;
/*Pointer to the control button holder container of the window*/
lv_style_t
*
style_header
;
/*Style of the header container*/
lv_style_t
*
style_
c
btn_rel
;
/*Control button releases style*/
lv_style_t
*
style_
c
btn_pr
;
/*Control button pressed style*/
cord_t
c
btn_size
;
/*Size of the control buttons (square)*/
lv_style_t
*
style_btn_rel
;
/*Control button releases style*/
lv_style_t
*
style_btn_pr
;
/*Control button pressed style*/
cord_t
btn_size
;
/*Size of the control buttons (square)*/
}
lv_win_ext_t
;
typedef
enum
{
LV_WIN_STYLE_BG
,
LV_WIN_STYLE_CONTENT
,
LV_WIN_STYLE_SB
,
LV_WIN_STYLE_HEADER
,
LV_WIN_STYLE_BTN_REL
,
LV_WIN_STYLE_BTN_PR
,
}
lv_win_style_t
;
/**********************
* GLOBAL PROTOTYPES
**********************/
...
...
@@ -76,14 +84,10 @@ typedef struct
*/
lv_obj_t
*
lv_win_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
/**
* Signal function of the window
* @param win pointer to a window object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return true: the object is still valid (not deleted), false: the object become invalid
*/
bool
lv_win_signal
(
lv_obj_t
*
win
,
lv_signal_t
sign
,
void
*
param
);
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button to the header of the window
...
...
@@ -92,12 +96,15 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
* @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object
*/
lv_obj_t
*
lv_win_add_cbtn
(
lv_obj_t
*
win
,
const
char
*
img_path
,
lv_action_t
rel_action
);
lv_obj_t
*
lv_win_add_btn
(
lv_obj_t
*
win
,
const
char
*
img_path
,
lv_action_t
rel_action
);
/*=====================
* Setter functions
*====================*/
/**
* A release action which can be assigned to a window control button to close it
* @param btn pointer to the released button
* @param indev_proc pointer to the caller input device
* @return always LV_ACTION_RES_INV because the button is deleted with the window
*/
lv_res_t
lv_win_close_action
(
lv_obj_t
*
btn
);
...
...
@@ -114,15 +121,19 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
* @param win pointer to a window object
* @return control button size
*/
void
lv_win_set_
c
btn_size
(
lv_obj_t
*
win
,
cord_t
size
);
void
lv_win_set_btn_size
(
lv_obj_t
*
win
,
cord_t
size
);
/**
* Set
the styles of the window control buttons in a given state
* Set
a style of a window
* @param win pointer to a window object
* @param
rel pointer to the style in released state
* @param
pr pointer to the style in pressed stat
e
* @param
type which style should be set
* @param
style pointer to a styl
e
*/
void
lv_win_set_styles_cbtn
(
lv_obj_t
*
win
,
lv_style_t
*
rel
,
lv_style_t
*
pr
);
void
lv_win_set_style
(
lv_obj_t
*
win
,
lv_win_style_t
type
,
lv_style_t
*
style
);
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
...
...
@@ -132,25 +143,11 @@ void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
const
char
*
lv_win_get_title
(
lv_obj_t
*
win
);
/**
* Get the page of a window
* @param win pointer to a window object
* @return page pointer to the page object of the window
*/
lv_obj_t
*
lv_win_get_page
(
lv_obj_t
*
win
);
/**
* Get the s window header
* @param win pointer to a window object
* @return pointer to the window header object (lv_rect)
*/
lv_obj_t
*
lv_win_get_header
(
lv_obj_t
*
win
);
/**
* Get the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
cord_t
lv_win_get_
c
btn_size
(
lv_obj_t
*
win
);
cord_t
lv_win_get_btn_size
(
lv_obj_t
*
win
);
/**
* Get width of the content area (page scrollable) of the window
...
...
@@ -165,7 +162,15 @@ cord_t lv_win_get_width(lv_obj_t * win);
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t
*
lv_win_get_from_cbtn
(
lv_obj_t
*
ctrl_btn
);
lv_obj_t
*
lv_win_get_from_btn
(
lv_obj_t
*
ctrl_btn
);
/**
* Get a style of a window
* @param win pointer to a button object
* @param type which style window be get
* @return style pointer to a style
*/
lv_style_t
*
lv_win_get_style
(
lv_obj_t
*
win
,
lv_win_style_t
type
);
/**********************
* MACROS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment