mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge branch 'dev-6.0' of https://github.com/littlevgl/lvgl into dev-6.0
This commit is contained in:
commit
205c791e00
17
README.md
17
README.md
@ -35,6 +35,7 @@ LittlevGL provides everything you need to create a Graphical User Interface (GUI
|
||||
* **OS, External memory and GPU** supported but not required
|
||||
* **Single frame buffer** operation even with advances graphical effects
|
||||
* **Written in C** for maximal compatibility
|
||||
* **Micropython Binding** exposes [LittlevGL API in Micropython](https://blog.littlevgl.com/2019-02-20/micropython-bindings)
|
||||
* **Simulator** to develop on PC without embedded hardware
|
||||
* **Tutorials, examples, themes** for rapid development
|
||||
* **Documentation** and API references online
|
||||
@ -186,6 +187,22 @@ lv_btn_set_ink_out_time(btn, 300);
|
||||
|
||||
![Simple button with LittelvGL](https://littlevgl.com/github/btn3.gif)
|
||||
|
||||
#### Use LittlevGL from Micropython
|
||||
```python
|
||||
|
||||
# Create a Button and a Label
|
||||
|
||||
scr = lv.obj()
|
||||
btn = lv.btn(scr)
|
||||
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
|
||||
label = lv.label(btn)
|
||||
label.set_text("Button")
|
||||
|
||||
# Load the screen
|
||||
|
||||
lv.scr_load(scr)
|
||||
```
|
||||
|
||||
Check out the [Documentation](https://docs.littlevgl.com/) for more!
|
||||
|
||||
### Contributing
|
||||
|
@ -81,7 +81,7 @@ static inline lv_obj_t * lv_scr_act(void)
|
||||
* Get the top layer of the default display
|
||||
* @return pointer to the top layer
|
||||
*/
|
||||
static inline lv_obj_t * lv_top_layer(void)
|
||||
static inline lv_obj_t * lv_layer_top(void)
|
||||
{
|
||||
return lv_disp_get_layer_top(lv_disp_get_default());
|
||||
}
|
||||
@ -90,11 +90,17 @@ static inline lv_obj_t * lv_top_layer(void)
|
||||
* Get the active screen of the deafult display
|
||||
* @return pointer to the sys layer
|
||||
*/
|
||||
static inline lv_obj_t * lv_sys_layer(void)
|
||||
static inline lv_obj_t * lv_layer_sys(void)
|
||||
{
|
||||
return lv_disp_get_layer_sys(lv_disp_get_default());
|
||||
}
|
||||
|
||||
static inline void lv_scr_load(lv_obj_t * scr)
|
||||
{
|
||||
lv_disp_set_scr_act(scr);
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -104,8 +110,8 @@ static inline lv_obj_t * lv_sys_layer(void)
|
||||
* Recommended only if you have one display
|
||||
*------------------------------------------------*/
|
||||
|
||||
#define LV_HOR_RES (lv_disp_get_hor_res(lv_disp_get_default());)
|
||||
#define LV_VER_RES (lv_disp_get_ver_res(lv_disp_get_default());)
|
||||
#define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default())
|
||||
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -50,7 +50,7 @@ typedef struct
|
||||
void * buf_act;
|
||||
uint32_t size; /*In pixel count*/
|
||||
lv_area_t area;
|
||||
uint32_t flushing :1;
|
||||
volatile uint32_t flushing :1;
|
||||
}lv_disp_buf_t;
|
||||
|
||||
|
||||
|
@ -1208,6 +1208,21 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
lv_coord_t font_h = lv_font_get_height(style_label->text.font);
|
||||
scrl->ext_size = LV_MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
/*Set the label width according to the text area width*/
|
||||
if(ext->label) {
|
||||
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
|
||||
lv_obj_get_height(ta) != lv_area_get_height(param)) {
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ta);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
|
||||
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
|
||||
|
||||
refr_cursor_area(ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSED) {
|
||||
update_cursor_position_on_click(ta, (lv_indev_t *)param);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user