diff -r 500c085d2133 -r 909fe96e5659 application/main.c --- a/application/main.c Sun Jan 24 19:57:16 2016 +0100 +++ b/application/main.c Sun Jan 24 22:20:47 2016 +0100 @@ -54,18 +54,22 @@ ui_setval(radio, 1); } +UiTextLayout *text; + void draw(UiEvent *event, UiGraphics *g, void *data) { - /* + ///* int width = g->width; int height = g->height; - printf("rec[%d,%d]\n", width, height); + //printf("rec[%d,%d]\n", width, 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"); + if(!text) { + text = ui_text(g); + ui_text_setfont(text, "Monospace", 12); + ui_text_setstring(text, "Hello World"); + } int w, h; ui_text_getsize(text, &w, &h); //printf("ext[%d,%d]\n", w, h); @@ -73,8 +77,11 @@ ui_graphics_color(g, 255, 255, 255); ui_draw_text(g, 50, 50, text); - ui_text_free(text); - */ + ui_draw_line(g, 0, 120, width, 120); + ui_draw_line(g, 200, 0, 200, height); + + //ui_text_free(text); + //*/ } void click(UiEvent *event, void *data) { @@ -104,12 +111,12 @@ ui_toolbar_add_default("button1"); ui_toolbar_add_default("button2"); - UiObject *obj = ui_simplewindow("Test", NULL); + UiObject *obj = ui_window("Test", NULL); ui_context_closefunc(obj->ctx, window_close, NULL); - //UIWIDGET w = ui_drawingarea(obj, draw, NULL); + UIWIDGET w = ui_drawingarea(obj, draw, NULL); //ui_mouse_handler(obj, w, click, NULL); -///* +/* ui_vbox_sp(obj, 8, 4); ui_button(obj, "Button", NULL, NULL); ui_button(obj, "Button", NULL, NULL);