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
45b8364b
Commit
45b8364b
authored
Sep 11, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_roller: lv_ddlist_set_selected() updated to work with roller too
parent
024d776d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
14 deletions
+8
-14
lv_ddlist.c
lv_objx/lv_ddlist.c
+5
-3
lv_roller.c
lv_objx/lv_roller.c
+2
-4
lv_roller.h
lv_objx/lv_roller.h
+0
-7
lvgl.h
lvgl.h
+1
-0
No files found.
lv_objx/lv_ddlist.c
View file @
45b8364b
...
...
@@ -234,7 +234,7 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext
(
ddlist
);
ext
->
sel_opt
=
sel_opt
;
ext
->
sel_opt
=
sel_opt
<
ext
->
num_opt
?
sel_opt
:
ext
->
num_opt
-
1
;
/*Move the list to show the current option*/
if
(
ext
->
opened
==
0
)
{
...
...
@@ -540,9 +540,11 @@ static void lv_ddlist_pos_act_option(lv_obj_t * ddlist)
cord_t
font_h
=
font_get_height
(
font
)
>>
FONT_ANTIALIAS
;
lv_style_t
*
label_style
=
lv_obj_get_style
(
ext
->
opt_label
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ddlist
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
scrl
);
lv_obj_set_y
(
scrl
,
-
(
ext
->
sel_opt
*
(
font_h
+
label_style
->
line_space
)
-
label_style
->
line_space
)
-
style_scrl
->
hpad
);
cord_t
h
=
lv_obj_get_height
(
ddlist
);
cord_t
line_y1
=
ext
->
sel_opt
*
(
font_h
+
label_style
->
line_space
)
+
ext
->
opt_label
->
cords
.
y1
-
scrl
->
cords
.
y1
;
lv_obj_set_y
(
scrl
,
-
line_y1
+
(
h
-
font_h
)
/
2
);
}
...
...
lv_objx/lv_roller.c
View file @
45b8364b
...
...
@@ -180,8 +180,6 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
}
/*Draw the object*/
else
if
(
mode
==
LV_DESIGN_DRAW_MAIN
)
{
lv_style_t
*
style
=
lv_obj_get_style
(
roller
);
lv_draw_rect
(
&
roller
->
cords
,
mask
,
style
);
...
...
@@ -189,7 +187,7 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
lv_roller_ext_t
*
ext
=
lv_obj_get_ext
(
roller
);
cord_t
font_h
=
font_get_height
(
font
)
>>
FONT_ANTIALIAS
;
area_t
rect_area
;
rect_area
.
y1
=
lv_obj_get_height
(
roller
)
/
2
-
font_h
/
2
-
style
->
line_space
-
2
;
rect_area
.
y1
=
roller
->
cords
.
y1
+
lv_obj_get_height
(
roller
)
/
2
-
font_h
/
2
-
style
->
line_space
-
2
;
rect_area
.
y2
=
rect_area
.
y1
+
font_h
+
style
->
line_space
;
rect_area
.
x1
=
ext
->
ddlist
.
opt_label
->
cords
.
x1
-
style
->
hpad
;
...
...
@@ -221,7 +219,7 @@ bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param)
lv_roller_ext_t
*
ext
=
lv_obj_get_ext
(
roller
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
opt_label
);
cord_t
label_y1
=
ext
->
ddlist
.
opt_label
->
cords
.
y1
;
cord_t
label_y1
=
ext
->
ddlist
.
page
.
scrl
->
cords
.
y1
-
roller
->
cords
.
y1
;
cord_t
label_unit
=
(
font_get_height
(
style_label
->
font
)
>>
FONT_ANTIALIAS
)
+
style_label
->
line_space
/
2
;
cord_t
mid
=
(
roller
->
cords
.
y2
-
roller
->
cords
.
y1
)
/
2
;
...
...
lv_objx/lv_roller.h
View file @
45b8364b
...
...
@@ -3,13 +3,6 @@
*
*/
/*Search an replace: roller -> object normal name with lower case (e.g. button, label etc.)
* roller -> object short name with lower case(e.g. btn, label etc)
* ROLLER -> object short name with upper case (e.g. BTN, LABEL etc.)
*
*/
#ifndef LV_ROLLER_H
#define LV_ROLLER_H
...
...
lvgl.h
View file @
45b8364b
...
...
@@ -33,6 +33,7 @@ extern "C" {
#include "lv_objx/lv_btnm.h"
#include "lv_objx/lv_kb.h"
#include "lv_objx/lv_ddlist.h"
#include "lv_objx/lv_roller.h"
#include "lv_objx/lv_ta.h"
#include "lv_objx/lv_win.h"
#include "lv_objx/lv_tabview.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