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