acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_tileview_1.c (1502B)
1 #include "../../lv_examples.h" 2 #if LV_USE_TILEVIEW && LV_BUILD_EXAMPLES 3 4 /** 5 * Create a 2x2 tile view and allow scrolling only in an "L" shape. 6 * Demonstrate scroll chaining with a long list that 7 * scrolls the tile view when it can't be scrolled further. 8 */ 9 void lv_example_tileview_1(void) 10 { 11 lv_obj_t * tv = lv_tileview_create(lv_scr_act()); 12 13 /*Tile1: just a label*/ 14 lv_obj_t * tile1 = lv_tileview_add_tile(tv, 0, 0, LV_DIR_BOTTOM); 15 lv_obj_t * label = lv_label_create(tile1); 16 lv_label_set_text(label, "Scroll down"); 17 lv_obj_center(label); 18 19 20 /*Tile2: a button*/ 21 lv_obj_t * tile2 = lv_tileview_add_tile(tv, 0, 1, LV_DIR_TOP | LV_DIR_RIGHT); 22 23 lv_obj_t * btn = lv_btn_create(tile2); 24 25 label = lv_label_create(btn); 26 lv_label_set_text(label, "Scroll up or right"); 27 28 lv_obj_set_size(btn, LV_SIZE_CONTENT, LV_SIZE_CONTENT); 29 lv_obj_center(btn); 30 31 /*Tile3: a list*/ 32 lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT); 33 lv_obj_t * list = lv_list_create(tile3); 34 lv_obj_set_size(list, LV_PCT(100), LV_PCT(100)); 35 36 lv_list_add_btn(list, NULL, "One"); 37 lv_list_add_btn(list, NULL, "Two"); 38 lv_list_add_btn(list, NULL, "Three"); 39 lv_list_add_btn(list, NULL, "Four"); 40 lv_list_add_btn(list, NULL, "Five"); 41 lv_list_add_btn(list, NULL, "Six"); 42 lv_list_add_btn(list, NULL, "Seven"); 43 lv_list_add_btn(list, NULL, "Eight"); 44 lv_list_add_btn(list, NULL, "Nine"); 45 lv_list_add_btn(list, NULL, "Ten"); 46 47 } 48 49 #endif