add lv_components as src/extra and minor fixes

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-04 14:46:11 +01:00
parent 5c5327f31a
commit 8a1af8646f
260 changed files with 14082 additions and 3728 deletions

View File

@@ -0,0 +1,35 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_BTN
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
else if(event == LV_EVENT_VALUE_CHANGED) {
printf("Toggled\n");
}
}
void lv_ex_btn_1(void)
{
lv_obj_t * label;
lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);
lv_obj_add_event_cb(btn1, event_handler, NULL);
lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40);
label = lv_label_create(btn1, NULL);
lv_label_set_text(label, "Button");
lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL);
lv_obj_add_event_cb(btn2, event_handler, NULL);
lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
lv_obj_add_flag(btn2, LV_OBJ_FLAG_CHECKABLE);
lv_obj_set_height(btn2, LV_SIZE_AUTO);
label = lv_label_create(btn2, NULL);
lv_label_set_text(label, "Toggle");
}
#endif