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
a2b90eb9
Commit
a2b90eb9
authored
Jan 08, 2017
by
Kiss-Vamosi Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_list: fit is removed and moved to list style as widthe_sb
parent
1945e356
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
80 deletions
+21
-80
lv_app.c
lv_app/lv_app.c
+1
-0
lv_app_fsel.c
lv_app/lv_app_util/lv_app_fsel.c
+0
-1
lv_app_files.c
lv_appx/lv_app_files.c
+0
-1
lv_obj.h
lv_obj/lv_obj.h
+1
-1
lv_btn.c
lv_objx/lv_btn.c
+2
-2
lv_btnm.h
lv_objx/lv_btnm.h
+1
-1
lv_list.c
lv_objx/lv_list.c
+13
-62
lv_list.h
lv_objx/lv_list.h
+2
-11
lv_page.h
lv_objx/lv_page.h
+1
-1
No files found.
lv_app/lv_app.c
View file @
a2b90eb9
...
...
@@ -1001,6 +1001,7 @@ static void lv_app_init_style(void)
/*App list styles*/
lv_lists_get
(
LV_LISTS_SCRL
,
&
app_style
.
app_list_style
);
app_style
.
app_list_style
.
widthe_sb
=
0
;
memcpy
(
&
app_style
.
app_list_style
.
bg_pages
.
scrl_rects
,
&
app_style
.
menu_style
,
sizeof
(
lv_rects_t
));
app_style
.
app_list_style
.
bg_pages
.
scrl_rects
.
hpad
=
0
*
LV_DOWNSCALE
;
app_style
.
app_list_style
.
bg_pages
.
scrl_rects
.
vpad
=
0
*
LV_DOWNSCALE
;
...
...
lv_app/lv_app_util/lv_app_fsel.c
View file @
a2b90eb9
...
...
@@ -143,7 +143,6 @@ static void fsel_refr(void)
fsel_list
=
lv_list_create
(
fsel_win
,
NULL
);
lv_obj_set_width
(
fsel_list
,
app_style
->
win_useful_w
);
lv_obj_set_style
(
fsel_list
,
lv_lists_get
(
LV_LISTS_TRANSP
,
NULL
));
lv_list_set_fit
(
fsel_list
,
LV_LIST_FIT_WIDTH_SB
);
lv_obj_set_drag_parent
(
fsel_list
,
true
);
lv_obj_set_drag_parent
(
lv_page_get_scrl
(
fsel_list
),
true
);
lv_rect_set_fit
(
fsel_list
,
false
,
true
);
...
...
lv_appx/lv_app_files.c
View file @
a2b90eb9
...
...
@@ -284,7 +284,6 @@ static void win_create_list(lv_app_inst_t * app)
win_data
->
file_list
=
lv_list_create
(
app
->
win
,
NULL
);
lv_obj_set_width
(
win_data
->
file_list
,
app_style
->
win_useful_w
);
lv_obj_set_style
(
win_data
->
file_list
,
lv_lists_get
(
LV_LISTS_TRANSP
,
NULL
));
lv_list_set_fit
(
win_data
->
file_list
,
LV_LIST_FIT_WIDTH_SB
);
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_rect_set_fit
(
win_data
->
file_list
,
false
,
true
);
...
...
lv_obj/lv_obj.h
View file @
a2b90eb9
...
...
@@ -119,7 +119,7 @@ typedef enum
LV_PROTECT_OPA
=
0x02
,
/*Prevent lv_obj_set_opar to modify the opacity*/
LV_PROTECT_PARENT
=
0x04
,
/*Prevent automatic parent change (e.g. in lv_page)*/
LV_PROTECT_POS
=
0x08
,
/*Prevent automatic positioning (e.g. in lv_rect layout)*/
}
lv_
obj_
protect_t
;
}
lv_protect_t
;
typedef
enum
{
...
...
lv_objx/lv_btn.c
View file @
a2b90eb9
...
...
@@ -425,7 +425,7 @@ static void lv_btns_init(void)
/*Default style*/
lv_btns_def
.
mcolor
[
LV_BTN_STATE_REL
]
=
COLOR_MAKE
(
0x60
,
0x88
,
0xb0
);
lv_btns_def
.
gcolor
[
LV_BTN_STATE_REL
]
=
COLOR_MAKE
(
0x20
,
0x30
,
0x40
);
lv_btns_def
.
bcolor
[
LV_BTN_STATE_REL
]
=
COLOR_MAKE
(
0x
60
,
0x70
,
0x8
0
);
lv_btns_def
.
bcolor
[
LV_BTN_STATE_REL
]
=
COLOR_MAKE
(
0x
a0
,
0xc0
,
0xe
0
);
lv_btns_def
.
lcolor
[
LV_BTN_STATE_REL
]
=
COLOR_MAKE
(
0x30
,
0x40
,
0x50
);
lv_btns_def
.
flags
[
LV_BTN_STATE_REL
].
light_en
=
0
;
lv_btns_def
.
flags
[
LV_BTN_STATE_REL
].
transp
=
0
;
...
...
@@ -433,7 +433,7 @@ static void lv_btns_init(void)
lv_btns_def
.
mcolor
[
LV_BTN_STATE_PR
]
=
COLOR_MAKE
(
0x50
,
0x68
,
0x80
);
lv_btns_def
.
gcolor
[
LV_BTN_STATE_PR
]
=
COLOR_MAKE
(
0x18
,
0x20
,
0x28
);
lv_btns_def
.
bcolor
[
LV_BTN_STATE_PR
]
=
COLOR_MAKE
(
0x
40
,
0x60
,
0x8
0
);
lv_btns_def
.
bcolor
[
LV_BTN_STATE_PR
]
=
COLOR_MAKE
(
0x
60
,
0x80
,
0xa
0
);
lv_btns_def
.
lcolor
[
LV_BTN_STATE_PR
]
=
COLOR_MAKE
(
0x30
,
0x40
,
0x50
);
lv_btns_def
.
flags
[
LV_BTN_STATE_PR
].
light_en
=
0
;
lv_btns_def
.
flags
[
LV_BTN_STATE_PR
].
transp
=
0
;
...
...
lv_objx/lv_btnm.h
View file @
a2b90eb9
...
...
@@ -52,7 +52,7 @@ typedef enum
/* Type of callback function which is called when a button is released
* Parameters: button matrix, released button index in the map string
* return
false: the released button or the button matrix is deleted else true
*/
* return
LV_ACTION_RES_INV: the button matrix is deleted else LV_ACTION_RES_OK
*/
typedef
lv_action_res_t
(
*
lv_btnm_callback_t
)
(
lv_obj_t
*
,
uint16_t
);
/*Data of button matrix*/
...
...
lv_objx/lv_list.c
View file @
a2b90eb9
...
...
@@ -62,7 +62,6 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
dm_assert
(
new_list
);
lv_list_ext_t
*
ext
=
lv_obj_alloc_ext
(
new_list
,
sizeof
(
lv_list_ext_t
));
dm_assert
(
ext
);
ext
->
fit
=
LV_LIST_FIT_WIDTH_SB
;
lv_obj_set_signal_f
(
new_list
,
lv_list_signal
);
...
...
@@ -72,9 +71,6 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style
(
new_list
,
lv_lists_get
(
LV_LISTS_DEF
,
NULL
));
lv_rect_set_layout
(
LV_EA
(
new_list
,
lv_list_ext_t
)
->
page_ext
.
scrl
,
LV_LIST_LAYOUT_DEF
);
}
else
{
lv_list_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
fit
=
copy_ext
->
fit
;
/*Refresh the style with new signal function*/
lv_obj_refr_style
(
new_list
);
}
...
...
@@ -127,8 +123,7 @@ 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
,
lists
->
liste_layout
);
lv_rect_set_fit
(
liste
,
true
,
true
);
/*hor. fit might be disabled later*/
// lv_btn_set_state(liste, LV_BTN_STATE_TGL_REL);
lv_rect_set_fit
(
liste
,
false
,
true
);
if
(
img_fn
!=
NULL
)
{
lv_obj_t
*
img
=
lv_img_create
(
liste
,
NULL
);
...
...
@@ -144,42 +139,19 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
lv_obj_set_click
(
label
,
false
);
}
lv_lists_t
*
style
=
lv_obj_get_style
(
list
);
/*Make the size adjustment*/
if
(
ext
->
fit
==
LV_LIST_FIT_WIDTH
||
ext
->
fit
==
LV_LIST_FIT_WIDTH_SB
)
{
/*Now the width will be adjusted (so disable hor. auto fit)*/
lv_rect_set_fit
(
liste
,
false
,
true
);
cord_t
w
=
lv_obj_get_width
(
list
);
cord_t
hpad_tot
=
lists
->
bg_pages
.
bg_rects
.
hpad
+
lists
->
bg_pages
.
scrl_rects
.
hpad
;
w
-=
hpad_tot
*
2
;
/*Make place for the scrollbar if hpad_tot is too small*/
if
(
ext
->
fit
==
LV_LIST_FIT_WIDTH_SB
)
{
if
(
hpad_tot
<
lists
->
bg_pages
.
sb_width
)
w
-=
lists
->
bg_pages
.
sb_width
-
hpad_tot
;
}
lv_obj_set_width
(
liste
,
w
);
}
else
if
(
ext
->
fit
==
LV_LIST_FIT_LONGEST
)
{
/*In this case the width will be adjusted*/
lv_rect_set_fit
(
liste
,
false
,
true
);
lv_obj_t
*
e
;
cord_t
w
=
0
;
/*Get the longest list element*/
lv_obj_t
*
e_par
=
lv_obj_get_parent
(
liste
);
/*The page changes the parent so get it*/
e
=
lv_obj_get_child
(
e_par
,
NULL
);
while
(
e
!=
NULL
)
{
w
=
max
(
w
,
lv_obj_get_width
(
e
));
e
=
lv_obj_get_child
(
e_par
,
e
);
}
/*Set all list element to the longest width*/
e
=
lv_obj_get_child
(
e_par
,
NULL
)
;
while
(
e
!=
NULL
)
{
if
(
lv_obj_get_width
(
e
)
!=
w
)
{
lv_obj_set_width
(
e
,
w
);
}
e
=
lv_obj_get_child
(
e_par
,
e
)
;
}
}
cord_t
w
=
lv_obj_get_width
(
list
);
cord_t
hpad_tot
=
lists
->
bg_pages
.
bg_rects
.
hpad
+
lists
->
bg_pages
.
scrl_rects
.
hpad
;
w
-=
hpad_tot
*
2
;
/*Make place for the scrollbar if hpad_tot is too small*/
if
(
style
->
widthe_sb
!=
0
)
{
if
(
hpad_tot
<
lists
->
bg_pages
.
sb_width
)
w
-=
lists
->
bg_pages
.
sb_width
-
hpad_tot
;
}
lv_obj_set_width
(
liste
,
w
);
return
liste
;
}
...
...
@@ -233,34 +205,12 @@ void lv_list_down(lv_obj_t * list)
* Setter functions
*====================*/
/**
* Set the list element fitting of a list
* @param list pointer to a list object
* @param fit type of fitting (from lv_list_fit_t)
*/
void
lv_list_set_fit
(
lv_obj_t
*
list
,
lv_list_fit_t
fit
)
{
lv_list_ext_t
*
ext
=
lv_obj_get_ext
(
list
);
ext
->
fit
=
fit
;
}
/*=====================
* Getter functions
*====================*/
/**
* Get the fit type of a list
* @param list pointer to list object
* @return the fit (from lv_list_fit_t)
*/
lv_list_fit_t
lv_list_get_fit
(
lv_obj_t
*
list
)
{
return
LV_EA
(
list
,
lv_list_ext_t
)
->
fit
;
}
/**
* Get the text of a list element
* @param liste pointer to list element
* @return pointer to the text
...
...
@@ -414,6 +364,7 @@ static void lv_lists_init(void)
lv_imgs_get
(
LV_IMGS_DEF
,
&
lv_lists_def
.
liste_imgs
);
/*Lit element image style*/
lv_lists_def
.
liste_layout
=
LV_RECT_LAYOUT_ROW_M
;
lv_lists_def
.
widthe_sb
=
1
;
/*Only the scrollable part is visible style*/
memcpy
(
&
lv_lists_scrl
,
&
lv_lists_def
,
sizeof
(
lv_lists_t
));
...
...
lv_objx/lv_list.h
View file @
a2b90eb9
...
...
@@ -48,6 +48,7 @@ typedef struct
lv_labels_t
liste_labels
;
lv_imgs_t
liste_imgs
;
lv_rect_layout_t
liste_layout
;
uint8_t
widthe_sb
:
1
;
/*Keep space for the scrollbar*/
}
lv_lists_t
;
/*Built-in styles of list*/
...
...
@@ -58,20 +59,12 @@ typedef enum
LV_LISTS_TRANSP
,
}
lv_lists_builtin_t
;
typedef
enum
{
LV_LIST_FIT_WIDTH
,
LV_LIST_FIT_WIDTH_SB
,
/*Let space for the scrollbar*/
LV_LIST_FIT_CONTENT
,
LV_LIST_FIT_LONGEST
,
}
lv_list_fit_t
;
/*Data of list*/
typedef
struct
{
lv_page_ext_t
page_ext
;
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
fit
;
/*Width adjustment of list elements (from lv_list_adjsut_t)
*/
/*No new data
*/
}
lv_list_ext_t
;
/**********************
...
...
@@ -84,8 +77,6 @@ lv_lists_t * lv_lists_get(lv_lists_builtin_t style, lv_lists_t * copy);
void
lv_list_down
(
lv_obj_t
*
list
);
void
lv_list_up
(
lv_obj_t
*
list
);
void
lv_list_set_fit
(
lv_obj_t
*
list
,
lv_list_fit_t
fit
);
lv_list_fit_t
lv_list_get_fit
(
lv_obj_t
*
list
);
const
char
*
lv_list_element_get_txt
(
lv_obj_t
*
liste
);
/**********************
...
...
lv_objx/lv_page.h
View file @
a2b90eb9
...
...
@@ -81,7 +81,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
void
lv_page_set_rel_action
(
lv_obj_t
*
page
,
lv_action_t
rel_action
);
void
lv_page_set_pr_action
(
lv_obj_t
*
page
,
lv_action_t
pr_action
);
void
lv_page_glue_obj
(
lv_obj_t
*
page
,
bool
glue
);
void
lv_page_glue_obj
(
lv_obj_t
*
obj
,
bool
glue
);
void
lv_page_focus
(
lv_obj_t
*
page
,
lv_obj_t
*
obj
,
bool
anim_en
);
lv_obj_t
*
lv_page_get_scrl
(
lv_obj_t
*
page
);
...
...
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