--- a/application/main.c Sat Oct 10 15:29:31 2015 +0200 +++ b/application/main.c Sun Nov 29 17:22:15 2015 +0100 @@ -44,6 +44,22 @@ fflush(stdout); } +void draw(UiEvent *event, UiGraphics *g, void *data) { + int width = g->width; + int height = g->height; + ui_graphics_color(g, 64, 64, 64); + ui_draw_rect(g, 0, 0, width, height, TRUE); + + UiTextLayout *text = ui_text(g); + ui_text_setfont(text, "Monospace", 12); + ui_text_setstring(text, "Hello World"); + + ui_graphics_color(g, 255, 255, 255); + ui_draw_text(g, 50, 50, text); + + ui_text_free(text); +} + int main(int argc, char** argv) { ui_init("app1", argc, argv); @@ -63,48 +79,7 @@ ui_toolbar_add_default("button2"); UiObject *obj = ui_window("Test", NULL); - - ui_layout_fill(obj, FALSE); - ui_grid_sp(obj, 10, 2); - - ui_rlabel(obj, "Name"); - ui_textfield(obj, NULL); - ui_newline(obj); - - ui_rlabel(obj, "Email"); - ui_textfield(obj, NULL); - ui_button(obj, "OK", NULL, NULL); - ui_newline(obj); - - ui_checkbox(obj, "fuck", NULL); - ui_rlabel(obj, "FUCK"); - ui_newline(obj); - ui_checkbox(obj, "this", NULL); - ui_newline(obj); - ui_checkbox(obj, "shit", NULL); - ui_newline(obj); - - ui_label(obj, "Awesome Button"); - UIWIDGET button = ui_button(obj, "...", NULL, NULL); - - ui_end(obj); - - ui_checkbox(obj, "A", NULL); - ui_checkbox(obj, "B", NULL); - ui_checkbox(obj, "C", NULL); - ui_checkbox(obj, "D", NULL); - ui_checkbox(obj, "E", NULL); - ui_checkbox(obj, "F", NULL); - ui_space(obj); - - ui_separator(obj); - - ui_layout_fill(obj, FALSE); - ui_hbox(obj); - ui_button(obj, "Submit", NULL, NULL); - //ui_space(obj); - ui_button(obj, "Cancel", NULL, NULL); - ui_end(obj); + ui_drawingarea(obj, draw, NULL); ui_show(obj); ui_main();