application/main.c

changeset 101
1c943d43fa81
parent 99
ea1a2d5de765
child 102
2988f00ed9d6
equal deleted inserted replaced
100:d276306d801f 101:1c943d43fa81
41 41
42 void action_button(UiEvent *event, void *data) { 42 void action_button(UiEvent *event, void *data) {
43 printf("button clicked\n"); 43 printf("button clicked\n");
44 fflush(stdout); 44 fflush(stdout);
45 } 45 }
46 46 /*
47 void draw(UiEvent *event, UiGraphics *g, void *data) { 47 void draw(UiEvent *event, UiGraphics *g, void *data) {
48 int width = g->width; 48 int width = g->width;
49 int height = g->height; 49 int height = g->height;
50 //printf("rec[%d,%d]\n", width, height); 50 //printf("rec[%d,%d]\n", width, height);
51 ui_graphics_color(g, 64, 64, 64); 51 ui_graphics_color(g, 64, 64, 64);
61 ui_graphics_color(g, 255, 255, 255); 61 ui_graphics_color(g, 255, 255, 255);
62 ui_draw_text(g, 50, 50, text); 62 ui_draw_text(g, 50, 50, text);
63 63
64 ui_text_free(text); 64 ui_text_free(text);
65 } 65 }
66 */
66 67
67 void click(UiEvent *event, void *data) { 68 void click(UiEvent *event, void *data) {
68 UiMouseEvent *me = event->eventdata; 69 UiMouseEvent *me = event->eventdata;
69 printf("click[%d](%d,%d)\n", me->type, me->x, me->y); 70 printf("click[%d](%d,%d)\n", me->type, me->x, me->y);
70 } 71 }
90 UiObject *obj = ui_window("Test", NULL); 91 UiObject *obj = ui_window("Test", NULL);
91 //UIWIDGET w = ui_drawingarea(obj, draw, NULL); 92 //UIWIDGET w = ui_drawingarea(obj, draw, NULL);
92 //ui_mouse_handler(obj, w, click, NULL); 93 //ui_mouse_handler(obj, w, click, NULL);
93 94
94 ui_grid_sp(obj, 40, 4, 4); 95 ui_grid_sp(obj, 40, 4, 4);
96
95 ui_button(obj, "OK", NULL, NULL); 97 ui_button(obj, "OK", NULL, NULL);
96 ui_button(obj, "Google", NULL, NULL); 98 ui_button(obj, "Google", NULL, NULL);
97 ui_textfield(obj, NULL); 99 ui_textfield(obj, NULL);
98 ui_newline(obj); 100 ui_newline(obj);
99 101
100 ui_button(obj, "OK", NULL, NULL); 102 ui_button(obj, "OK", NULL, NULL);
101 ui_space(obj);
102 ui_textfield(obj, NULL);
103 ui_newline(obj); 103 ui_newline(obj);
104 104
105 ui_vbox(obj); 105 ui_vbox(obj);
106 ui_button(obj, "txt", NULL, NULL); 106 ui_button(obj, "txt", NULL, NULL);
107 ui_textfield(obj, NULL);
108 ui_space(obj);
107 ui_end(obj); 109 ui_end(obj);
108 ui_layout_hexpand(obj, TRUE); 110 ui_layout_hexpand(obj, TRUE);
109 ui_layout_vexpand(obj, TRUE); 111 ui_layout_vexpand(obj, TRUE);
110 ui_textarea(obj, NULL); 112 ui_textarea(obj, NULL);
113 ui_button(obj, "BTN1", NULL, NULL);
111 114
112 ui_end(obj); 115 ui_end(obj);
113 116
114 ui_show(obj); 117 ui_show(obj);
115 ui_main(); 118 ui_main();

mercurial