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
d93844bd
Commit
d93844bd
authored
Apr 13, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_rect renamed to lv_cont (container)
parent
092c0da4
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
331 additions
and
334 deletions
+331
-334
lv_app.c
lv_app/lv_app.c
+10
-10
lv_app_fsel.c
lv_app/lv_app_util/lv_app_fsel.c
+1
-2
lv_app_notice.c
lv_app/lv_app_util/lv_app_notice.c
+3
-3
lv_app_files.c
lv_appx/lv_app_files.c
+7
-7
lv_app_sysmon.c
lv_appx/lv_app_sysmon.c
+2
-4
lv_app_terminal.c
lv_appx/lv_app_terminal.c
+2
-2
lv_draw.c
lv_draw/lv_draw.c
+24
-24
lv_draw.h
lv_draw/lv_draw.h
+1
-1
lv_obj.c
lv_obj/lv_obj.c
+1
-1
lv_bar.c
lv_objx/lv_bar.c
+2
-2
lv_bar.h
lv_objx/lv_bar.h
+1
-1
lv_btn.c
lv_objx/lv_btn.c
+3
-3
lv_btn.h
lv_objx/lv_btn.h
+2
-2
lv_btnm.c
lv_objx/lv_btnm.c
+2
-2
lv_btnm.h
lv_objx/lv_btnm.h
+2
-2
lv_cb.c
lv_objx/lv_cb.c
+2
-2
lv_chart.c
lv_objx/lv_chart.c
+14
-14
lv_chart.h
lv_objx/lv_chart.h
+1
-1
lv_cont.c
lv_objx/lv_cont.c
+153
-155
lv_cont.h
lv_objx/lv_cont.h
+41
-41
lv_ddlist.c
lv_objx/lv_ddlist.c
+1
-1
lv_gauge.c
lv_objx/lv_gauge.c
+5
-4
lv_gauge.h
lv_objx/lv_gauge.h
+1
-1
lv_img.c
lv_objx/lv_img.c
+1
-1
lv_led.c
lv_objx/lv_led.c
+3
-3
lv_led.h
lv_objx/lv_led.h
+1
-1
lv_line.c
lv_objx/lv_line.c
+2
-2
lv_list.c
lv_objx/lv_list.c
+5
-5
lv_mbox.c
lv_objx/lv_mbox.c
+9
-9
lv_mbox.h
lv_objx/lv_mbox.h
+2
-2
lv_page.c
lv_objx/lv_page.c
+8
-8
lv_page.h
lv_objx/lv_page.h
+4
-4
lv_slider.c
lv_objx/lv_slider.c
+2
-1
lv_win.c
lv_objx/lv_win.c
+8
-8
lv_win.h
lv_objx/lv_win.h
+4
-4
lvgl.h
lvgl.h
+1
-1
No files found.
lv_app/lv_app.c
View file @
d93844bd
...
...
@@ -257,7 +257,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
lv_obj_set_free_p
(
app
->
sc
,
app
);
lv_btn_set_styles
(
app
->
sc
,
&
app_style
.
sc_rel
,
&
app_style
.
sc_pr
,
NULL
,
NULL
,
NULL
);
lv_obj_set_size
(
app
->
sc
,
LV_APP_SC_WIDTH
,
LV_APP_SC_HEIGHT
);
lv_
rect_set_layout
(
app
->
sc
,
LV_REC
T_LAYOUT_OFF
);
lv_
cont_set_layout
(
app
->
sc
,
LV_CON
T_LAYOUT_OFF
);
lv_btn_set_rel_action
(
app
->
sc
,
lv_app_sc_rel_action
);
lv_btn_set_lpr_action
(
app
->
sc
,
lv_app_sc_lpr_action
);
...
...
@@ -545,23 +545,23 @@ lv_app_style_t * lv_app_style_get(void)
static
void
lv_app_init_desktop
(
void
)
{
/*Menu on the top*/
menuh
=
lv_
rec
t_create
(
lv_scr_act
(),
NULL
);
menuh
=
lv_
con
t_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_width
(
menuh
,
LV_HOR_RES
);
lv_
rec
t_set_fit
(
menuh
,
false
,
true
);
lv_
con
t_set_fit
(
menuh
,
false
,
true
);
lv_obj_set_style
(
menuh
,
&
app_style
.
menu
);
app_btn
=
lv_btn_create
(
menuh
,
NULL
);
lv_btn_set_styles
(
app_btn
,
&
app_style
.
menu_btn_rel
,
&
app_style
.
menu_btn_pr
,
NULL
,
NULL
,
NULL
);
lv_
rec
t_set_fit
(
app_btn
,
true
,
true
);
lv_
con
t_set_fit
(
app_btn
,
true
,
true
);
lv_btn_set_rel_action
(
app_btn
,
lv_app_menu_rel_action
);
lv_obj_t
*
app_label
=
lv_label_create
(
app_btn
,
NULL
);
lv_label_set_text
(
app_label
,
"Apps"
);
lv_obj_set_pos
(
app_btn
,
0
,
0
);
lv_obj_set_pos
(
menuh
,
0
,
0
);
/*
sys_apph = lv_
rec
t_create(menuh, NULL);
lv_
rect_set_layout(sys_apph, LV_REC
T_LAYOUT_ROW_M);
lv_
rec
t_set_fit(sys_apph, true, false);
sys_apph = lv_
con
t_create(menuh, NULL);
lv_
cont_set_layout(sys_apph, LV_CON
T_LAYOUT_ROW_M);
lv_
con
t_set_fit(sys_apph, true, false);
lv_obj_set_style(sys_apph, lv_rects_get(LV_RECTS_TRANSP, NULL));
lv_obj_t * clock = lv_label_create(sys_apph, NULL);
lv_obj_set_style(clock, &app_style.menu_btn_label);
...
...
@@ -576,8 +576,8 @@ static void lv_app_init_desktop(void)
lv_obj_set_size
(
sc_page
,
LV_HOR_RES
,
LV_VER_RES
-
lv_obj_get_height
(
menuh
));
lv_obj_set_pos
(
sc_page
,
0
,
lv_obj_get_height
(
menuh
));
lv_obj_set_width
(
lv_page_get_scrl
(
sc_page
),
LV_HOR_RES
-
20
);
lv_
rec
t_set_fit
(
lv_page_get_scrl
(
sc_page
),
false
,
true
);
lv_
rect_set_layout
(
lv_page_get_scrl
(
sc_page
),
LV_REC
T_LAYOUT_GRID
);
lv_
con
t_set_fit
(
lv_page_get_scrl
(
sc_page
),
false
,
true
);
lv_
cont_set_layout
(
lv_page_get_scrl
(
sc_page
),
LV_CON
T_LAYOUT_GRID
);
lv_page_set_rel_action
(
sc_page
,
lv_app_sc_page_rel_action
);
lv_page_set_sb_mode
(
sc_page
,
LV_PAGE_SB_MODE_AUTO
);
...
...
@@ -849,7 +849,7 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d
sprintf
(
buf
,
"%s settings"
,
app
->
dsc
->
name
);
lv_win_set_title
(
app
->
conf_win
,
buf
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
app
->
conf_win
);
lv_
rect_set_layout
(
scrl
,
LV_REC
T_LAYOUT_COL_L
);
lv_
cont_set_layout
(
scrl
,
LV_CON
T_LAYOUT_COL_L
);
lv_win_add_ctrl_btn
(
app
->
conf_win
,
"U:/icon_close"
,
lv_win_close_action
);
...
...
lv_app/lv_app_util/lv_app_fsel.c
View file @
d93844bd
...
...
@@ -91,7 +91,6 @@ void lv_app_fsel_open(const char * path, const char * filter, void * param, void
if
(
fsel_filter
==
NULL
)
fsel_filter
=
""
;
/*Create a window for the File selector*/
lv_app_style_t
*
app_style
=
lv_app_style_get
();
fsel_win
=
lv_win_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_size
(
fsel_win
,
LV_HOR_RES
,
LV_VER_RES
);
...
...
@@ -142,7 +141,7 @@ static void fsel_refr(void)
//TODO lv_obj_set_style(fsel_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_obj_set_drag_parent
(
fsel_list
,
true
);
lv_obj_set_drag_parent
(
lv_page_get_scrl
(
fsel_list
),
true
);
lv_
rec
t_set_fit
(
fsel_list
,
false
,
true
);
lv_
con
t_set_fit
(
fsel_list
,
false
,
true
);
fs_res_t
res
=
FS_RES_OK
;
...
...
lv_app/lv_app_util/lv_app_notice.c
View file @
d93844bd
...
...
@@ -9,7 +9,7 @@
#include "lv_app_notice.h"
#if LV_APP_ENABLE != 0
#include
"lvgl/lv_objx/lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lvgl/lv_objx/lv_label.h"
#include "lvgl/lv_misc/anim.h"
...
...
@@ -56,12 +56,12 @@ static lv_obj_t * notice_h;
*/
void
lv_app_notice_init
(
void
)
{
notice_h
=
lv_
rec
t_create
(
lv_scr_act
(),
NULL
);
notice_h
=
lv_
con
t_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_size
(
notice_h
,
LV_HOR_RES
,
LV_VER_RES
-
LV_DPI
);
lv_obj_set_y
(
notice_h
,
LV_DPI
);
lv_obj_set_click
(
notice_h
,
false
);
lv_obj_set_style
(
notice_h
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_
rect_set_layout
(
notice_h
,
LV_REC
T_LAYOUT_COL_R
);
lv_
cont_set_layout
(
notice_h
,
LV_CON
T_LAYOUT_COL_R
);
}
/**
...
...
lv_appx/lv_app_files.c
View file @
d93844bd
...
...
@@ -299,11 +299,11 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
/*Create a text area to type chunk size*/
lv_obj_t
*
val_set_h
;
val_set_h
=
lv_
rec
t_create
(
conf_win
,
NULL
);
val_set_h
=
lv_
con
t_create
(
conf_win
,
NULL
);
lv_obj_set_style
(
val_set_h
,
lv_style_get
(
LV_STYLE_PLAIN_COLOR
,
NULL
));
lv_obj_set_click
(
val_set_h
,
false
);
lv_
rec
t_set_fit
(
val_set_h
,
true
,
true
);
lv_
rect_set_layout
(
val_set_h
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
val_set_h
,
true
,
true
);
lv_
cont_set_layout
(
val_set_h
,
LV_CON
T_LAYOUT_ROW_M
);
lv_obj_t
*
label
;
label
=
lv_label_create
(
val_set_h
,
NULL
);
...
...
@@ -312,7 +312,7 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
lv_obj_t
*
ta
;
char
buf
[
32
];
ta
=
lv_ta_create
(
val_set_h
,
NULL
);
lv_
rec
t_set_fit
(
ta
,
false
,
true
);
lv_
con
t_set_fit
(
ta
,
false
,
true
);
lv_obj_set_free_num
(
ta
,
SEND_SETTINGS_CHUNK_SIZE
);
lv_obj_set_free_p
(
ta
,
app
);
lv_page_set_rel_action
(
ta
,
win_send_settings_element_rel_action
);
...
...
@@ -320,7 +320,7 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
lv_ta_set_text
(
ta
,
buf
);
/*Create a text area to type the chunk delay*/
val_set_h
=
lv_
rec
t_create
(
conf_win
,
val_set_h
);
val_set_h
=
lv_
con
t_create
(
conf_win
,
val_set_h
);
label
=
lv_label_create
(
val_set_h
,
NULL
);
lv_label_set_text
(
label
,
"Inter-chunk delay"
);
...
...
@@ -353,8 +353,8 @@ static void win_create_list(lv_app_inst_t * app)
//TODO lv_obj_set_style(win_data->file_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_obj_set_drag_parent
(
win_data
->
file_list
,
true
);
lv_obj_set_drag_parent
(
lv_page_get_scrl
(
win_data
->
file_list
),
true
);
lv_
rec
t_set_fit
(
win_data
->
file_list
,
false
,
true
);
lv_
rect_set_layout
(
lv_page_get_scrl
(
win_data
->
file_list
),
LV_REC
T_LAYOUT_COL_L
);
lv_
con
t_set_fit
(
win_data
->
file_list
,
false
,
true
);
lv_
cont_set_layout
(
lv_page_get_scrl
(
win_data
->
file_list
),
LV_CON
T_LAYOUT_COL_L
);
}
/**
...
...
lv_appx/lv_app_sysmon.c
View file @
d93844bd
...
...
@@ -308,8 +308,7 @@ static void sysmon_task(void * param)
static
bool
mem_warn_report
=
false
;
if
(
mem_mon
.
size_free
<
LV_APP_SYSMON_MEM_WARN
&&
mem_warn_report
==
false
)
{
mem_warn_report
=
true
;
lv_obj_t
*
not
=
lv_app_notice_add
(
"Critically low memory"
);
//TODO lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
lv_app_notice_add
(
"Critically low memory"
);
}
if
(
mem_mon
.
size_free
>
LV_APP_SYSMON_MEM_WARN
)
mem_warn_report
=
false
;
...
...
@@ -318,8 +317,7 @@ static void sysmon_task(void * param)
if
(
mem_mon
.
pct_frag
>
LV_APP_SYSMON_FRAG_WARN
)
{
if
(
frag_warn_report
==
false
)
{
frag_warn_report
=
true
;
lv_obj_t
*
not
=
lv_app_notice_add
(
"Critical memory
\n
fragmentation"
);
//TODO lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
lv_app_notice_add
(
"Critical memory
\n
fragmentation"
);
dm_defrag
();
/*Defrag. if the fragmentation is critical*/
}
...
...
lv_appx/lv_app_terminal.c
View file @
d93844bd
...
...
@@ -12,10 +12,10 @@
#include <lvgl/lv_obj/lv_dispi.h>
#include <lvgl/lv_obj/lv_obj.h>
#include <lvgl/lv_objx/lv_btn.h>
#include <lvgl/lv_objx/lv_cont.h>
#include <lvgl/lv_objx/lv_ddlist.h>
#include <lvgl/lv_objx/lv_label.h>
#include <lvgl/lv_objx/lv_page.h>
#include <lvgl/lv_objx/lv_rect.h>
#include <lvgl/lv_objx/lv_ta.h>
#include <misc/others/color.h>
#include <stdbool.h>
...
...
@@ -263,7 +263,7 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
/*Create a clear button*/
win_data
->
clear_btn
=
lv_btn_create
(
win
,
NULL
);
lv_
rec
t_set_fit
(
win_data
->
clear_btn
,
true
,
true
);
lv_
con
t_set_fit
(
win_data
->
clear_btn
,
true
,
true
);
lv_obj_set_free_p
(
win_data
->
clear_btn
,
app
);
lv_btn_set_rel_action
(
win_data
->
clear_btn
,
win_clear_rel_action
);
lv_obj_t
*
btn_label
=
lv_label_create
(
win_data
->
clear_btn
,
NULL
);
...
...
lv_draw/lv_draw.c
View file @
d93844bd
...
...
@@ -43,12 +43,12 @@ typedef enum
* STATIC PROTOTYPES
**********************/
#if USE_LV_RECT != 0
static
void
lv_draw_
rec
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
rec
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
rec
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
rec
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
rec
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
uint16_t
lv_draw_
rec
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
);
static
void
lv_draw_
con
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
con
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
con
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
con
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
con
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
uint16_t
lv_draw_
con
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
);
#endif
/*USE_LV_RECT != 0*/
...
...
@@ -90,23 +90,23 @@ void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_
if
(
area_get_height
(
cords_p
)
<
1
||
area_get_width
(
cords_p
)
<
1
)
return
;
if
(
style_p
->
empty
==
0
){
lv_draw_
rec
t_main_mid
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_main_mid
(
cords_p
,
mask_p
,
style_p
);
if
(
style_p
->
radius
!=
0
)
{
lv_draw_
rec
t_main_corner
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_main_corner
(
cords_p
,
mask_p
,
style_p
);
}
}
if
(
style_p
->
bwidth
!=
0
)
{
lv_draw_
rec
t_border_straight
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_border_straight
(
cords_p
,
mask_p
,
style_p
);
if
(
style_p
->
radius
!=
0
)
{
lv_draw_
rec
t_border_corner
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_border_corner
(
cords_p
,
mask_p
,
style_p
);
}
}
if
(
style_p
->
swidth
!=
0
)
{
lv_draw_
rec
t_shadow
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_shadow
(
cords_p
,
mask_p
,
style_p
);
}
}
#endif
/*USE_LV_RECT != 0*/
...
...
@@ -573,7 +573,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
uint16_t
radius
=
style
->
radius
;
...
...
@@ -584,7 +584,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
/*If the radius is too big then there is no body*/
if
(
radius
>
height
/
2
)
return
;
...
...
@@ -623,7 +623,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
static
void
lv_draw_
con
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
{
uint16_t
radius
=
style_p
->
radius
;
...
...
@@ -635,7 +635,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
point_t
lt_origo
;
/*Left Top origo*/
point_t
lb_origo
;
/*Left Bottom origo*/
...
...
@@ -794,7 +794,7 @@ if(edge_top_area.y1 != mid_top_area.y1) {
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
static
void
lv_draw_
con
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
{
uint16_t
radius
=
style_p
->
radius
;
...
...
@@ -809,7 +809,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
/*the 0 px border width drawn as 1 px, so decrement the b_width*/
bwidth
--
;
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
if
(
radius
<
bwidth
)
{
length_corr
=
bwidth
-
radius
;
...
...
@@ -910,7 +910,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
* @param rects_p pointer to a rectangle style
* @param opa opacity of the rectangle (0..255)
*/
static
void
lv_draw_
rec
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
uint16_t
radius
=
style
->
radius
;
uint16_t
bwidth
=
style
->
bwidth
;
...
...
@@ -923,7 +923,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
cord_t
width
=
area_get_width
(
cords_p
);
cord_t
height
=
area_get_height
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
point_t
lt_origo
;
/*Left Top origo*/
point_t
lb_origo
;
/*Left Bottom origo*/
...
...
@@ -1045,7 +1045,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
* @param rect pointer to rectangle object
* @param mask pointer to a mask area (from the design functions)
*/
static
void
lv_draw_
rec
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
cord_t
swidth
=
style
->
swidth
;
if
(
swidth
==
0
)
return
;
...
...
@@ -1061,7 +1061,7 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
shadow_style
.
empty
=
1
;
shadow_style
.
bwidth
=
swidth
;
shadow_style
.
radius
=
style
->
radius
;
if
(
shadow_style
.
radius
==
LV_
REC
T_CIRCLE
)
{
if
(
shadow_style
.
radius
==
LV_
CON
T_CIRCLE
)
{
shadow_style
.
radius
=
MATH_MIN
(
area_get_width
(
cords_p
),
area_get_height
(
cords_p
));
}
shadow_style
.
radius
+=
swidth
+
1
;
...
...
@@ -1077,8 +1077,8 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
shadow_style
.
opa
=
style
->
opa
/
(
swidth
/
res
);
for
(
i
=
1
;
i
<
swidth
;
i
+=
res
)
{
lv_draw_
rec
t_border_straight
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
rec
t_border_corner
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
con
t_border_straight
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
con
t_border_corner
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
shadow_style
.
radius
-=
res
;
shadow_style
.
bwidth
-=
res
;
shadow_area
.
x1
+=
res
;
...
...
@@ -1089,7 +1089,7 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
}
static
uint16_t
lv_draw_
rec
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
)
static
uint16_t
lv_draw_
con
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
)
{
if
(
r
>=
(
w
>>
1
)){
r
=
(
w
>>
1
);
...
...
lv_draw/lv_draw.h
View file @
d93844bd
...
...
@@ -16,7 +16,7 @@
/*********************
* DEFINES
*********************/
#define LV_
REC
T_CIRCLE ((cord_t)-1)
/*A very big radius to always draw as circle*/
#define LV_
CON
T_CIRCLE ((cord_t)-1)
/*A very big radius to always draw as circle*/
/**********************
* TYPEDEFS
...
...
lv_obj/lv_obj.c
View file @
d93844bd
...
...
@@ -1440,7 +1440,7 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
uint16_t
r
=
style
->
radius
;
if
(
r
==
LV_
REC
T_CIRCLE
)
return
false
;
if
(
r
==
LV_
CON
T_CIRCLE
)
return
false
;
area_t
area_tmp
;
...
...
lv_objx/lv_bar.c
View file @
d93844bd
...
...
@@ -67,7 +67,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
act_value
=
0
;
ext
->
style_indic
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
/* Save the
rectangle
design function.
/* Save the
ancient
design function.
* It will be used in the bar design function*/
if
(
ancestor_design_f
==
NULL
)
ancestor_design_f
=
lv_obj_get_design_f
(
new_bar
);
...
...
@@ -106,7 +106,7 @@ bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
bar
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
bar
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_bar.h
View file @
d93844bd
...
...
@@ -22,7 +22,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
...
...
lv_objx/lv_btn.c
View file @
d93844bd
...
...
@@ -55,7 +55,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
{
lv_obj_t
*
new_btn
;
new_btn
=
lv_
rec
t_create
(
par
,
copy
);
new_btn
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_btn
);
/*Allocate the extended data*/
lv_btn_ext_t
*
ext
=
lv_obj_alloc_ext
(
new_btn
,
sizeof
(
lv_btn_ext_t
));
...
...
@@ -77,7 +77,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
/*If no copy do the basic initialization*/
if
(
copy
==
NULL
)
{
lv_
rect_set_layout
(
new_btn
,
LV_REC
T_LAYOUT_CENTER
);
lv_
cont_set_layout
(
new_btn
,
LV_CON
T_LAYOUT_CENTER
);
lv_obj_set_style
(
new_btn
,
ext
->
styles
[
LV_BTN_STATE_REL
]);
}
/*Copy 'copy'*/
...
...
@@ -113,7 +113,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
btn
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
btn
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_btn.h
View file @
d93844bd
...
...
@@ -17,7 +17,7 @@
#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
#endif
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "../lv_obj/lv_dispi.h"
/*********************
...
...
@@ -42,7 +42,7 @@ typedef enum
/*Data of button*/
typedef
struct
{
lv_
rect_ext_t
rec
t
;
/*Ext. of ancestor*/
lv_
cont_ext_t
con
t
;
/*Ext. of ancestor*/
/*New data for this type */
lv_action_t
pr_action
;
/*A function to call when the button is pressed (NULL if unused)*/
lv_action_t
rel_action
;
/*A function to call when the button is released (NULL if unused)*/
...
...
lv_objx/lv_btnm.c
View file @
d93844bd
...
...
@@ -61,7 +61,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_btnm_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor object*/
lv_obj_t
*
new_btnm
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_btnm
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_btnm
);
/*Allocate the object type specific extended data*/
...
...
@@ -106,7 +106,7 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
btnm
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
btnm
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_btnm.h
View file @
d93844bd
...
...
@@ -23,7 +23,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_label.h"
#include "lv_btn.h"
...
...
@@ -43,7 +43,7 @@ typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
/*Data of button matrix*/
typedef
struct
{
lv_
rec
t_ext_t
bg
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg
;
/*Ext. of ancestor*/
/*New data for this type */
const
char
**
map_p
;
/*Pointer to the current map*/
area_t
*
btn_areas
;
/*Array of areas for the buttons (Handled by the library)*/
...
...
lv_objx/lv_cb.c
View file @
d93844bd
...
...
@@ -68,8 +68,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_btn_set_styles
(
new_cb
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_
rect_set_layout
(
new_cb
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
rec
t_set_fit
(
new_cb
,
true
,
true
);
lv_
cont_set_layout
(
new_cb
,
LV_CON
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
new_cb
,
true
,
true
);
lv_btn_set_tgl
(
new_cb
,
true
);
lv_obj_set_click
(
ext
->
bullet
,
false
);
...
...
lv_objx/lv_chart.c
View file @
d93844bd
...
...
@@ -484,32 +484,32 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
int32_t
y_tmp
;
lv_chart_dl_t
*
dl
;
uint8_t
dl_cnt
=
0
;
lv_style_t
rects
;
lv_style_get
(
LV_STYLE_PLAIN
,
&
rects
);
lv_style_t
style_point
;
lv_style_get
(
LV_STYLE_PLAIN
,
&
style_point
);
rects
.
bwidth
=
0
;
rects
.
empty
=
0
;
rects
.
radius
=
LV_REC
T_CIRCLE
;
rects
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
data_opa
)
>>
8
;
style_point
.
bwidth
=
0
;
style_point
.
empty
=
0
;
style_point
.
radius
=
LV_CON
T_CIRCLE
;
style_point
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
data_opa
)
>>
8
;
/*Go through all data lines*/
LL_READ_BACK
(
ext
->
dl_ll
,
dl
)
{
rects
.
radius
=
dl
->
width
;
rects
.
mcolor
=
dl
->
color
;
rects
.
gcolor
=
color_mix
(
COLOR_BLACK
,
dl
->
color
,
ext
->
dark_eff
);
style_point
.
radius
=
dl
->
width
;
style_point
.
mcolor
=
dl
->
color
;
style_point
.
gcolor
=
color_mix
(
COLOR_BLACK
,
dl
->
color
,
ext
->
dark_eff
);
for
(
i
=
0
;
i
<
ext
->
pnum
;
i
++
)
{
cir_a
.
x1
=
((
w
*
i
)
/
(
ext
->
pnum
-
1
))
+
x_ofs
;
cir_a
.
x2
=
cir_a
.
x1
+
rects
.
radius
;
cir_a
.
x1
-=
rects
.
radius
;
cir_a
.
x2
=
cir_a
.
x1
+
style_point
.
radius
;
cir_a
.
x1
-=
style_point
.
radius
;
y_tmp
=
(
int32_t
)((
int32_t
)
dl
->
points
[
i
]
-
ext
->
ymin
)
*
h
;
y_tmp
=
y_tmp
/
(
ext
->
ymax
-
ext
->
ymin
);
cir_a
.
y1
=
h
-
y_tmp
+
y_ofs
;
cir_a
.
y2
=
cir_a
.
y1
+
rects
.
radius
;
cir_a
.
y1
-=
rects
.
radius
;
cir_a
.
y2
=
cir_a
.
y1
+
style_point
.
radius
;
cir_a
.
y1
-=
style_point
.
radius
;
lv_draw_rect
(
&
cir_a
,
mask
,
&
rects
);
lv_draw_rect
(
&
cir_a
,
mask
,
&
style_point
);
}
dl_cnt
++
;
}
...
...
lv_objx/lv_chart.h
View file @
d93844bd
...
...
@@ -22,7 +22,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_line.h"
/*********************
...
...
lv_objx/lv_
rec
t.c
→
lv_objx/lv_
con
t.c
View file @
d93844bd
...
...
@@ -14,7 +14,7 @@
#include <stdint.h>
#include <string.h>
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_vbasic.h"
#include "../lv_misc/area.h"
...
...
@@ -36,16 +36,16 @@
* STATIC PROTOTYPES
**********************/
#if 0
static bool lv_
rect_design(lv_obj_t * rec
t, const area_t * mask, lv_design_mode_t mode);
static bool lv_
cont_design(lv_obj_t * con
t, const area_t * mask, lv_design_mode_t mode);
#endif
static
void
lv_
rect_refr_layout
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_layout_col
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_layout_row
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_layout_center
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_layout_pretty
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_layout_grid
(
lv_obj_t
*
rec
t
);
static
void
lv_
rect_refr_autofit
(
lv_obj_t
*
rec
t
);
static
void
lv_
cont_refr_layout
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_layout_col
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_layout_row
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_layout_center
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_layout_pretty
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_layout_grid
(
lv_obj_t
*
con
t
);
static
void
lv_
cont_refr_autofit
(
lv_obj_t
*
con
t
);
/**********************
* STATIC VARIABLES
...
...
@@ -64,32 +64,32 @@ static void lv_rect_refr_autofit(lv_obj_t * rect);
*-----------------*/
/**
* Create a
rectangle
objects
* @param par pointer to an object, it will be the parent of the new
rectangle
* @param copy pointer to a
rectangle
object, if not NULL then the new object will be copied from it
* @return pointer to the created
rectangle
* Create a
container
objects
* @param par pointer to an object, it will be the parent of the new
container
* @param copy pointer to a
container
object, if not NULL then the new object will be copied from it
* @return pointer to the created
container
*/
lv_obj_t
*
lv_
rec
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
lv_obj_t
*
lv_
con
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create a basic object*/
lv_obj_t
*
new_rect
=
lv_obj_create
(
par
,
copy
);
dm_assert
(
new_rect
);
lv_obj_alloc_ext
(
new_rect
,
sizeof
(
lv_
rec
t_ext_t
));
lv_
rec
t_ext_t
*
ext
=
lv_obj_get_ext
(
new_rect
);
lv_obj_alloc_ext
(
new_rect
,
sizeof
(
lv_
con
t_ext_t
));
lv_
con
t_ext_t
*
ext
=
lv_obj_get_ext
(
new_rect
);
dm_assert
(
ext
);
ext
->
hpad_en
=
0
;
ext
->
vpad_en
=
0
;
ext
->
layout
=
LV_
REC
T_LAYOUT_OFF
;
ext
->
layout
=
LV_
CON
T_LAYOUT_OFF
;
lv_obj_set_signal_f
(
new_rect
,
lv_
rec
t_signal
);
lv_obj_set_signal_f
(
new_rect
,
lv_
con
t_signal
);
/*Init the new
rectangle
*/
/*Init the new
container
*/
if
(
copy
==
NULL
)
{
lv_obj_set_style
(
new_rect
,
lv_style_get
(
LV_STYLE_PLAIN
,
NULL
));
}
/*Copy an existing object*/
else
{
lv_
rec
t_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
lv_
con
t_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
hpad_en
=
copy_ext
->
hpad_en
;
ext
->
vpad_en
=
copy_ext
->
vpad_en
;
ext
->
layout
=
copy_ext
->
layout
;
...
...
@@ -103,38 +103,38 @@ lv_obj_t * lv_rect_create(lv_obj_t * par, lv_obj_t * copy)
}
/**
* Signal function of the
rectangle
* @param
rect pointer to a rectangle
object
* Signal function of the
container
* @param
cont pointer to a container
object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
*/
bool
lv_
rect_signal
(
lv_obj_t
*
rec
t
,
lv_signal_t
sign
,
void
*
param
)
bool
lv_
cont_signal
(
lv_obj_t
*
con
t
,
lv_signal_t
sign
,
void
*
param
)
{
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_obj_signal
(
rec
t
,
sign
,
param
);
valid
=
lv_obj_signal
(
con
t
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
valid
!=
false
)
{
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
switch
(
sign
)
{
case
LV_SIGNAL_STYLE_CHG
:
/*Recalculate the padding if the style changed*/
lv_
rect_refr_layout
(
rec
t
);
lv_
rect_refr_autofit
(
rec
t
);
lv_
cont_refr_layout
(
con
t
);
lv_
cont_refr_autofit
(
con
t
);
break
;
case
LV_SIGNAL_CHILD_CHG
:
lv_
rect_refr_layout
(
rec
t
);
lv_
rect_refr_autofit
(
rec
t
);
lv_
cont_refr_layout
(
con
t
);
lv_
cont_refr_autofit
(
con
t
);
break
;
case
LV_SIGNAL_CORD_CHG
:
if
(
lv_obj_get_width
(
rec
t
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
rec
t
)
!=
area_get_height
(
param
))
{
lv_
rect_refr_layout
(
rec
t
);
lv_
rect_refr_autofit
(
rec
t
);
if
(
lv_obj_get_width
(
con
t
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
con
t
)
!=
area_get_height
(
param
))
{
lv_
cont_refr_layout
(
con
t
);
lv_
cont_refr_autofit
(
con
t
);
}
break
;
default:
...
...
@@ -150,36 +150,36 @@ bool lv_rect_signal(lv_obj_t * rect, lv_signal_t sign, void * param)
*====================*/
/**
* Set the layout on a
rectangle
* @param
rect pointer to a rectangle
object
* @param layout a layout from 'lv_
rec
t_layout_t'
* Set the layout on a
container
* @param
cont pointer to a container
object
* @param layout a layout from 'lv_
con
t_layout_t'
*/
void
lv_
rect_set_layout
(
lv_obj_t
*
rect
,
lv_rec
t_layout_t
layout
)
void
lv_
cont_set_layout
(
lv_obj_t
*
cont
,
lv_con
t_layout_t
layout
)
{
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
ext
->
layout
=
layout
;
/*Send a signal to refresh the layout*/
rect
->
signal_f
(
rec
t
,
LV_SIGNAL_CHILD_CHG
,
NULL
);
cont
->
signal_f
(
con
t
,
LV_SIGNAL_CHILD_CHG
,
NULL
);
}
/**
* Enable the horizontal or vertical fit.
* The
rectangle
size will be set to involve the children horizontally or vertically.
* @param
rect pointer to a rectangle
object
* The
container
size will be set to involve the children horizontally or vertically.
* @param
cont pointer to a container
object
* @param hor_en true: enable the horizontal padding
* @param ver_en true: enable the vertical padding
*/
void
lv_
rect_set_fit
(
lv_obj_t
*
rec
t
,
bool
hor_en
,
bool
ver_en
)
void
lv_
cont_set_fit
(
lv_obj_t
*
con
t
,
bool
hor_en
,
bool
ver_en
)
{
lv_obj_inv
(
rec
t
);
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_obj_inv
(
con
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
ext
->
hpad_en
=
hor_en
==
false
?
0
:
1
;
ext
->
vpad_en
=
ver_en
==
false
?
0
:
1
;
/*Send a signal to set a new size*/
rect
->
signal_f
(
rect
,
LV_SIGNAL_CORD_CHG
,
rec
t
);
cont
->
signal_f
(
cont
,
LV_SIGNAL_CORD_CHG
,
con
t
);
}
/*=====================
...
...
@@ -187,48 +187,46 @@ void lv_rect_set_fit(lv_obj_t * rect, bool hor_en, bool ver_en)
*====================*/
/**
* Get the layout of a
rectangle
* @param
rect pointer to rectangle
object
* @return the layout from 'lv_
rec
t_layout_t'
* Get the layout of a
container
* @param
cont pointer to container
object
* @return the layout from 'lv_
con
t_layout_t'
*/
lv_
rect_layout_t
lv_rect_get_layout
(
lv_obj_t
*
rec
t
)
lv_
cont_layout_t
lv_cont_get_layout
(
lv_obj_t
*
con
t
)
{
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
return
ext
->
layout
;
}
/**
* Get horizontal fit enable attribute of a
rectangle
* @param
rect pointer to a rectangle
object
* Get horizontal fit enable attribute of a
container
* @param
cont pointer to a container
object
* @return true: horizontal padding is enabled
*/
bool
lv_
rect_get_hfit
(
lv_obj_t
*
rec
t
)
bool
lv_
cont_get_hfit
(
lv_obj_t
*
con
t
)
{
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
return
ext
->
hpad_en
==
0
?
false
:
true
;
}
/**
* Get vertical fit enable attribute of a
rectangle
* @param
obj pointer to a rectangle
object
* Get vertical fit enable attribute of a
container
* @param
cont pointer to a container
object
* @return true: vertical padding is enabled
*/
bool
lv_
rect_get_vfit
(
lv_obj_t
*
rec
t
)
bool
lv_
cont_get_vfit
(
lv_obj_t
*
con
t
)
{
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
return
ext
->
vpad_en
==
0
?
false
:
true
;
}
/**********************
* STATIC FUNCTIONS
**********************/
#if 0
/**
* Handle the drawing related tasks of the
rectangle
s
* @param
rec
t pointer to an object
* Handle the drawing related tasks of the
container
s
* @param
con
t pointer to an object
* @param mask 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)
...
...
@@ -236,7 +234,7 @@ bool lv_rect_get_vfit(lv_obj_t * rect)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_
rect_design(lv_obj_t * rec
t, const area_t * mask, lv_design_mode_t mode)
static bool lv_
cont_design(lv_obj_t * con
t, const area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
...
...
@@ -253,55 +251,55 @@ static bool lv_rect_design(lv_obj_t * rect, const area_t * mask, lv_design_mode_
/**
* Refresh the layout of a
rectangle
* @param
rec
t pointer to an object which layout should be refreshed
* Refresh the layout of a
container
* @param
con
t pointer to an object which layout should be refreshed
*/
static
void
lv_
rect_refr_layout
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_refr_layout
(
lv_obj_t
*
con
t
)
{
lv_
rect_layout_t
type
=
lv_rect_get_layout
(
rec
t
);
lv_
cont_layout_t
type
=
lv_cont_get_layout
(
con
t
);
/*'rect' has to be at least 1 child*/
if
(
lv_obj_get_child
(
rec
t
,
NULL
)
==
NULL
)
return
;
if
(
type
==
LV_
REC
T_LAYOUT_OFF
)
return
;
if
(
type
==
LV_
REC
T_LAYOUT_CENTER
)
{
lv_
rect_layout_center
(
rec
t
);
}
else
if
(
type
==
LV_
RECT_LAYOUT_COL_L
||
type
==
LV_RECT_LAYOUT_COL_M
||
type
==
LV_REC
T_LAYOUT_COL_R
)
{
lv_
rect_layout_col
(
rec
t
);
}
else
if
(
type
==
LV_
RECT_LAYOUT_ROW_T
||
type
==
LV_RECT_LAYOUT_ROW_M
||
type
==
LV_REC
T_LAYOUT_ROW_B
)
{
lv_
rect_layout_row
(
rec
t
);
}
else
if
(
type
==
LV_
REC
T_LAYOUT_PRETTY
)
{
lv_
rect_layout_pretty
(
rec
t
);
}
else
if
(
type
==
LV_
REC
T_LAYOUT_GRID
)
{
lv_
rect_layout_grid
(
rec
t
);
if
(
lv_obj_get_child
(
con
t
,
NULL
)
==
NULL
)
return
;
if
(
type
==
LV_
CON
T_LAYOUT_OFF
)
return
;
if
(
type
==
LV_
CON
T_LAYOUT_CENTER
)
{
lv_
cont_layout_center
(
con
t
);
}
else
if
(
type
==
LV_
CONT_LAYOUT_COL_L
||
type
==
LV_CONT_LAYOUT_COL_M
||
type
==
LV_CON
T_LAYOUT_COL_R
)
{
lv_
cont_layout_col
(
con
t
);
}
else
if
(
type
==
LV_
CONT_LAYOUT_ROW_T
||
type
==
LV_CONT_LAYOUT_ROW_M
||
type
==
LV_CON
T_LAYOUT_ROW_B
)
{
lv_
cont_layout_row
(
con
t
);
}
else
if
(
type
==
LV_
CON
T_LAYOUT_PRETTY
)
{
lv_
cont_layout_pretty
(
con
t
);
}
else
if
(
type
==
LV_
CON
T_LAYOUT_GRID
)
{
lv_
cont_layout_grid
(
con
t
);
}
}
/**
* Handle column type layouts
* @param
rec
t pointer to an object which layout should be handled
* @param
con
t pointer to an object which layout should be handled
*/
static
void
lv_
rect_layout_col
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_layout_col
(
lv_obj_t
*
con
t
)
{
lv_
rect_layout_t
type
=
lv_rect_get_layout
(
rec
t
);
lv_
cont_layout_t
type
=
lv_cont_get_layout
(
con
t
);
lv_obj_t
*
child
;
/*Adjust margin and get the alignment type*/
lv_align_t
align
;
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
cord_t
hpad_corr
;
switch
(
type
)
{
case
LV_
REC
T_LAYOUT_COL_L
:
case
LV_
CON
T_LAYOUT_COL_L
:
hpad_corr
=
style
->
hpad
;
align
=
LV_ALIGN_IN_TOP_LEFT
;
break
;
case
LV_
REC
T_LAYOUT_COL_M
:
case
LV_
CON
T_LAYOUT_COL_M
:
hpad_corr
=
0
;
align
=
LV_ALIGN_IN_TOP_MID
;
break
;
case
LV_
REC
T_LAYOUT_COL_R
:
case
LV_
CON
T_LAYOUT_COL_R
:
hpad_corr
=
-
style
->
hpad
;
align
=
LV_ALIGN_IN_TOP_RIGHT
;
break
;
...
...
@@ -313,44 +311,44 @@ static void lv_rect_layout_col(lv_obj_t * rect)
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_set_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
last_cord
=
style
->
vpad
;
LL_READ_BACK
(
rec
t
->
child_ll
,
child
)
{
LL_READ_BACK
(
con
t
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
lv_obj_align
(
child
,
rec
t
,
align
,
hpad_corr
,
last_cord
);
lv_obj_align
(
child
,
con
t
,
align
,
hpad_corr
,
last_cord
);
last_cord
+=
lv_obj_get_height
(
child
)
+
style
->
opad
;
}
lv_obj_clr_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_clr_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
}
/**
* Handle row type layouts
* @param
rec
t pointer to an object which layout should be handled
* @param
con
t pointer to an object which layout should be handled
*/
static
void
lv_
rect_layout_row
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_layout_row
(
lv_obj_t
*
con
t
)
{
lv_
rect_layout_t
type
=
lv_rect_get_layout
(
rec
t
);
lv_
cont_layout_t
type
=
lv_cont_get_layout
(
con
t
);
lv_obj_t
*
child
;
/*Adjust margin and get the alignment type*/
lv_align_t
align
;
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
cord_t
vpad_corr
=
style
->
vpad
;
switch
(
type
)
{
case
LV_
REC
T_LAYOUT_ROW_T
:
case
LV_
CON
T_LAYOUT_ROW_T
:
vpad_corr
=
style
->
vpad
;
align
=
LV_ALIGN_IN_TOP_LEFT
;
break
;
case
LV_
REC
T_LAYOUT_ROW_M
:
case
LV_
CON
T_LAYOUT_ROW_M
:
vpad_corr
=
0
;
align
=
LV_ALIGN_IN_LEFT_MID
;
break
;
case
LV_
REC
T_LAYOUT_ROW_B
:
case
LV_
CON
T_LAYOUT_ROW_B
:
vpad_corr
=
-
style
->
vpad
;
align
=
LV_ALIGN_IN_BOTTOM_LEFT
;
break
;
...
...
@@ -362,33 +360,33 @@ static void lv_rect_layout_row(lv_obj_t * rect)
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_set_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
last_cord
=
style
->
hpad
;
LL_READ_BACK
(
rec
t
->
child_ll
,
child
)
{
LL_READ_BACK
(
con
t
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
lv_obj_align
(
child
,
rec
t
,
align
,
last_cord
,
vpad_corr
);
lv_obj_align
(
child
,
con
t
,
align
,
last_cord
,
vpad_corr
);
last_cord
+=
lv_obj_get_width
(
child
)
+
style
->
opad
;
}
lv_obj_clr_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_clr_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
}
/**
* Handle the center layout
* @param
rec
t pointer to an object which layout should be handled
* @param
con
t pointer to an object which layout should be handled
*/
static
void
lv_
rect_layout_center
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_layout_center
(
lv_obj_t
*
con
t
)
{
lv_obj_t
*
child
;
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
uint32_t
obj_num
=
0
;
cord_t
h_tot
=
0
;
LL_READ
(
rec
t
->
child_ll
,
child
)
{
LL_READ
(
con
t
->
child_ll
,
child
)
{
h_tot
+=
lv_obj_get_height
(
child
)
+
style
->
opad
;
obj_num
++
;
}
...
...
@@ -399,41 +397,41 @@ static void lv_rect_layout_center(lv_obj_t * rect)
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_set_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
last_cord
=
-
(
h_tot
/
2
);
LL_READ_BACK
(
rec
t
->
child_ll
,
child
)
{
LL_READ_BACK
(
con
t
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
lv_obj_align
(
child
,
rec
t
,
LV_ALIGN_CENTER
,
0
,
last_cord
+
lv_obj_get_height
(
child
)
/
2
);
lv_obj_align
(
child
,
con
t
,
LV_ALIGN_CENTER
,
0
,
last_cord
+
lv_obj_get_height
(
child
)
/
2
);
last_cord
+=
lv_obj_get_height
(
child
)
+
style
->
opad
;
}
lv_obj_clr_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_clr_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
}
/**
* Handle the pretty layout. Put as many object as possible in row
* then begin a new row
* @param
rec
t pointer to an object which layout should be handled
* @param
con
t pointer to an object which layout should be handled
*/
static
void
lv_
rect_layout_pretty
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_layout_pretty
(
lv_obj_t
*
con
t
)
{
lv_obj_t
*
child_rs
;
/* Row starter child */
lv_obj_t
*
child_rc
;
/* Row closer child */
lv_obj_t
*
child_tmp
;
/* Temporary child */
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
cord_t
w_obj
=
lv_obj_get_width
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
cord_t
w_obj
=
lv_obj_get_width
(
con
t
);
cord_t
act_y
=
style
->
vpad
;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
child_rs
=
ll_get_tail
(
&
rec
t
->
child_ll
);
/*Set the row starter child*/
child_rs
=
ll_get_tail
(
&
con
t
->
child_ll
);
/*Set the row starter child*/
if
(
child_rs
==
NULL
)
return
;
/*Return if no child*/
lv_obj_set_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_set_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
child_rc
=
child_rs
;
/*Initially the the row starter and closer is the same*/
while
(
child_rs
!=
NULL
)
{
...
...
@@ -450,23 +448,23 @@ static void lv_rect_layout_pretty(lv_obj_t * rect)
h_row
=
MATH_MAX
(
h_row
,
lv_obj_get_height
(
child_rc
));
/*Search the highest object*/
obj_num
++
;
}
child_rc
=
ll_get_prev
(
&
rec
t
->
child_ll
,
child_rc
);
/*Load the next object*/
child_rc
=
ll_get_prev
(
&
con
t
->
child_ll
,
child_rc
);
/*Load the next object*/
if
(
obj_num
==
0
)
child_rs
=
child_rc
;
/*If the first object was hidden (or too long) then set the next as first */
}
while
(
child_rc
!=
NULL
);
/*Step back one child because the last is already not fit*/
if
(
child_rc
!=
NULL
&&
obj_num
!=
0
)
child_rc
=
ll_get_next
(
&
rec
t
->
child_ll
,
child_rc
);
if
(
child_rc
!=
NULL
&&
obj_num
!=
0
)
child_rc
=
ll_get_next
(
&
con
t
->
child_ll
,
child_rc
);
/*If the object is too long then align it to the middle*/
if
(
obj_num
==
0
)
{
if
(
child_rc
!=
NULL
)
{
h_row
=
lv_obj_get_height
(
child_rc
);
lv_obj_align
(
child_rc
,
rec
t
,
LV_ALIGN_IN_TOP_MID
,
0
,
act_y
);
lv_obj_align
(
child_rc
,
con
t
,
LV_ALIGN_IN_TOP_MID
,
0
,
act_y
);
}
}
/*If here is only one object in the row then align it to the left*/
else
if
(
obj_num
==
1
)
{
lv_obj_align
(
child_rs
,
rec
t
,
LV_ALIGN_IN_TOP_MID
,
0
,
act_y
);
lv_obj_align
(
child_rs
,
con
t
,
LV_ALIGN_IN_TOP_MID
,
0
,
act_y
);
}
/* Align the children (from child_rs to child_rc)*/
else
{
...
...
@@ -477,33 +475,33 @@ static void lv_rect_layout_pretty(lv_obj_t * rect)
do
{
if
(
lv_obj_get_hidden
(
child_tmp
)
==
false
&&
lv_obj_is_protected
(
child_tmp
,
LV_PROTECT_POS
)
==
false
)
{
lv_obj_align
(
child_tmp
,
rec
t
,
LV_ALIGN_IN_TOP_LEFT
,
act_x
,
act_y
);
lv_obj_align
(
child_tmp
,
con
t
,
LV_ALIGN_IN_TOP_LEFT
,
act_x
,
act_y
);
act_x
+=
lv_obj_get_width
(
child_tmp
)
+
new_opad
;
}
child_tmp
=
ll_get_prev
(
&
rec
t
->
child_ll
,
child_tmp
);
child_tmp
=
ll_get_prev
(
&
con
t
->
child_ll
,
child_tmp
);
}
while
(
child_tmp
!=
child_rc
);
}
if
(
child_rc
==
NULL
)
break
;
act_y
+=
style
->
opad
+
h_row
;
/*y increment*/
child_rs
=
ll_get_prev
(
&
rec
t
->
child_ll
,
child_rc
);
/*Go to the next object*/
child_rs
=
ll_get_prev
(
&
con
t
->
child_ll
,
child_rc
);
/*Go to the next object*/
child_rc
=
child_rs
;
}
lv_obj_clr_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_clr_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
}
/**
* Handle the grid layout. Align same-sized objects in a grid
* @param
rec
t pointer to an object which layout should be handled
* @param
con
t pointer to an object which layout should be handled
*/
static
void
lv_
rect_layout_grid
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_layout_grid
(
lv_obj_t
*
con
t
)
{
lv_obj_t
*
child
;
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
cord_t
w_tot
=
lv_obj_get_width
(
rec
t
);
cord_t
w_obj
=
lv_obj_get_width
(
lv_obj_get_child
(
rec
t
,
NULL
));
cord_t
h_obj
=
lv_obj_get_height
(
lv_obj_get_child
(
rec
t
,
NULL
));
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
cord_t
w_tot
=
lv_obj_get_width
(
con
t
);
cord_t
w_obj
=
lv_obj_get_width
(
lv_obj_get_child
(
con
t
,
NULL
));
cord_t
h_obj
=
lv_obj_get_height
(
lv_obj_get_child
(
con
t
,
NULL
));
uint16_t
obj_row
=
(
w_tot
-
(
2
*
style
->
hpad
))
/
(
w_obj
+
style
->
opad
);
/*Obj. num. in a row*/
cord_t
x_ofs
;
if
(
obj_row
>
1
)
{
...
...
@@ -515,13 +513,13 @@ static void lv_rect_layout_grid(lv_obj_t * rect)
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_set_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
act_x
=
style
->
hpad
;
cord_t
act_y
=
style
->
vpad
;
uint16_t
obj_cnt
=
0
;
LL_READ_BACK
(
rec
t
->
child_ll
,
child
)
{
LL_READ_BACK
(
con
t
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
...
...
@@ -540,16 +538,16 @@ static void lv_rect_layout_grid(lv_obj_t * rect)
}
}
lv_obj_clr_protect
(
rec
t
,
LV_PROTECT_CHILD_CHG
);
lv_obj_clr_protect
(
con
t
,
LV_PROTECT_CHILD_CHG
);
}
/**
* Handle auto fit. Set the size of the object to involve all children.
* @param
rec
t pointer to an object which size will be modified
* @param
con
t pointer to an object which size will be modified
*/
static
void
lv_
rect_refr_autofit
(
lv_obj_t
*
rec
t
)
static
void
lv_
cont_refr_autofit
(
lv_obj_t
*
con
t
)
{
lv_
rect_ext_t
*
ext
=
lv_obj_get_ext
(
rec
t
);
lv_
cont_ext_t
*
ext
=
lv_obj_get_ext
(
con
t
);
if
(
ext
->
hpad_en
==
0
&&
ext
->
vpad_en
==
0
)
{
...
...
@@ -558,21 +556,21 @@ static void lv_rect_refr_autofit(lv_obj_t * rect)
area_t
new_cords
;
area_t
ori
;
lv_style_t
*
style
=
lv_obj_get_style
(
rec
t
);
lv_style_t
*
style
=
lv_obj_get_style
(
con
t
);
lv_obj_t
*
i
;
cord_t
hpad
=
style
->
hpad
;
cord_t
vpad
=
style
->
vpad
;
/*Search the side coordinates of the children*/
lv_obj_get_cords
(
rec
t
,
&
ori
);
lv_obj_get_cords
(
rec
t
,
&
new_cords
);
lv_obj_get_cords
(
con
t
,
&
ori
);
lv_obj_get_cords
(
con
t
,
&
new_cords
);
new_cords
.
x1
=
LV_CORD_MAX
;
new_cords
.
y1
=
LV_CORD_MAX
;
new_cords
.
x2
=
LV_CORD_MIN
;
new_cords
.
y2
=
LV_CORD_MIN
;
LL_READ
(
rec
t
->
child_ll
,
i
)
{
LL_READ
(
con
t
->
child_ll
,
i
)
{
if
(
lv_obj_get_hidden
(
i
)
!=
false
)
continue
;
new_cords
.
x1
=
MATH_MIN
(
new_cords
.
x1
,
i
->
cords
.
x1
);
new_cords
.
y1
=
MATH_MIN
(
new_cords
.
y1
,
i
->
cords
.
y1
);
...
...
@@ -586,33 +584,33 @@ static void lv_rect_refr_autofit(lv_obj_t * rect)
new_cords
.
x1
-=
hpad
;
new_cords
.
x2
+=
hpad
;
}
else
{
new_cords
.
x1
=
rec
t
->
cords
.
x1
;
new_cords
.
x2
=
rec
t
->
cords
.
x2
;
new_cords
.
x1
=
con
t
->
cords
.
x1
;
new_cords
.
x2
=
con
t
->
cords
.
x2
;
}
if
(
ext
->
vpad_en
!=
0
)
{
new_cords
.
y1
-=
vpad
;
new_cords
.
y2
+=
vpad
;
}
else
{
new_cords
.
y1
=
rec
t
->
cords
.
y1
;
new_cords
.
y2
=
rec
t
->
cords
.
y2
;
new_cords
.
y1
=
con
t
->
cords
.
y1
;
new_cords
.
y2
=
con
t
->
cords
.
y2
;
}
/*Do nothing if the coordinates are not changed*/
if
(
rec
t
->
cords
.
x1
!=
new_cords
.
x1
||
rec
t
->
cords
.
y1
!=
new_cords
.
y1
||
rec
t
->
cords
.
x2
!=
new_cords
.
x2
||
rec
t
->
cords
.
y2
!=
new_cords
.
y2
)
{
if
(
con
t
->
cords
.
x1
!=
new_cords
.
x1
||
con
t
->
cords
.
y1
!=
new_cords
.
y1
||
con
t
->
cords
.
x2
!=
new_cords
.
x2
||
con
t
->
cords
.
y2
!=
new_cords
.
y2
)
{
lv_obj_inv
(
rec
t
);
area_cpy
(
&
rec
t
->
cords
,
&
new_cords
);
lv_obj_inv
(
rec
t
);
lv_obj_inv
(
con
t
);
area_cpy
(
&
con
t
->
cords
,
&
new_cords
);
lv_obj_inv
(
con
t
);
/*Notify the object about its new coordinates*/
rect
->
signal_f
(
rec
t
,
LV_SIGNAL_CORD_CHG
,
&
ori
);
cont
->
signal_f
(
con
t
,
LV_SIGNAL_CORD_CHG
,
&
ori
);
/*Inform the parent about the new coordinates*/
lv_obj_t
*
par
=
lv_obj_get_parent
(
rec
t
);
par
->
signal_f
(
par
,
LV_SIGNAL_CHILD_CHG
,
rec
t
);
lv_obj_t
*
par
=
lv_obj_get_parent
(
con
t
);
par
->
signal_f
(
par
,
LV_SIGNAL_CHILD_CHG
,
con
t
);
}
}
}
...
...
lv_objx/lv_
rec
t.h
→
lv_objx/lv_
con
t.h
View file @
d93844bd
/**
* @file lv_
rec
t.h
* @file lv_
con
t.h
*
*/
#ifndef LV_
REC
T_H
#define LV_
REC
T_H
#ifndef LV_
CON
T_H
#define LV_
CON
T_H
/*********************
* INCLUDES
...
...
@@ -26,83 +26,83 @@
/*Layout options*/
typedef
enum
{
LV_
REC
T_LAYOUT_OFF
=
0
,
LV_
REC
T_LAYOUT_CENTER
,
LV_
REC
T_LAYOUT_COL_L
,
/*Column left align*/
LV_
REC
T_LAYOUT_COL_M
,
/*Column middle align*/
LV_
REC
T_LAYOUT_COL_R
,
/*Column right align*/
LV_
REC
T_LAYOUT_ROW_T
,
/*Row left align*/
LV_
REC
T_LAYOUT_ROW_M
,
/*Row middle align*/
LV_
REC
T_LAYOUT_ROW_B
,
/*Row right align*/
LV_
REC
T_LAYOUT_PRETTY
,
/*Put as many object as possible in row and begin a new row*/
LV_
REC
T_LAYOUT_GRID
,
/*Align same-sized object into a grid*/
}
lv_
rec
t_layout_t
;
LV_
CON
T_LAYOUT_OFF
=
0
,
LV_
CON
T_LAYOUT_CENTER
,
LV_
CON
T_LAYOUT_COL_L
,
/*Column left align*/
LV_
CON
T_LAYOUT_COL_M
,
/*Column middle align*/
LV_
CON
T_LAYOUT_COL_R
,
/*Column right align*/
LV_
CON
T_LAYOUT_ROW_T
,
/*Row left align*/
LV_
CON
T_LAYOUT_ROW_M
,
/*Row middle align*/
LV_
CON
T_LAYOUT_ROW_B
,
/*Row right align*/
LV_
CON
T_LAYOUT_PRETTY
,
/*Put as many object as possible in row and begin a new row*/
LV_
CON
T_LAYOUT_GRID
,
/*Align same-sized object into a grid*/
}
lv_
con
t_layout_t
;
typedef
struct
{
/*Inherited from 'base_obj' so no inherited ext. */
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
layout
:
5
;
/*Set a layout from 'lv_
rec
t_layout_t' enum*/
uint8_t
layout
:
5
;
/*Set a layout from 'lv_
con
t_layout_t' enum*/
uint8_t
hpad_en
:
1
;
/*Enable horizontal padding according to the children*/
uint8_t
vpad_en
:
1
;
/*Enable horizontal padding according to the children*/
}
lv_
rec
t_ext_t
;
}
lv_
con
t_ext_t
;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a
rectangle
objects
* @param par pointer to an object, it will be the parent of the new
rectangle
* @param copy pointer to a
rectangle
object, if not NULL then the new object will be copied from it
* @return pointer to the created
rectangle
* Create a
container
objects
* @param par pointer to an object, it will be the parent of the new
container
* @param copy pointer to a
container
object, if not NULL then the new object will be copied from it
* @return pointer to the created
container
*/
lv_obj_t
*
lv_
rec
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
lv_obj_t
*
lv_
con
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
/**
* Signal function of the
rectangle
* @param
rect pointer to a rectangle
object
* Signal function of the
container
* @param
cont pointer to a container
object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
*/
bool
lv_
rect_signal
(
lv_obj_t
*
rec
t
,
lv_signal_t
sign
,
void
*
param
);
bool
lv_
cont_signal
(
lv_obj_t
*
con
t
,
lv_signal_t
sign
,
void
*
param
);
/**
* Set the layout on a
rectangle
* @param
rect pointer to a rectangle
object
* @param layout a layout from 'lv_
rec
t_layout_t'
* Set the layout on a
container
* @param
cont pointer to a container
object
* @param layout a layout from 'lv_
con
t_layout_t'
*/
void
lv_
rect_set_layout
(
lv_obj_t
*
rect
,
lv_rec
t_layout_t
layout
);
void
lv_
cont_set_layout
(
lv_obj_t
*
cont
,
lv_con
t_layout_t
layout
);
/**
* Enable the horizontal or vertical fit.
* The
rectangle
size will be set to involve the children horizontally or vertically.
* @param
rect pointer to a rectangle
object
* The
container
size will be set to involve the children horizontally or vertically.
* @param
cont pointer to a container
object
* @param hor_en true: enable the horizontal padding
* @param ver_en true: enable the vertical padding
*/
void
lv_
rect_set_fit
(
lv_obj_t
*
rec
t
,
bool
hor_en
,
bool
ver_en
);
void
lv_
cont_set_fit
(
lv_obj_t
*
con
t
,
bool
hor_en
,
bool
ver_en
);
/**
* Get the layout of a
rectangle
* @param
rect pointer to rectangle
object
* @return the layout from 'lv_
rec
t_layout_t'
* Get the layout of a
container
* @param
cont pointer to container
object
* @return the layout from 'lv_
con
t_layout_t'
*/
lv_
rect_layout_t
lv_rect_get_layout
(
lv_obj_t
*
rec
t
);
lv_
cont_layout_t
lv_cont_get_layout
(
lv_obj_t
*
con
t
);
/**
* Get horizontal fit enable attribute of a
rectangle
* @param
rect pointer to a rectangle
object
* Get horizontal fit enable attribute of a
container
* @param
cont pointer to a container
object
* @return true: horizontal padding is enabled
*/
bool
lv_
rect_get_hfit
(
lv_obj_t
*
rec
t
);
bool
lv_
cont_get_hfit
(
lv_obj_t
*
con
t
);
/**
* Get vertical fit enable attribute of a
rectangle
* @param obj pointer to a
rectangle
object
* Get vertical fit enable attribute of a
container
* @param obj pointer to a
container
object
* @return true: vertical padding is enabled
*/
bool
lv_
rect_get_vfit
(
lv_obj_t
*
rec
t
);
bool
lv_
cont_get_vfit
(
lv_obj_t
*
con
t
);
/**********************
...
...
lv_objx/lv_ddlist.c
View file @
d93844bd
...
...
@@ -86,7 +86,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
opt_label
=
lv_label_create
(
new_ddlist
,
NULL
);
lv_obj_set_style
(
ext
->
opt_label
,
NULL
);
/*Inherit the style*/
lv_
rec
t_set_fit
(
new_ddlist
,
true
,
false
);
lv_
con
t_set_fit
(
new_ddlist
,
true
,
false
);
lv_page_set_rel_action
(
new_ddlist
,
lv_ddlist_rel_action
);
lv_page_set_sb_mode
(
new_ddlist
,
LV_PAGE_SB_MODE_DRAG
);
lv_obj_set_style
(
new_ddlist
,
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
...
...
lv_objx/lv_gauge.c
View file @
d93844bd
...
...
@@ -24,6 +24,7 @@
#define LV_GAUGE_DEF_WIDTH (3 * LV_DPI)
#define LV_GAUGE_DEF_HEIGHT (3 * LV_DPI)
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
#define LV_GAUGE_DEF_ANGLE 220
/**********************
* TYPEDEFS
**********************/
...
...
@@ -61,7 +62,7 @@ static lv_design_f_t ancestor_design_f = NULL;
lv_obj_t
*
lv_gauge_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor gauge*/
lv_obj_t
*
new_gauge
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_gauge
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_gauge
);
/*Allocate the gauge type specific extended data*/
...
...
@@ -75,7 +76,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
values
=
NULL
;
ext
->
needle_color
=
NULL
;
ext
->
low_critical
=
0
;
ext
->
scale_angle
=
120
;
ext
->
scale_angle
=
LV_GAUGE_DEF_ANGLE
;
ext
->
scale_label_num
=
6
;
ext
->
style_critical
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
...
...
@@ -123,7 +124,7 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
gauge
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
gauge
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -457,7 +458,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
lv_style_get
(
LV_STYLE_PLAIN
,
&
style_neddle_mid
);
style_neddle_mid
.
mcolor
=
style
->
bcolor
;
style_neddle_mid
.
gcolor
=
style
->
bcolor
;
style_neddle_mid
.
radius
=
LV_
REC
T_CIRCLE
;
style_neddle_mid
.
radius
=
LV_
CON
T_CIRCLE
;
area_t
nm_cord
;
nm_cord
.
x1
=
x_ofs
-
style
->
opad
;
...
...
lv_objx/lv_gauge.h
View file @
d93844bd
...
...
@@ -32,7 +32,7 @@
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_label.h"
#include "lv_line.h"
...
...
lv_objx/lv_img.c
View file @
d93844bd
...
...
@@ -49,7 +49,7 @@ static bool lv_img_is_symbol(const char * txt);
/**
* Create an image objects
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a
rectangl
e object, if not NULL then the new object will be copied from it
* @param copy pointer to a
imag
e object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t
*
lv_img_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
...
...
lv_objx/lv_led.c
View file @
d93844bd
...
...
@@ -9,7 +9,7 @@
#include "lv_conf.h"
#if USE_LV_LED != 0
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_led.h"
#include "../lv_draw/lv_draw.h"
...
...
@@ -56,7 +56,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_led_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor basic object*/
lv_obj_t
*
new_led
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_led
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_led
);
/*Allocate the object type specific extended data*/
...
...
@@ -98,7 +98,7 @@ bool lv_led_signal(lv_obj_t * led, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
led
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
led
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_led.h
View file @
d93844bd
...
...
@@ -30,7 +30,7 @@
/*Data of led*/
typedef
struct
{
lv_
rec
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
bright
;
/*Current brightness of the LED (0..255)*/
}
lv_led_ext_t
;
...
...
lv_objx/lv_line.c
View file @
d93844bd
...
...
@@ -58,7 +58,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t
*
new_line
=
lv_obj_create
(
par
,
copy
);
dm_assert
(
new_line
);
/*Extend the basic object to
rectangl
e object*/
/*Extend the basic object to
lin
e object*/
lv_line_ext_t
*
ext
=
lv_obj_alloc_ext
(
new_line
,
sizeof
(
lv_line_ext_t
));
dm_assert
(
ext
);
ext
->
point_num
=
0
;
...
...
@@ -70,7 +70,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_design_f
(
new_line
,
lv_line_design
);
lv_obj_set_signal_f
(
new_line
,
lv_line_signal
);
/*Init the new
rectangl
e*/
/*Init the new
lin
e*/
if
(
copy
==
NULL
)
{
lv_obj_set_style
(
new_line
,
lv_style_get
(
LV_STYLE_PLAIN
,
NULL
));
}
...
...
lv_objx/lv_list.c
View file @
d93844bd
...
...
@@ -10,13 +10,13 @@
#if USE_LV_LIST != 0
#include "lv_list.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "misc/math/math_base.h"
/*********************
* DEFINES
*********************/
#define LV_LIST_LAYOUT_DEF LV_
REC
T_LAYOUT_COL_M
#define LV_LIST_LAYOUT_DEF LV_
CON
T_LAYOUT_COL_M
/**********************
* TYPEDEFS
...
...
@@ -71,7 +71,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new list object*/
if
(
copy
==
NULL
)
{
lv_obj_set_size_us
(
new_list
,
2
*
LV_DPI
,
3
*
LV_DPI
);
lv_
rec
t_set_layout
(
ext
->
page
.
scrl
,
LV_LIST_LAYOUT_DEF
);
lv_
con
t_set_layout
(
ext
->
page
.
scrl
,
LV_LIST_LAYOUT_DEF
);
lv_obj_set_style
(
new_list
,
lv_style_get
(
LV_STYLE_TRANSP_TIGHT
,
NULL
));
lv_obj_set_style
(
lv_page_get_scrl
(
new_list
),
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
lv_page_set_sb_mode
(
new_list
,
LV_PAGE_SB_MODE_AUTO
);
...
...
@@ -121,8 +121,8 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
lv_btn_set_rel_action
(
liste
,
rel_action
);
lv_page_glue_obj
(
liste
,
true
);
lv_
rect_set_layout
(
liste
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
rec
t_set_fit
(
liste
,
false
,
true
);
lv_
cont_set_layout
(
liste
,
LV_CON
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
liste
,
false
,
true
);
if
(
img_fn
!=
NULL
&&
img_fn
[
0
]
!=
'\0'
)
{
lv_obj_t
*
img
=
lv_img_create
(
liste
,
NULL
);
...
...
lv_objx/lv_mbox.c
View file @
d93844bd
...
...
@@ -59,7 +59,7 @@ static void lv_mbox_disable_fit(lv_obj_t * mbox);
lv_obj_t
*
lv_mbox_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor message box*/
lv_obj_t
*
new_mbox
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_mbox
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_mbox
);
/*Allocate the message box type specific extended data*/
...
...
@@ -78,8 +78,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new message box message box*/
if
(
copy
==
NULL
)
{
lv_
rect_set_layout
(
new_mbox
,
LV_REC
T_LAYOUT_COL_L
);
lv_
rec
t_set_fit
(
new_mbox
,
true
,
true
);
lv_
cont_set_layout
(
new_mbox
,
LV_CON
T_LAYOUT_COL_L
);
lv_
con
t_set_fit
(
new_mbox
,
true
,
true
);
ext
->
txt
=
lv_label_create
(
new_mbox
,
NULL
);
lv_label_set_text
(
ext
->
txt
,
"Text of the message box"
);
...
...
@@ -126,7 +126,7 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
mbox
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
mbox
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -201,11 +201,11 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
/*Create a button if it is not existed yet*/
if
(
ext
->
btnh
==
NULL
)
{
ext
->
btnh
=
lv_
rec
t_create
(
mbox
,
NULL
);
ext
->
btnh
=
lv_
con
t_create
(
mbox
,
NULL
);
lv_obj_set_style
(
ext
->
btnh
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_obj_set_click
(
ext
->
btnh
,
false
);
lv_
rec
t_set_fit
(
ext
->
btnh
,
false
,
true
);
lv_
rect_set_layout
(
ext
->
btnh
,
LV_REC
T_LAYOUT_PRETTY
);
lv_
con
t_set_fit
(
ext
->
btnh
,
false
,
true
);
lv_
cont_set_layout
(
ext
->
btnh
,
LV_CON
T_LAYOUT_PRETTY
);
}
lv_obj_t
*
btn
;
...
...
@@ -214,7 +214,7 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
lv_btn_set_styles
(
btn
,
ext
->
styles_btn
[
LV_BTN_STATE_REL
],
ext
->
styles_btn
[
LV_BTN_STATE_PR
],
ext
->
styles_btn
[
LV_BTN_STATE_TREL
],
ext
->
styles_btn
[
LV_BTN_STATE_TPR
],
ext
->
styles_btn
[
LV_BTN_STATE_INA
]);
lv_
rec
t_set_fit
(
btn
,
true
,
true
);
lv_
con
t_set_fit
(
btn
,
true
,
true
);
lv_obj_t
*
label
;
label
=
lv_label_create
(
btn
,
NULL
);
...
...
@@ -405,7 +405,7 @@ static void lv_mbox_realign(lv_obj_t * mbox)
*/
static
void
lv_mbox_disable_fit
(
lv_obj_t
*
mbox
)
{
lv_
rec
t_set_fit
(
mbox
,
false
,
false
);
lv_
con
t_set_fit
(
mbox
,
false
,
false
);
}
#endif
lv_objx/lv_mbox.h
View file @
d93844bd
...
...
@@ -27,7 +27,7 @@
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
...
...
@@ -42,7 +42,7 @@
/*Data of message box*/
typedef
struct
{
lv_
rec
t_ext_t
bg
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg
;
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
txt
;
/*Text of the message box*/
lv_obj_t
*
btnh
;
/*Holder of the buttons*/
...
...
lv_objx/lv_page.c
View file @
d93844bd
...
...
@@ -11,7 +11,7 @@
#include "misc/math/math_base.h"
#include "../lv_objx/lv_page.h"
#include "../lv_objx/lv_
rec
t.h"
#include "../lv_objx/lv_
con
t.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_obj/lv_refr.h"
#include "../lv_misc/anim.h"
...
...
@@ -61,7 +61,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_page_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor object*/
lv_obj_t
*
new_page
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_page
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_page
);
/*Allocate the object type specific extended data*/
...
...
@@ -81,12 +81,12 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new page object*/
if
(
copy
==
NULL
)
{
lv_style_t
*
style
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
ext
->
scrl
=
lv_
rec
t_create
(
new_page
,
NULL
);
ext
->
scrl
=
lv_
con
t_create
(
new_page
,
NULL
);
lv_obj_set_signal_f
(
ext
->
scrl
,
lv_scrl_signal
);
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_
rec
t_set_fit
(
ext
->
scrl
,
true
,
true
);
lv_
con
t_set_fit
(
ext
->
scrl
,
true
,
true
);
lv_obj_set_style
(
ext
->
scrl
,
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
/* Add the signal function only if 'scrolling' is created
...
...
@@ -96,7 +96,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style
(
new_page
,
style
);
}
else
{
lv_page_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
scrl
=
lv_
rec
t_create
(
new_page
,
copy_ext
->
scrl
);
ext
->
scrl
=
lv_
con
t_create
(
new_page
,
copy_ext
->
scrl
);
lv_obj_set_signal_f
(
ext
->
scrl
,
lv_scrl_signal
);
lv_page_set_pr_action
(
new_page
,
copy_ext
->
pr_action
);
...
...
@@ -128,7 +128,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
bool
obj_valid
=
true
;
/* Include the ancient signal function */
obj_valid
=
lv_
rec
t_signal
(
page
,
sign
,
param
);
obj_valid
=
lv_
con
t_signal
(
page
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -209,7 +209,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
bool
obj_valid
=
true
;
/* Include the ancient signal function */
obj_valid
=
lv_
rec
t_signal
(
scrl
,
sign
,
param
);
obj_valid
=
lv_
con
t_signal
(
scrl
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -480,7 +480,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en)
/**
* Get the scrollable object of a page-
* @param page pointer to page object
* @return pointer to
rectangle
which is the scrollable part of the page
* @return pointer to
a container
which is the scrollable part of the page
*/
lv_obj_t
*
lv_page_get_scrl
(
lv_obj_t
*
page
)
{
...
...
lv_objx/lv_page.h
View file @
d93844bd
...
...
@@ -18,7 +18,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
/*********************
* DEFINES
...
...
@@ -34,13 +34,13 @@ typedef enum
LV_PAGE_SB_MODE_OFF
,
/*Never show scrollbars*/
LV_PAGE_SB_MODE_ON
,
/*Always show scrollbars*/
LV_PAGE_SB_MODE_DRAG
,
/*Show scrollbars when page is being dragged*/
LV_PAGE_SB_MODE_AUTO
,
/*Show scrollbars when the scrollable
rect.
is large enough to be scrolled*/
LV_PAGE_SB_MODE_AUTO
,
/*Show scrollbars when the scrollable
container
is large enough to be scrolled*/
}
lv_page_sb_mode_t
;
/*Data of page*/
typedef
struct
{
lv_
rec
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
scrl
;
/*The scrollable object on the background*/
lv_action_t
rel_action
;
/*Function to call when the page is released*/
...
...
@@ -110,7 +110,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en);
/**
* Get the scrollable object of a page-
* @param page pointer to page object
* @return pointer to
rectangle
which is the scrollable part of the page
* @return pointer to
container
which is the scrollable part of the page
*/
lv_obj_t
*
lv_page_get_scrl
(
lv_obj_t
*
page
);
...
...
lv_objx/lv_slider.c
View file @
d93844bd
...
...
@@ -80,7 +80,8 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
/*Copy an existing slider*/
else
{
lv_slider_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
style_knob
=
copy_ext
->
style_knob
;
ext
->
cb
=
copy_ext
->
cb
;
/*Refresh the style with new signal function*/
lv_obj_refr_style
(
new_slider
);
}
...
...
lv_objx/lv_win.c
View file @
d93844bd
...
...
@@ -79,12 +79,12 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_sb_mode
(
ext
->
page
,
LV_PAGE_SB_MODE_AUTO
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ext
->
page
);
lv_
rec
t_set_fit
(
scrl
,
false
,
true
);
lv_
con
t_set_fit
(
scrl
,
false
,
true
);
lv_obj_set_style
(
scrl
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
/*Create a holder for the header*/
ext
->
header
=
lv_
rec
t_create
(
new_win
,
NULL
);
lv_
rec
t_set_fit
(
ext
->
header
,
false
,
true
);
ext
->
header
=
lv_
con
t_create
(
new_win
,
NULL
);
lv_
con
t_set_fit
(
ext
->
header
,
false
,
true
);
/*Move back the header because it is automatically moved to the scrollable */
lv_obj_set_protect
(
ext
->
header
,
LV_PROTECT_PARENT
);
lv_obj_set_parent
(
ext
->
header
,
new_win
);
...
...
@@ -95,10 +95,10 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_label_set_text
(
ext
->
title
,
"My title"
);
/*Create a holder for the control buttons*/
ext
->
btnh
=
lv_
rec
t_create
(
ext
->
header
,
NULL
);
lv_
rec
t_set_fit
(
ext
->
btnh
,
true
,
false
);
ext
->
btnh
=
lv_
con
t_create
(
ext
->
header
,
NULL
);
lv_
con
t_set_fit
(
ext
->
btnh
,
true
,
false
);
lv_obj_set_style
(
ext
->
btnh
,
lv_style_get
(
LV_STYLE_TRANSP_TIGHT
,
NULL
));
lv_
rect_set_layout
(
ext
->
btnh
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
cont_set_layout
(
ext
->
btnh
,
LV_CON
T_LAYOUT_ROW_M
);
lv_obj_set_signal_f
(
new_win
,
lv_win_signal
);
lv_obj_set_size
(
new_win
,
LV_HOR_RES
,
LV_VER_RES
);
...
...
@@ -107,13 +107,13 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
else
{
lv_win_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
/*Create the objects*/
ext
->
header
=
lv_
rec
t_create
(
new_win
,
copy_ext
->
header
);
ext
->
header
=
lv_
con
t_create
(
new_win
,
copy_ext
->
header
);
/*Move back the header because it is automatically moved to the scrollable */
lv_obj_set_protect
(
ext
->
header
,
LV_PROTECT_PARENT
);
lv_obj_set_parent
(
ext
->
header
,
new_win
);
ext
->
title
=
lv_label_create
(
ext
->
header
,
copy_ext
->
title
);
ext
->
btnh
=
lv_
rec
t_create
(
ext
->
header
,
copy_ext
->
btnh
);
ext
->
btnh
=
lv_
con
t_create
(
ext
->
header
,
copy_ext
->
btnh
);
/*Copy the control buttons*/
lv_obj_t
*
child
;
...
...
lv_objx/lv_win.h
View file @
d93844bd
...
...
@@ -38,7 +38,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
...
...
@@ -58,10 +58,10 @@ typedef struct
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
page
;
lv_obj_t
*
header
;
/*Pointer to the header
rectangle
of the window*/
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
rectangle
of the window*/
lv_style_t
*
style_header
;
/*Style of the header
rectangle
*/
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_cbtn_rel
;
/*Control button releases style*/
lv_style_t
*
style_cbtn_pr
;
/*Control button pressed style*/
cord_t
cbtn_size
;
/*Size of the control buttons (square)*/
...
...
lvgl.h
View file @
d93844bd
...
...
@@ -34,7 +34,7 @@
#include "lv_objx/lv_label.h"
#include "lv_objx/lv_line.h"
#include "lv_objx/lv_page.h"
#include
"lv_objx/lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_objx/lv_list.h"
#include "lv_objx/lv_chart.h"
#include "lv_objx/lv_cb.h"
...
...
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