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
b9b735ce
Commit
b9b735ce
authored
Dec 19, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor updates
parent
65032619
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
163 additions
and
108 deletions
+163
-108
lv_obj.c
lv_core/lv_obj.c
+8
-3
lv_obj.h
lv_core/lv_obj.h
+1
-1
lv_btn.c
lv_objx/lv_btn.c
+9
-9
lv_btn.h
lv_objx/lv_btn.h
+1
-1
lv_btnm.c
lv_objx/lv_btnm.c
+18
-13
lv_cb.c
lv_objx/lv_cb.c
+2
-2
lv_cb.h
lv_objx/lv_cb.h
+2
-2
lv_gauge.c
lv_objx/lv_gauge.c
+2
-3
lv_gauge.h
lv_objx/lv_gauge.h
+20
-0
lv_kb.c
lv_objx/lv_kb.c
+10
-8
lv_kb.h
lv_objx/lv_kb.h
+14
-3
lv_led.c
lv_objx/lv_led.c
+1
-1
lv_led.h
lv_objx/lv_led.h
+7
-8
lv_list.c
lv_objx/lv_list.c
+2
-2
lv_lmeter.c
lv_objx/lv_lmeter.c
+1
-1
lv_roller.c
lv_objx/lv_roller.c
+3
-3
lv_roller.h
lv_objx/lv_roller.h
+1
-1
lv_sw.c
lv_objx/lv_sw.c
+2
-2
lv_sw.h
lv_objx/lv_sw.h
+2
-2
lv_tabview.c
lv_objx/lv_tabview.c
+2
-6
lv_tabview.h
lv_objx/lv_tabview.h
+2
-3
lv_win.c
lv_objx/lv_win.c
+1
-1
lv_theme_alien.c
lv_themes/lv_theme_alien.c
+3
-3
lv_theme_default.c
lv_themes/lv_theme_default.c
+12
-7
lv_theme_material.c
lv_themes/lv_theme_material.c
+21
-18
lv_theme_mono.c
lv_themes/lv_theme_mono.c
+5
-1
lv_theme_night.c
lv_themes/lv_theme_night.c
+10
-4
lv_theme_templ.c
lv_themes/lv_theme_templ.c
+1
-0
No files found.
lv_core/lv_obj.c
View file @
b9b735ce
...
...
@@ -10,6 +10,7 @@
#include "lv_indev.h"
#include "lv_refr.h"
#include "lv_group.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_rbasic.h"
#include "../lv_misc/lv_anim.h"
...
...
@@ -130,9 +131,13 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
new_obj
->
coords
.
y2
=
LV_VER_RES
-
1
;
new_obj
->
ext_size
=
0
;
/*Set appearance*/
/*Set the default styles*/
lv_theme_t
*
th
=
lv_theme_get_current
();
if
(
th
)
{
new_obj
->
style_p
=
th
->
bg
;
}
else
{
new_obj
->
style_p
=
&
lv_style_scr
;
}
/*Set virtual functions*/
lv_obj_set_signal_func
(
new_obj
,
lv_obj_signal
);
lv_obj_set_design_func
(
new_obj
,
lv_obj_design
);
...
...
@@ -254,7 +259,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
/**
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
* @
preturn LV_RES_INV beac
use the object is deleted
* @
return LV_RES_INV beca
use the object is deleted
*/
lv_res_t
lv_obj_del
(
lv_obj_t
*
obj
)
{
...
...
lv_core/lv_obj.h
View file @
b9b735ce
...
...
@@ -209,7 +209,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
/**
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
* @
preturn LV_RES_INV beac
use the object is deleted
* @
return LV_RES_INV beca
use the object is deleted
*/
lv_res_t
lv_obj_del
(
lv_obj_t
*
obj
);
...
...
lv_objx/lv_btn.c
View file @
b9b735ce
...
...
@@ -64,7 +64,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
state
=
LV_BTN_STATE_REL
;
ext
->
actions
[
LV_BTN_ACTION_PR
]
=
NULL
;
ext
->
actions
[
LV_BTN_ACTION_
REL
]
=
NULL
;
ext
->
actions
[
LV_BTN_ACTION_
CLICK
]
=
NULL
;
ext
->
actions
[
LV_BTN_ACTION_LONG_PR
]
=
NULL
;
ext
->
actions
[
LV_BTN_ACTION_LONG_PR_REPEAT
]
=
NULL
;
...
...
@@ -333,8 +333,8 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
}
if
(
ext
->
actions
[
LV_BTN_ACTION_
REL
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
REL
](
btn
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
CLICK
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
CLICK
](
btn
);
}
}
else
{
/*If dragged change back the state*/
if
(
ext
->
state
==
LV_BTN_STATE_PR
)
{
...
...
@@ -359,13 +359,13 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
char
c
=
*
((
char
*
)
param
);
if
(
c
==
LV_GROUP_KEY_RIGHT
||
c
==
LV_GROUP_KEY_UP
)
{
if
(
lv_btn_get_toggle
(
btn
)
!=
false
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_TGL_REL
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
REL
]
&&
lv_btn_get_state
(
btn
)
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
REL
](
btn
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
CLICK
]
&&
lv_btn_get_state
(
btn
)
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
CLICK
](
btn
);
}
}
else
if
(
c
==
LV_GROUP_KEY_LEFT
||
c
==
LV_GROUP_KEY_DOWN
)
{
if
(
lv_btn_get_toggle
(
btn
)
!=
false
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
REL
]
&&
lv_btn_get_state
(
btn
)
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
REL
](
btn
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
CLICK
]
&&
lv_btn_get_state
(
btn
)
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
CLICK
](
btn
);
}
}
else
if
(
c
==
LV_GROUP_KEY_ENTER
)
{
if
(
lv_btn_get_toggle
(
btn
)
!=
false
)
{
...
...
@@ -374,8 +374,8 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
else
if
(
state
==
LV_BTN_STATE_TGL_REL
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_REL
);
else
if
(
state
==
LV_BTN_STATE_TGL_PR
)
lv_btn_set_state
(
btn
,
LV_BTN_STATE_PR
);
}
if
(
ext
->
actions
[
LV_BTN_ACTION_
REL
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
REL
](
btn
);
if
(
ext
->
actions
[
LV_BTN_ACTION_
CLICK
]
&&
state
!=
LV_BTN_STATE_INA
)
{
res
=
ext
->
actions
[
LV_BTN_ACTION_
CLICK
](
btn
);
}
}
}
...
...
lv_objx/lv_btn.h
View file @
b9b735ce
...
...
@@ -45,7 +45,7 @@ typedef enum
typedef
enum
{
LV_BTN_ACTION_
REL
,
LV_BTN_ACTION_
CLICK
,
LV_BTN_ACTION_PR
,
LV_BTN_ACTION_LONG_PR
,
LV_BTN_ACTION_LONG_PR_REPEAT
,
...
...
lv_objx/lv_btnm.c
View file @
b9b735ce
...
...
@@ -150,10 +150,10 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
create_buttons
(
btnm
,
map
);
/*Set size and positions of the buttons*/
lv_style_t
*
btnms
=
lv_obj_get_style
(
btnm
);
lv_coord_t
max_w
=
lv_obj_get_width
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
hor
;
lv_coord_t
max_h
=
lv_obj_get_height
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
ver
;
lv_coord_t
act_y
=
btnms
->
body
.
padding
.
ver
;
lv_style_t
*
style_bg
=
lv_btnm_get_style
(
btnm
,
LV_BTNM_STYLE_BG
);
lv_coord_t
max_w
=
lv_obj_get_width
(
btnm
)
-
2
*
style_bg
->
body
.
padding
.
hor
;
lv_coord_t
max_h
=
lv_obj_get_height
(
btnm
)
-
2
*
style_bg
->
body
.
padding
.
ver
;
lv_coord_t
act_y
=
style_bg
->
body
.
padding
.
ver
;
/*Count the lines to calculate button height*/
uint8_t
line_cnt
=
1
;
...
...
@@ -162,7 +162,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
if
(
strcmp
(
map
[
li
],
"
\n
"
)
==
0
)
line_cnt
++
;
}
lv_coord_t
btn_h
=
max_h
-
((
line_cnt
-
1
)
*
btnms
->
body
.
padding
.
inner
);
lv_coord_t
btn_h
=
max_h
-
((
line_cnt
-
1
)
*
style_bg
->
body
.
padding
.
inner
);
btn_h
=
btn_h
/
line_cnt
;
btn_h
--
;
/*-1 because e.g. height = 100 means 101 pixels (0..100)*/
...
...
@@ -189,11 +189,11 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Only deal with the non empty lines*/
if
(
btn_cnt
!=
0
)
{
/*Calculate the width of all units*/
lv_coord_t
all_unit_w
=
max_w
-
((
btn_cnt
-
1
)
*
btnms
->
body
.
padding
.
inner
);
lv_coord_t
all_unit_w
=
max_w
-
((
btn_cnt
-
1
)
*
style_bg
->
body
.
padding
.
inner
);
/*Set the button size and positions and set the texts*/
uint16_t
i
;
lv_coord_t
act_x
=
btnms
->
body
.
padding
.
hor
;
lv_coord_t
act_x
=
style_bg
->
body
.
padding
.
hor
;
lv_coord_t
act_unit_w
;
unit_act_cnt
=
0
;
for
(
i
=
0
;
i
<
btn_cnt
;
i
++
)
{
...
...
@@ -204,12 +204,17 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
act_unit_w
--
;
/*-1 because e.g. width = 100 means 101 pixels (0..100)*/
/*Always recalculate act_x because of rounding errors */
act_x
=
(
unit_act_cnt
*
all_unit_w
)
/
unit_cnt
+
i
*
btnms
->
body
.
padding
.
inner
+
btnms
->
body
.
padding
.
hor
;
act_x
=
(
unit_act_cnt
*
all_unit_w
)
/
unit_cnt
+
i
*
style_bg
->
body
.
padding
.
inner
+
style_bg
->
body
.
padding
.
hor
;
lv_area_set
(
&
ext
->
button_areas
[
btn_i
],
act_x
,
act_y
,
act_x
+
act_unit_w
,
act_y
+
btn_h
);
/* Set the button's area.
* If inner padding is zero then use the prev. button x2 as x1 to avoid rounding errors*/
if
(
style_bg
->
body
.
padding
.
inner
==
0
&&
act_x
!=
style_bg
->
body
.
padding
.
hor
)
{
lv_area_set
(
&
ext
->
button_areas
[
btn_i
],
ext
->
button_areas
[
btn_i
-
1
].
x2
,
act_y
,
act_x
+
act_unit_w
,
act_y
+
btn_h
);
}
else
{
lv_area_set
(
&
ext
->
button_areas
[
btn_i
],
act_x
,
act_y
,
act_x
+
act_unit_w
,
act_y
+
btn_h
);
}
unit_act_cnt
+=
get_button_width
(
map_p_tmp
[
i
]);
...
...
@@ -217,7 +222,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
btn_i
++
;
}
}
act_y
+=
btn_h
+
btnms
->
body
.
padding
.
inner
;
act_y
+=
btn_h
+
style_bg
->
body
.
padding
.
inner
;
if
(
strlen
(
map_p_tmp
[
btn_cnt
])
==
0
)
break
;
/*Break on end of map*/
map_p_tmp
=
&
map_p_tmp
[
btn_cnt
+
1
];
/*Set the map to the next line*/
i_tot
++
;
/*Skip the '\n'*/
...
...
lv_objx/lv_cb.c
View file @
b9b735ce
...
...
@@ -292,10 +292,10 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
if
(
res
!=
LV_RES_OK
)
return
res
;
lv_cb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cb
);
lv_style_t
*
style
=
lv_obj_get_style
(
cb
);
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_obj_set_size
(
ext
->
bullet
,
lv_font_get_height_scale
(
style
->
text
.
font
),
lv_font_get_height_scale
(
style
->
text
.
font
));
lv_style_t
*
label_style
=
lv_label_get_style
(
ext
->
label
);
lv_obj_set_size
(
ext
->
bullet
,
lv_font_get_height_scale
(
label_style
->
text
.
font
),
lv_font_get_height_scale
(
label_style
->
text
.
font
));
lv_btn_set_state
(
ext
->
bullet
,
lv_btn_get_state
(
cb
));
}
else
if
(
sign
==
LV_SIGNAL_PRESSED
||
sign
==
LV_SIGNAL_RELEASED
||
...
...
lv_objx/lv_cb.h
View file @
b9b735ce
...
...
@@ -103,7 +103,7 @@ static inline void lv_cb_set_inactive(lv_obj_t * cb)
*/
static
inline
void
lv_cb_set_action
(
lv_obj_t
*
cb
,
lv_action_t
action
)
{
lv_btn_set_action
(
cb
,
LV_BTN_ACTION_
REL
,
action
);
lv_btn_set_action
(
cb
,
LV_BTN_ACTION_
CLICK
,
action
);
}
...
...
@@ -143,7 +143,7 @@ static inline bool lv_cb_is_checked(lv_obj_t * cb)
*/
static
inline
lv_action_t
lv_cb_get_action
(
lv_obj_t
*
cb
)
{
return
lv_btn_get_action
(
cb
,
LV_BTN_ACTION_
REL
);
return
lv_btn_get_action
(
cb
,
LV_BTN_ACTION_
CLICK
);
}
...
...
lv_objx/lv_gauge.c
View file @
b9b735ce
...
...
@@ -86,6 +86,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
if
(
copy
==
NULL
)
{
lv_gauge_set_scale
(
new_gauge
,
LV_GAUGE_DEF_ANGLE
,
LV_GAUGE_DEF_LINE_COUNT
,
LV_GAUGE_DEF_LABEL_COUNT
);
lv_gauge_set_needle_count
(
new_gauge
,
1
,
NULL
);
lv_gauge_set_critical_value
(
new_gauge
,
80
);
lv_obj_set_size
(
new_gauge
,
2
*
LV_DPI
,
2
*
LV_DPI
);
/*Set the default styles*/
...
...
@@ -168,6 +169,7 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value)
lv_obj_invalidate
(
gauge
);
}
/**
* Set the scale settings of a gauge
* @param gauge pointer to a gauge object
...
...
@@ -260,8 +262,6 @@ static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_
/*Draw the ancestor line meter with max value to show the rainbow like line colors*/
uint16_t
line_cnt_tmp
=
ext
->
lmeter
.
line_cnt
;
int16_t
value_tmp
=
ext
->
lmeter
.
cur_value
;
ext
->
lmeter
.
cur_value
=
ext
->
lmeter
.
max_value
;
ancestor_design
(
gauge
,
mask
,
mode
);
/*To draw lines*/
/*Temporally modify the line meter to draw thicker and longer lines where labels are*/
...
...
@@ -275,7 +275,6 @@ static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_
ancestor_design
(
gauge
,
mask
,
mode
);
/*To draw lines*/
ext
->
lmeter
.
line_cnt
=
line_cnt_tmp
;
/*Restore the parameters*/
ext
->
lmeter
.
cur_value
=
value_tmp
;
gauge
->
style_p
=
style_ori_p
;
/*Restore the ORIGINAL style pointer*/
lv_gauge_draw_needle
(
gauge
,
mask
);
...
...
lv_objx/lv_gauge.h
View file @
b9b735ce
...
...
@@ -89,6 +89,16 @@ static inline void lv_gauge_set_range(lv_obj_t *gauge, int16_t min, int16_t max)
}
/**
* Set a critical value on the scale. After this value 'line.color' scale lines will be drawn
* @param gauge pointer to a gauge object
* @param value the critical value
*/
static
inline
void
lv_gauge_set_critical_value
(
lv_obj_t
*
gauge
,
int16_t
value
)
{
lv_lmeter_set_value
(
gauge
,
value
);
}
/**
* Set the scale settings of a gauge
* @param gauge pointer to a gauge object
* @param angle angle of the scale (0..360)
...
...
@@ -147,6 +157,16 @@ static inline int16_t lv_gauge_get_max_value(lv_obj_t * lmeter)
}
/**
* Get a critical value on the scale.
* @param gauge pointer to a gauge object
* @return the critical value
*/
static
inline
int16_t
lv_gauge_get_critical_value
(
lv_obj_t
*
gauge
)
{
return
lv_lmeter_get_value
(
gauge
);
}
/**
* Set the number of labels (and the thicker lines too)
* @param gauge pointer to a gauge object
* @return count of labels
...
...
lv_objx/lv_kb.c
View file @
b9b735ce
...
...
@@ -90,7 +90,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
ta
=
NULL
;
ext
->
mode
=
LV_KB_MODE_TEXT
;
ext
->
cursor_mng
=
0
;
ext
->
clos
e_action
=
NULL
;
ext
->
hid
e_action
=
NULL
;
ext
->
ok_action
=
NULL
;
/*The signal and design functions are not copied so set them here*/
...
...
@@ -122,7 +122,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
ta
=
copy_ext
->
ta
;
ext
->
mode
=
copy_ext
->
mode
;
ext
->
cursor_mng
=
copy_ext
->
cursor_mng
;
ext
->
close_action
=
copy_ext
->
clos
e_action
;
ext
->
hide_action
=
copy_ext
->
hid
e_action
;
ext
->
ok_action
=
copy_ext
->
ok_action
;
/*Refresh the style with new signal function*/
...
...
@@ -153,7 +153,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
ext
->
ta
=
ta
;
if
(
ext
->
cursor_mng
)
{
if
(
ext
->
ta
&&
ext
->
cursor_mng
)
{
cur_type
=
lv_ta_get_cursor_type
(
ext
->
ta
);
lv_ta_set_cursor_type
(
ext
->
ta
,
cur_type
&
(
~
LV_CURSOR_HIDDEN
));
}
...
...
@@ -206,10 +206,10 @@ void lv_kb_set_ok_action(lv_obj_t * kb, lv_action_t action)
* @param kb pointer to Keyboard object
* @param action a callback with 'lv_action_t' type
*/
void
lv_kb_set_
clos
e_action
(
lv_obj_t
*
kb
,
lv_action_t
action
)
void
lv_kb_set_
hid
e_action
(
lv_obj_t
*
kb
,
lv_action_t
action
)
{
lv_kb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
kb
);
ext
->
clos
e_action
=
action
;
ext
->
hid
e_action
=
action
;
}
/**
...
...
@@ -296,10 +296,10 @@ lv_action_t lv_kb_get_ok_action(lv_obj_t * kb)
* @param kb pointer to Keyboard object
* @return the close callback
*/
lv_action_t
lv_kb_get_
clos
e_action
(
lv_obj_t
*
kb
)
lv_action_t
lv_kb_get_
hid
e_action
(
lv_obj_t
*
kb
)
{
lv_kb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
kb
);
return
ext
->
clos
e_action
;
return
ext
->
hid
e_action
;
}
/**
...
...
@@ -374,10 +374,12 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt)
return
LV_RES_OK
;
}
else
if
(
strcmp
(
txt
,
SYMBOL_CLOSE
)
==
0
)
{
if
(
ext
->
close_action
)
ext
->
close_action
(
kb
);
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area*/
if
(
ext
->
hide_action
)
ext
->
hide_action
(
kb
);
else
lv_obj_del
(
kb
);
return
LV_RES_INV
;
}
else
if
(
strcmp
(
txt
,
SYMBOL_OK
)
==
0
)
{
lv_kb_set_ta
(
kb
,
NULL
);
/*De-assign the text area*/
if
(
ext
->
ok_action
)
ext
->
ok_action
(
kb
);
else
lv_obj_del
(
kb
);
return
LV_RES_INV
;
...
...
lv_objx/lv_kb.h
View file @
b9b735ce
...
...
@@ -41,7 +41,7 @@ typedef struct {
lv_kb_mode_t
mode
;
/*Key map type*/
uint8_t
cursor_mng
:
1
;
/*1: automatically show/hide cursor when a text area is assigned or left*/
lv_action_t
ok_action
;
/*Called when the "Ok" button is clicked*/
lv_action_t
clos
e_action
;
/*Called when the "Hide" button is clicked*/
lv_action_t
hid
e_action
;
/*Called when the "Hide" button is clicked*/
}
lv_kb_ext_t
;
typedef
enum
{
...
...
@@ -102,7 +102,18 @@ void lv_kb_set_ok_action(lv_obj_t * kb, lv_action_t action);
* @param kb pointer to Keyboard object
* @param action a callback with 'lv_action_t' type
*/
void
lv_kb_set_close_action
(
lv_obj_t
*
kb
,
lv_action_t
action
);
void
lv_kb_set_hide_action
(
lv_obj_t
*
kb
,
lv_action_t
action
);
/**
* Set a new map for the keyboard
* @param kb pointer to a Keyboard object
* @param map pointer to a string array to describe the map.
* See 'lv_btnm_set_map()' for more info.
*/
static
inline
void
lv_kb_set_map
(
lv_obj_t
*
kb
,
const
char
**
map
)
{
lv_btnm_set_map
(
kb
,
map
);
}
/**
* Set a style of a keyboard
...
...
@@ -149,7 +160,7 @@ lv_action_t lv_kb_get_ok_action(lv_obj_t * kb);
* @param kb pointer to Keyboard object
* @return the close callback
*/
lv_action_t
lv_kb_get_
clos
e_action
(
lv_obj_t
*
kb
);
lv_action_t
lv_kb_get_
hid
e_action
(
lv_obj_t
*
kb
);
/**
* Get a style of a keyboard
...
...
lv_objx/lv_led.c
View file @
b9b735ce
...
...
@@ -133,7 +133,7 @@ void lv_led_off(lv_obj_t * led)
* Toggle the state of a LED
* @param led pointer to a LED object
*/
void
lv_led_t
gl
(
lv_obj_t
*
led
)
void
lv_led_t
oggle
(
lv_obj_t
*
led
)
{
uint8_t
bright
=
lv_led_get_bright
(
led
);
if
(
bright
>
(
LV_LED_BRIGHT_OFF
+
LV_LED_BRIGHT_ON
)
>>
1
)
lv_led_off
(
led
);
...
...
lv_objx/lv_led.h
View file @
b9b735ce
...
...
@@ -69,14 +69,7 @@ void lv_led_off(lv_obj_t * led);
* Toggle the state of a LED
* @param led pointer to a LED object
*/
void
lv_led_tgl
(
lv_obj_t
*
led
);
/**
* Get the brightness of a LEd object
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t
lv_led_get_bright
(
lv_obj_t
*
led
);
void
lv_led_toggle
(
lv_obj_t
*
led
);
/**
* Set the style of a led
...
...
@@ -88,6 +81,12 @@ static inline void lv_led_set_style(lv_obj_t *led, lv_style_t *style)
lv_obj_set_style
(
led
,
style
);
}
/**
* Get the brightness of a LEd object
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t
lv_led_get_bright
(
lv_obj_t
*
led
);
/**
* Get the style of an led object
...
...
lv_objx/lv_list.c
View file @
b9b735ce
...
...
@@ -155,7 +155,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
lv_btn_set_style
(
liste
,
LV_BTN_STYLE_TGL_PR
,
ext
->
styles_btn
[
LV_BTN_STATE_TGL_PR
]);
lv_btn_set_style
(
liste
,
LV_BTN_STYLE_INA
,
ext
->
styles_btn
[
LV_BTN_STATE_INA
]);
lv_btn_set_action
(
liste
,
LV_BTN_ACTION_
REL
,
rel_action
);
lv_btn_set_action
(
liste
,
LV_BTN_ACTION_
CLICK
,
rel_action
);
lv_page_glue_obj
(
liste
,
true
);
lv_btn_set_layout
(
liste
,
LV_LAYOUT_ROW_M
);
lv_btn_set_fit
(
liste
,
false
,
true
);
...
...
@@ -565,7 +565,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if
(
btn
!=
NULL
)
{
lv_action_t
rel_action
;
rel_action
=
lv_btn_get_action
(
btn
,
LV_BTN_ACTION_
REL
);
rel_action
=
lv_btn_get_action
(
btn
,
LV_BTN_ACTION_
CLICK
);
if
(
rel_action
!=
NULL
)
rel_action
(
btn
);
}
}
...
...
lv_objx/lv_lmeter.c
View file @
b9b735ce
...
...
@@ -277,7 +277,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_desig
p1
.
x
=
x_out
+
x_ofs
;
p1
.
y
=
y_out
+
y_ofs
;
if
(
i
>
level
)
style_tmp
.
line
.
color
=
style
->
line
.
color
;
if
(
i
>
=
level
)
style_tmp
.
line
.
color
=
style
->
line
.
color
;
else
{
style_tmp
.
line
.
color
=
lv_color_mix
(
style
->
body
.
grad_color
,
style
->
body
.
main_color
,
(
255
*
i
)
/
ext
->
line_cnt
);
}
...
...
lv_objx/lv_roller.c
View file @
b9b735ce
...
...
@@ -74,7 +74,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_rel_action
(
new_roller
,
NULL
);
/*Roller don't uses it (like ddlist)*/
lv_page_set_scrl_fit
(
new_roller
,
true
,
false
);
/*Height is specified directly*/
lv_ddlist_open
(
new_roller
,
false
);
lv_roller_set_row_count
(
new_roller
,
3
);
lv_roller_set_
visible_
row_count
(
new_roller
,
3
);
lv_label_set_align
(
ext
->
ddlist
.
label
,
LV_LABEL_ALIGN_CENTER
);
lv_obj_set_signal_func
(
scrl
,
lv_roller_scrl_signal
);
...
...
@@ -122,11 +122,11 @@ void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en)
* @param roller pointer to a roller object
* @param row_cnt number of desired visible rows
*/
void
lv_roller_set_row_count
(
lv_obj_t
*
roller
,
uint8_t
row_cnt
)
void
lv_roller_set_
visible_
row_count
(
lv_obj_t
*
roller
,
uint8_t
row_cnt
)
{
lv_roller_ext_t
*
ext
=
lv_obj_get_ext_attr
(
roller
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
label
);
lv_ddlist_set_fix_height
(
roller
,
lv_font_get_height_scale
(
style_label
->
text
.
font
)
*
row_cnt
+
style_label
->
text
.
line_space
*
(
row_cnt
+
1
));
lv_ddlist_set_fix_height
(
roller
,
lv_font_get_height_scale
(
style_label
->
text
.
font
)
*
row_cnt
+
style_label
->
text
.
line_space
*
(
row_cnt
));
}
/**
...
...
lv_objx/lv_roller.h
View file @
b9b735ce
...
...
@@ -76,7 +76,7 @@ void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en);
* @param roller pointer to a roller object
* @param row_cnt number of desired visible rows
*/
void
lv_roller_set_row_count
(
lv_obj_t
*
roller
,
uint8_t
row_cnt
);
void
lv_roller_set_
visible_
row_count
(
lv_obj_t
*
roller
,
uint8_t
row_cnt
);
/**
* Enable or disable the horizontal fit to the content
...
...
lv_objx/lv_sw.c
View file @
b9b735ce
...
...
@@ -105,7 +105,7 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
* Turn ON the switch
* @param sw pointer to a switch object
*/
void
lv_sw_
set_
on
(
lv_obj_t
*
sw
)
void
lv_sw_on
(
lv_obj_t
*
sw
)
{
lv_sw_ext_t
*
ext
=
lv_obj_get_ext_attr
(
sw
);
lv_slider_set_value
(
sw
,
1
);
...
...
@@ -116,7 +116,7 @@ void lv_sw_set_on(lv_obj_t *sw)
* Turn OFF the switch
* @param sw pointer to a switch object
*/
void
lv_sw_
set_
off
(
lv_obj_t
*
sw
)
void
lv_sw_off
(
lv_obj_t
*
sw
)
{
lv_sw_ext_t
*
ext
=
lv_obj_get_ext_attr
(
sw
);
lv_slider_set_value
(
sw
,
0
);
...
...
lv_objx/lv_sw.h
View file @
b9b735ce
...
...
@@ -68,13 +68,13 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy);
* Turn ON the switch
* @param sw pointer to a switch object
*/
void
lv_sw_
set_
on
(
lv_obj_t
*
sw
);
void
lv_sw_on
(
lv_obj_t
*
sw
);
/**
* Turn OFF the switch
* @param sw pointer to a switch object
*/
void
lv_sw_
set_
off
(
lv_obj_t
*
sw
);
void
lv_sw_off
(
lv_obj_t
*
sw
);
/**
* Set a function which will be called when the switch is toggled by the user
...
...
lv_objx/lv_tabview.c
View file @
b9b735ce
...
...
@@ -324,10 +324,10 @@ void lv_tabview_set_sliding(lv_obj_t * tabview, bool en)
* @param tabview pointer to Tab view object
* @param anim_time_ms time of animation in milliseconds
*/
void
lv_tabview_set_anim_time
(
lv_obj_t
*
tabview
,
uint16_t
anim_time
_ms
)
void
lv_tabview_set_anim_time
(
lv_obj_t
*
tabview
,
uint16_t
anim_time
)
{
lv_tabview_ext_t
*
ext
=
lv_obj_get_ext_attr
(
tabview
);
ext
->
anim_time
=
anim_time
_ms
;
ext
->
anim_time
=
anim_time
;
}
/**
...
...
@@ -361,9 +361,6 @@ void lv_tabview_set_style(lv_obj_t *tabview, lv_tabview_style_t type, lv_style_t
case
LV_TABVIEW_STYLE_BTN_TGL_PR
:
lv_btnm_set_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_TGL_PR
,
style
);
break
;
case
LV_TABVIEW_STYLE_BTN_INA
:
lv_btnm_set_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_INA
,
style
);
break
;
case
LV_TABVIEW_STYLE_INDIC
:
lv_obj_set_style
(
ext
->
indic
,
style
);
lv_obj_set_height
(
ext
->
indic
,
style
->
body
.
padding
.
inner
);
...
...
@@ -470,7 +467,6 @@ lv_style_t * lv_tabview_get_style(lv_obj_t *tabview, lv_tabview_style_t type)
case
LV_TABVIEW_STYLE_BTN_PR
:
return
lv_btnm_get_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_PR
);
case
LV_TABVIEW_STYLE_BTN_TGL_REL
:
return
lv_btnm_get_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_TGL_REL
);
case
LV_TABVIEW_STYLE_BTN_TGL_PR
:
return
lv_btnm_get_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_TGL_PR
);
case
LV_TABVIEW_STYLE_BTN_INA
:
return
lv_btnm_get_style
(
ext
->
btns
,
LV_BTNM_STYLE_BTN_INA
);
default:
return
NULL
;
}
...
...
lv_objx/lv_tabview.h
View file @
b9b735ce
...
...
@@ -68,7 +68,6 @@ typedef enum {
LV_TABVIEW_STYLE_BTN_PR
,
LV_TABVIEW_STYLE_BTN_TGL_REL
,
LV_TABVIEW_STYLE_BTN_TGL_PR
,
LV_TABVIEW_STYLE_BTN_INA
,
}
lv_tabview_style_t
;
/**********************
...
...
@@ -126,9 +125,9 @@ void lv_tabview_set_sliding(lv_obj_t * tabview, bool en);
/**
* Set the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @param anim_time
_ms
time of animation in milliseconds
* @param anim_time time of animation in milliseconds
*/
void
lv_tabview_set_anim_time
(
lv_obj_t
*
tabview
,
uint16_t
anim_time
_ms
);
void
lv_tabview_set_anim_time
(
lv_obj_t
*
tabview
,
uint16_t
anim_time
);
/**
* Set the style of a tab view
...
...
lv_objx/lv_win.c
View file @
b9b735ce
...
...
@@ -157,7 +157,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const char * img_path, lv_action_t rel
lv_btn_set_style
(
btn
,
LV_BTN_STYLE_REL
,
ext
->
style_btn_rel
);
lv_btn_set_style
(
btn
,
LV_BTN_STYLE_PR
,
ext
->
style_btn_pr
);
lv_obj_set_size
(
btn
,
ext
->
btn_size
,
ext
->
btn_size
);
lv_btn_set_action
(
btn
,
LV_BTN_ACTION_
REL
,
rel_action
);
lv_btn_set_action
(
btn
,
LV_BTN_ACTION_
CLICK
,
rel_action
);
lv_obj_t
*
img
=
lv_img_create
(
btn
,
NULL
);
lv_obj_set_click
(
img
,
false
);
...
...
lv_themes/lv_theme_alien.c
View file @
b9b735ce
...
...
@@ -365,13 +365,13 @@ static void gauge_init(void)
static
lv_style_t
gauge_bg
;
lv_style_copy
(
&
gauge_bg
,
&
def
);
gauge_bg
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
70
);
gauge_bg
.
body
.
grad_color
=
lv_color_hsv_to_rgb
(
_hue
,
80
,
80
)
;
gauge_bg
.
body
.
grad_color
=
gauge_bg
.
body
.
main_color
;
gauge_bg
.
body
.
padding
.
hor
=
LV_DPI
/
12
;
/*Scale line length*/
gauge_bg
.
body
.
padding
.
ver
=
LV_DPI
/
10
;
/*Needle center size*/
gauge_bg
.
body
.
padding
.
inner
=
LV_DPI
/
8
;
/*Label - scale distance*/
gauge_bg
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x777
);
gauge_bg
.
line
.
color
=
LV_COLOR_HEX3
(
0x55
5
);
gauge_bg
.
line
.
width
=
2
;
gauge_bg
.
line
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
80
,
7
5
);
gauge_bg
.
line
.
width
=
3
;
gauge_bg
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
90
);
gauge_bg
.
text
.
font
=
_font
;
...
...
lv_themes/lv_theme_default.c
View file @
b9b735ce
...
...
@@ -178,8 +178,8 @@ static void lmeter_init(void)
lv_style_copy
(
&
lmeter
,
&
lv_style_pretty_color
);
lmeter
.
line
.
color
=
LV_COLOR_HEX3
(
0xddd
);
lmeter
.
line
.
width
=
2
;
lmeter
.
body
.
main_color
=
color_mix
(
lmeter
.
body
.
main_color
,
LV_COLOR_WHITE
,
LV_OPA_50
);
lmeter
.
body
.
grad_color
=
color_mix
(
lmeter
.
body
.
grad_color
,
LV_COLOR_BLACK
,
LV_OPA_50
);
lmeter
.
body
.
main_color
=
lv_color_mix
(
lmeter
.
body
.
main_color
,
LV_COLOR_WHITE
,
LV_OPA_50
);
lmeter
.
body
.
grad_color
=
lv_color_mix
(
lmeter
.
body
.
grad_color
,
LV_COLOR_BLACK
,
LV_OPA_50
);
theme
.
lmeter
=
&
lmeter
;
#endif
...
...
@@ -188,9 +188,15 @@ static void lmeter_init(void)
static
void
gauge_init
(
void
)
{
#if USE_LV_GAUGE != 0
theme
.
gauge
=
&
lmeter
;
static
lv_style_t
gauge
;
lv_style_copy
(
&
gauge
,
&
lmeter
);
gauge
.
line
.
color
=
lmeter
.
body
.
grad_color
;
gauge
.
line
.
width
=
3
;
gauge
.
body
.
main_color
=
LV_COLOR_HEX3
(
0x888
);
gauge
.
body
.
grad_color
=
lmeter
.
body
.
main_color
;
gauge
.
text
.
color
=
LV_COLOR_HEX3
(
0x888
);
theme
.
gauge
=
&
gauge
;
#endif
}
...
...
@@ -286,9 +292,8 @@ static void list_init(void)
{
#if USE_LV_LIST != 0
theme
.
list
.
bg
=
&
lv_style_pretty
;
theme
.
list
.
scrl
=
&
lv_style_transp
;
theme
.
list
.
scrl
=
&
lv_style_transp
_fit
;
theme
.
list
.
sb
=
&
sb
;
theme
.
list
.
btn
.
rel
=
&
lv_style_btn_rel
;
theme
.
list
.
btn
.
pr
=
&
lv_style_btn_pr
;
...
...
lv_themes/lv_theme_material.c
View file @
b9b735ce
...
...
@@ -61,9 +61,10 @@ static void basic_init(void)
panel
.
body
.
main_color
=
LV_COLOR_WHITE
;
panel
.
body
.
grad_color
=
LV_COLOR_WHITE
;
panel
.
body
.
border
.
width
=
1
;
panel
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x
999
);
panel
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x
bbb
);
panel
.
body
.
border
.
opa
=
LV_OPA_COVER
;
panel
.
body
.
shadow
.
color
=
DEF_SHADOW_COLOR
;
panel
.
body
.
shadow
.
type
=
LV_SHADOW_BOTTOM
;
panel
.
body
.
shadow
.
width
=
4
;
panel
.
body
.
padding
.
hor
=
LV_DPI
/
8
;
panel
.
body
.
padding
.
ver
=
LV_DPI
/
8
;
...
...
@@ -95,7 +96,7 @@ static void btn_init(void)
static
lv_style_t
rel
,
pr
,
tgl_rel
,
tgl_pr
,
ina
;
lv_style_copy
(
&
rel
,
&
def
);
rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
rel
.
body
.
grad_color
=
rel
.
body
.
main_color
;
rel
.
body
.
radius
=
DEF_RADIUS
;
rel
.
body
.
padding
.
hor
=
LV_DPI
/
6
;
...
...
@@ -108,17 +109,17 @@ static void btn_init(void)
lv_style_copy
(
&
pr
,
&
rel
);
pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
65
);
pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
60
);
pr
.
body
.
grad_color
=
pr
.
body
.
main_color
;
pr
.
body
.
shadow
.
width
=
4
;
lv_style_copy
(
&
tgl_rel
,
&
rel
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
5
5
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
5
0
);
tgl_rel
.
body
.
grad_color
=
tgl_rel
.
body
.
main_color
;
tgl_rel
.
body
.
shadow
.
width
=
4
;
lv_style_copy
(
&
tgl_pr
,
&
tgl_rel
);
tgl_pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
4
5
);
tgl_pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
4
0
);
tgl_pr
.
body
.
grad_color
=
tgl_pr
.
body
.
main_color
;
tgl_pr
.
body
.
shadow
.
width
=
2
;
...
...
@@ -218,7 +219,7 @@ static void bar_init(void)
bar_bg
.
body
.
padding
.
ver
=
LV_DPI
/
12
;
lv_style_copy
(
&
bar_indic
,
&
bar_bg
);
bar_indic
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
7
5
);
bar_indic
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
7
0
);
bar_indic
.
body
.
grad_color
=
bar_indic
.
body
.
main_color
;
bar_indic
.
body
.
padding
.
hor
=
0
;
bar_indic
.
body
.
padding
.
ver
=
0
;
...
...
@@ -297,13 +298,14 @@ static void gauge_init(void)
static
lv_style_t
gauge
;
lv_style_copy
(
&
gauge
,
&
def
);
gauge
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
9
0
);
gauge
.
body
.
grad_color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
80
)
;
gauge
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
6
0
);
gauge
.
body
.
grad_color
=
gauge
.
body
.
main_color
;
gauge
.
body
.
padding
.
hor
=
LV_DPI
/
16
;
/*Scale line length*/
gauge
.
body
.
padding
.
inner
=
LV_DPI
/
8
;
gauge
.
body
.
border
.
color
=
LV_COLOR_HEX3
(
0x999
);
gauge
.
text
.
color
=
LV_COLOR_HEX3
(
0x333
);
gauge
.
line
.
width
=
3
;
gauge
.
line
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
95
,
70
);
theme
.
gauge
=
&
gauge
;
#endif
...
...
@@ -380,7 +382,7 @@ static void btnm_init(void)
pr
.
body
.
empty
=
0
;
lv_style_copy
(
&
tgl_rel
,
&
pr
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
tgl_rel
.
body
.
grad_color
=
tgl_rel
.
body
.
main_color
;
tgl_rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
5
,
95
);
...
...
@@ -425,13 +427,14 @@ static void mbox_init(void)
{
#if USE_LV_MBOX
static
lv_style_t
pr
,
rel
;
lv_style_copy
(
&
rel
,
&
lv_style_transp
);
rel
.
glass
=
0
;
rel
.
text
.
font
=
_font
;
rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
8
5
);
rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
7
5
);
lv_style_copy
(
&
pr
,
theme
.
btnm
.
btn
.
pr
);
pr
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
6
5
);
pr
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
85
,
6
0
);
theme
.
mbox
.
bg
=
theme
.
panel
;
theme
.
mbox
.
btn
.
bg
=
&
lv_style_transp
;
...
...
@@ -501,13 +504,13 @@ static void list_init(void)
pr
.
text
.
font
=
_font
;
lv_style_copy
(
&
tgl_rel
,
&
pr
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
tgl_rel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
tgl_rel
.
body
.
grad_color
=
tgl_rel
.
body
.
main_color
;
tgl_rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
5
,
95
);
lv_style_copy
(
&
tgl_pr
,
&
tgl_rel
);
tgl_pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
65
);
tgl_pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
60
);
tgl_pr
.
body
.
grad_color
=
tgl_pr
.
body
.
main_color
;
tgl_pr
.
body
.
border
.
width
=
0
;
...
...
@@ -538,7 +541,7 @@ static void ddlist_init(void)
lv_style_copy
(
&
sel
,
&
bg
);
sel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
sel
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
sel
.
body
.
grad_color
=
sel
.
body
.
main_color
;
sel
.
body
.
border
.
width
=
0
;
sel
.
body
.
shadow
.
width
=
0
;
...
...
@@ -564,7 +567,7 @@ static void roller_init(void)
roller_bg
.
glass
=
0
;
lv_style_copy
(
&
roller_sel
,
&
roller_bg
);
roller_sel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
roller_sel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
theme
.
roller
.
bg
=
&
roller_bg
;
...
...
@@ -578,7 +581,7 @@ static void tabview_init(void)
static
lv_style_t
indic
,
btn_bg
,
rel
,
pr
,
tgl_rel
,
tgl_pr
;
lv_style_copy
(
&
indic
,
&
def
);
indic
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
75
);
indic
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
indic
.
body
.
grad_color
=
indic
.
body
.
main_color
;
indic
.
body
.
radius
=
0
;
indic
.
body
.
border
.
width
=
0
;
...
...
@@ -620,7 +623,7 @@ static void tabview_init(void)
lv_style_copy
(
&
tgl_rel
,
&
lv_style_transp
);
tgl_rel
.
glass
=
0
;
tgl_rel
.
text
.
font
=
_font
;
tgl_rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
95
);
tgl_rel
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
70
);
lv_style_copy
(
&
tgl_pr
,
&
def
);
tgl_pr
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
15
,
85
);
...
...
@@ -628,7 +631,7 @@ static void tabview_init(void)
tgl_pr
.
body
.
border
.
width
=
0
;
tgl_pr
.
body
.
empty
=
0
;
tgl_pr
.
body
.
radius
=
0
;
tgl_pr
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
5
,
95
);
tgl_pr
.
text
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
9
0
,
60
);
theme
.
tabview
.
bg
=
theme
.
bg
;
theme
.
tabview
.
indic
=
&
indic
;
...
...
lv_themes/lv_theme_mono.c
View file @
b9b735ce
...
...
@@ -229,9 +229,13 @@ static void lmeter_init(void)
static
void
gauge_init
(
void
)
{
#if USE_LV_GAUGE != 0
static
lv_style_t
gauge_bg
;
lv_style_copy
(
&
gauge_bg
,
theme
.
lmeter
);
gauge_bg
.
line
.
color
=
LV_COLOR_BLACK
;
gauge_bg
.
line
.
width
=
3
;
theme
.
gauge
=
theme
.
lmeter
;
theme
.
gauge
=
&
gauge_bg
;
#endif
}
...
...
lv_themes/lv_theme_night.c
View file @
b9b735ce
...
...
@@ -266,9 +266,15 @@ static void lmeter_init(void)
static
void
gauge_init
(
void
)
{
#if USE_LV_GAUGE != 0
theme
.
gauge
=
&
lmeter_bg
;
static
lv_style_t
gauge_bg
;
lv_style_copy
(
&
gauge_bg
,
&
def
);
gauge_bg
.
body
.
main_color
=
lv_color_hsv_to_rgb
(
_hue
,
10
,
70
);
gauge_bg
.
body
.
grad_color
=
gauge_bg
.
body
.
main_color
;
gauge_bg
.
line
.
color
=
lv_color_hsv_to_rgb
(
_hue
,
80
,
75
);
gauge_bg
.
line
.
width
=
3
;
gauge_bg
.
text
.
color
=
LV_COLOR_HEX3
(
0xddd
);
theme
.
gauge
=
&
gauge_bg
;
#endif
}
...
...
@@ -335,7 +341,7 @@ static void btnm_init(void)
btnm_bg
.
body
.
padding
.
hor
=
2
;
btnm_bg
.
body
.
padding
.
ver
=
2
;
btnm_bg
.
body
.
padding
.
inner
=
0
;
btnm_bg
.
body
.
border
.
width
=
1
<<
LV_AA
;
//LV_BORDER_RIGHT
;
btnm_bg
.
body
.
border
.
width
=
1
;
lv_style_copy
(
&
rel
,
&
btn_rel
);
rel
.
body
.
border
.
part
=
LV_BORDER_RIGHT
;
...
...
lv_themes/lv_theme_templ.c
View file @
b9b735ce
...
...
@@ -45,6 +45,7 @@ static lv_font_t * _font;
static
void
basic_init
(
void
)
{
lv_style_copy
(
&
def
,
&
lv_style_pretty
);
/*Initialize the default style*/
def
.
text
.
font
=
_font
;
theme
.
bg
=
&
def
;
theme
.
panel
=
&
def
;
...
...
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