application/main.c

changeset 104
3efe0210e27e
parent 103
6a6718269c22
child 106
a4f4123ca12a
equal deleted inserted replaced
103:6a6718269c22 104:3efe0210e27e
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 48 /*
49 int width = g->width; 49 int width = g->width;
50 int height = g->height; 50 int height = g->height;
51 printf("rec[%d,%d]\n", width, height); 51 printf("rec[%d,%d]\n", width, height);
52 52
53 ui_graphics_color(g, 64, 64, 64); 53 ui_graphics_color(g, 64, 64, 64);
62 62
63 ui_graphics_color(g, 255, 255, 255); 63 ui_graphics_color(g, 255, 255, 255);
64 ui_draw_text(g, 50, 50, text); 64 ui_draw_text(g, 50, 50, text);
65 65
66 ui_text_free(text); 66 ui_text_free(text);
67 */
67 } 68 }
68 69
69 void click(UiEvent *event, void *data) { 70 void click(UiEvent *event, void *data) {
70 UiMouseEvent *me = event->eventdata; 71 UiMouseEvent *me = event->eventdata;
71 printf("click[%d](%d,%d)\n", me->type, me->x, me->y); 72 printf("click[%d](%d,%d)\n", me->type, me->x, me->y);
88 ui_toolitem("button2", "OK", action_button, NULL); 89 ui_toolitem("button2", "OK", action_button, NULL);
89 ui_toolbar_add_default("button1"); 90 ui_toolbar_add_default("button1");
90 ui_toolbar_add_default("button2"); 91 ui_toolbar_add_default("button2");
91 92
92 UiObject *obj = ui_window("Test", NULL); 93 UiObject *obj = ui_window("Test", NULL);
93 UIWIDGET w = ui_drawingarea(obj, draw, NULL); 94 //UIWIDGET w = ui_drawingarea(obj, draw, NULL);
94 //ui_mouse_handler(obj, w, click, NULL); 95 //ui_mouse_handler(obj, w, click, NULL);
95 96
96 /* 97 ///*
97 ui_grid_sp(obj, 8, 4, 4); 98 ui_grid_sp(obj, 8, 4, 4);
98 99
99 ui_button(obj, "OK", NULL, NULL); 100 ui_button(obj, "OK", NULL, NULL);
101 ui_layout_hexpand(obj, TRUE);
100 ui_button(obj, "Google", NULL, NULL); 102 ui_button(obj, "Google", NULL, NULL);
101 ui_textfield(obj, NULL); 103 ui_textfield(obj, NULL);
102 ui_newline(obj);
103
104 ui_button(obj, "OK", NULL, NULL);
105 ui_newline(obj); 104 ui_newline(obj);
106 105
107 ui_vbox(obj); 106 ui_vbox(obj);
108 ui_button(obj, "txt", NULL, NULL); 107 ui_button(obj, "txt", NULL, NULL);
109 ui_textfield(obj, NULL); 108 ui_textfield(obj, NULL);
110 ui_space(obj);
111 ui_end(obj); 109 ui_end(obj);
112 ui_layout_hexpand(obj, TRUE); 110 ui_layout_hexpand(obj, TRUE);
113 ui_layout_vexpand(obj, TRUE); 111 ui_layout_vexpand(obj, TRUE);
114 ui_textarea(obj, NULL); 112 ui_textarea(obj, NULL);
115 ui_button(obj, "BTN1", NULL, NULL); 113 ui_button(obj, "BTN1", NULL, NULL);
116 114
117 ui_end(obj); 115 ui_end(obj);
118 */ 116 //*/
119 117
120 ui_show(obj); 118 ui_show(obj);
121 ui_main(); 119 ui_main();
122 120
123 return (EXIT_SUCCESS); 121 return (EXIT_SUCCESS);

mercurial