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_win_1.c (1330B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_WIN && LV_BUILD_EXAMPLES
      3 
      4 
      5 static void event_handler(lv_event_t * e)
      6 {
      7     lv_obj_t * obj = lv_event_get_target(e);
      8     LV_LOG_USER("Button %d clicked", (int)lv_obj_get_index(obj));
      9 }
     10 
     11 void lv_example_win_1(void)
     12 {
     13     lv_obj_t * win = lv_win_create(lv_scr_act(), 40);
     14     lv_obj_t * btn;
     15     btn = lv_win_add_btn(win, LV_SYMBOL_LEFT, 40);
     16     lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
     17 
     18     lv_win_add_title(win, "A title");
     19 
     20     btn = lv_win_add_btn(win, LV_SYMBOL_RIGHT, 40);
     21     lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
     22 
     23     btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE, 60);
     24     lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
     25 
     26     lv_obj_t * cont = lv_win_get_content(win);  /*Content can be added here*/
     27     lv_obj_t * label = lv_label_create(cont);
     28     lv_label_set_text(label, "This is\n"
     29                       "a pretty\n"
     30                       "long text\n"
     31                       "to see how\n"
     32                       "the window\n"
     33                       "becomes\n"
     34                       "scrollable.\n"
     35                       "\n"
     36                       "\n"
     37                       "Some more\n"
     38                       "text to be\n"
     39                       "sure it\n"
     40                       "overflows. :)");
     41 
     42 
     43 }
     44 
     45 #endif