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
659a641c
Commit
659a641c
authored
Jun 22, 2016
by
Kiss-Vamosi Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_btn style loading bugfux
parent
35605d87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
26 deletions
+21
-26
lv_btn.c
lv_objx/lv_btn.c
+20
-25
lvgl.h
lvgl.h
+1
-1
No files found.
lv_objx/lv_btn.c
View file @
659a641c
...
...
@@ -25,7 +25,7 @@
* STATIC PROTOTYPES
**********************/
static
bool
lv_btn_design
(
lv_obj_t
*
obj_dp
,
const
area_t
*
mask_p
,
lv_design_mode_t
mode
);
static
void
lv_btn_style_load
(
lv_obj_t
*
obj_dp
);
static
void
lv_btn_style_load
(
lv_obj_t
*
obj_dp
,
lv_rects_t
*
rects_p
);
/**********************
* STATIC VARIABLES
...
...
@@ -102,15 +102,15 @@ static lv_btns_t lv_btns_border =
*/
lv_obj_t
*
lv_btn_create
(
lv_obj_t
*
par_dp
,
lv_obj_t
*
copy_dp
)
{
lv_obj_t
*
new_obj
;
lv_obj_t
*
new_obj
_dp
;
new_obj
=
lv_rect_create
(
par_dp
,
copy_dp
);
new_obj
_dp
=
lv_rect_create
(
par_dp
,
copy_dp
);
/*Allocate the extended data*/
lv_obj_alloc_ext
(
new_obj
,
sizeof
(
lv_btn_ext_t
));
lv_obj_set_signal_f
(
new_obj
,
lv_btn_signal
);
lv_obj_set_design_f
(
new_obj
,
lv_btn_design
);
lv_obj_alloc_ext
(
new_obj
_dp
,
sizeof
(
lv_btn_ext_t
));
lv_obj_set_signal_f
(
new_obj
_dp
,
lv_btn_signal
);
lv_obj_set_design_f
(
new_obj
_dp
,
lv_btn_design
);
lv_btn_ext_t
*
btn_ext_dp
=
lv_obj_get_ext
(
new_obj
);
lv_btn_ext_t
*
btn_ext_dp
=
lv_obj_get_ext
(
new_obj
_dp
);
btn_ext_dp
->
lpr_exec
=
0
;
/*If no copy do the basic initialization*/
...
...
@@ -121,7 +121,7 @@ lv_obj_t* lv_btn_create(lv_obj_t* par_dp, lv_obj_t * copy_dp)
btn_ext_dp
->
rel_action
=
NULL
;
btn_ext_dp
->
lpr_action
=
NULL
;
btn_ext_dp
->
tgl
=
0
;
lv_obj_set_style
(
new_obj
,
&
lv_btns_def
);
lv_obj_set_style
(
new_obj
_dp
,
&
lv_btns_def
);
}
/*Copy 'copy_dp'*/
else
{
...
...
@@ -133,7 +133,7 @@ lv_obj_t* lv_btn_create(lv_obj_t* par_dp, lv_obj_t * copy_dp)
btn_ext_dp
->
tgl
=
ori_btn_ext
->
tgl
;
}
return
new_obj
;
return
new_obj
_dp
;
}
/**
...
...
@@ -146,11 +146,6 @@ bool lv_btn_signal(lv_obj_t * obj_dp, lv_signal_t sign, void* param)
{
bool
valid
;
/*Be sure the corresponding style is loaded*/
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_btn_style_load
(
obj_dp
);
}
/* Include the ancient signal function */
valid
=
lv_rect_signal
(
obj_dp
,
sign
,
param
);
...
...
@@ -222,10 +217,6 @@ bool lv_btn_signal(lv_obj_t * obj_dp, lv_signal_t sign, void* param)
btn_ext_dp
->
lpr_exec
=
1
;
valid
=
btn_ext_dp
->
lpr_action
(
obj_dp
,
param
);
}
break
;
case
LV_SIGNAL_STYLE_CHG
:
/*Load the currently active style*/
lv_btn_style_load
(
obj_dp
);
break
;
default:
/*Do nothing*/
...
...
@@ -262,7 +253,6 @@ void lv_btn_set_state(lv_obj_t* obj_dp, lv_btn_state_t state)
lv_btn_ext_t
*
btn_p
=
lv_obj_get_ext
(
obj_dp
);
btn_p
->
state
=
state
;
lv_btn_style_load
(
obj_dp
);
lv_obj_inv
(
obj_dp
);
}
...
...
@@ -403,8 +393,12 @@ static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
area_t
area
;
lv_obj_get_cords
(
obj_dp
,
&
area
);
lv_rects_t
rects_tmp
;
lv_btn_style_load
(
obj_dp
,
&
rects_tmp
);
/*Draw the rectangle*/
lv_draw_rect
(
&
area
,
mask_p
,
&
btns_p
->
rects
,
opa
);
lv_draw_rect
(
&
area
,
mask_p
,
&
rects_tmp
,
opa
);
return
true
;
}
...
...
@@ -413,15 +407,16 @@ static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
* Load the corresponding style according to the state to 'rects' in 'lv_btns_t'
* @param obj_dp pointer to a button object
*/
static
void
lv_btn_style_load
(
lv_obj_t
*
obj_dp
)
static
void
lv_btn_style_load
(
lv_obj_t
*
obj_dp
,
lv_rects_t
*
rects_p
)
{
lv_btn_state_t
state
=
lv_btn_get_state
(
obj_dp
);
lv_btns_t
*
btns_p
=
lv_obj_get_style
(
obj_dp
);
/*Init the style*/
btns_p
->
rects
.
objs
.
color
=
btns_p
->
mcolor
[
state
];
btns_p
->
rects
.
gcolor
=
btns_p
->
gcolor
[
state
];
btns_p
->
rects
.
bcolor
=
btns_p
->
bcolor
[
state
];
/*Load the style*/
memcpy
(
rects_p
,
&
btns_p
->
rects
,
sizeof
(
lv_rects_t
));
rects_p
->
objs
.
color
=
btns_p
->
mcolor
[
state
];
rects_p
->
gcolor
=
btns_p
->
gcolor
[
state
];
rects_p
->
bcolor
=
btns_p
->
bcolor
[
state
];
}
#endif
lvgl.h
View file @
659a641c
...
...
@@ -22,7 +22,7 @@
*********************/
#define LVGL_VERSION_MAJOR 1
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_BUGFIX
1
#define LVGL_VERSION_BUGFIX
2
/**********************
* TYPEDEFS
...
...
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