application/main.c

changeset 127
ce342364fad5
parent 126
f190d03dce0f
child 133
6dd780cbc8c6
equal deleted inserted replaced
126:f190d03dce0f 127:ce342364fad5
61 void action_scroll(UiEvent *event, void *data) { 61 void action_scroll(UiEvent *event, void *data) {
62 //ui_drawingarea_redraw(drawingarea); 62 //ui_drawingarea_redraw(drawingarea);
63 printf("scroll\n"); 63 printf("scroll\n");
64 } 64 }
65 65
66 /* 66
67 void draw(UiEvent *event, UiGraphics *g, void *data) { 67 void draw(UiEvent *event, UiGraphics *g, void *data) {
68 double adjust = range.get(&range);
69
70 ///*
71 int width = g->width; 68 int width = g->width;
72 int height = g->height; 69 int height = g->height;
73 //printf("rec[%d,%d]\n", width, height); 70 //printf("rec[%d,%d]\n", width, height);
74 71
75 ui_graphics_color(g, 64, 64, 64); 72 ui_graphics_color(g, 64, 64, 64);
76 ui_draw_rect(g, 0, 0, width, height, TRUE); 73 ui_draw_rect(g, 0, 0, width, height, TRUE);
77 74
78 if(!text) {
79 text = ui_text(g);
80 ui_text_setfont(text, "Monospace", 12);
81 ui_text_setstring(text, "Hello World");
82 }
83 int w, h;
84 ui_text_getsize(text, &w, &h);
85 //printf("ext[%d,%d]\n", w, h);
86 75
87 ui_graphics_color(g, 255, 255, 255);
88 ui_draw_text(g, 50, 50 + adjust, text);
89 ui_draw_line(g, 50, 55 + h, 50+w, 55 +h);
90 ui_draw_line(g, 50, 55 + h, 50, 75 +h);
91
92 ui_draw_line(g, 0, 120, width, 120);
93 ui_draw_line(g, 200, 0, 200, height);
94
95 ui_draw_rect(g, 250, 250, 50, 50, FALSE);
96
97 //ui_text_free(text);
98 //*/
99 /*
100 } 76 }
77 /*
101 78
102 void* model_getval(void *obj, int col) { 79 void* model_getval(void *obj, int col) {
103 if(col == 0) { 80 if(col == 0) {
104 return "folder"; 81 return "folder";
105 } else if(col == 2) { 82 } else if(col == 2) {
149 ui_toolbar_add_default("button2"); 126 ui_toolbar_add_default("button2");
150 //ui_toolbar_add_default("combo"); 127 //ui_toolbar_add_default("combo");
151 128
152 UiObject *obj = ui_window("Test", NULL); 129 UiObject *obj = ui_window("Test", NULL);
153 //ui_context_closefunc(obj->ctx, window_close, NULL); 130 //ui_context_closefunc(obj->ctx, window_close, NULL);
154 131 ui_drawingarea(obj, draw, NULL);
155 132
156 ui_show(obj); 133 ui_show(obj);
157 ui_main(); 134 ui_main();
158 135
159 return (EXIT_SUCCESS); 136 return (EXIT_SUCCESS);

mercurial