Changeset fa01c05 in mainline for uspace/app/uidemo/uidemo.c
- Timestamp:
- 2020-11-03T18:46:35Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b71c0fc
- Parents:
- 4ac11ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
r4ac11ff rfa01c05 33 33 */ 34 34 35 #include <gfx/color.h>36 35 #include <gfx/coord.h> 37 #include <gfx/render.h>38 36 #include <io/pos_event.h> 39 37 #include <stdio.h> … … 50 48 51 49 static void wnd_close(ui_window_t *, void *); 50 static errno_t wnd_paint(ui_window_t *, void *); 52 51 static void wnd_pos(ui_window_t *, void *, pos_event_t *pos); 53 52 54 53 static ui_window_cb_t window_cb = { 55 54 .close = wnd_close, 55 .paint = wnd_paint, 56 56 .pos = wnd_pos 57 57 }; … … 73 73 74 74 ui_quit(demo->ui); 75 } 76 77 /** Window paint request. 78 * 79 * @param window Window 80 * @param arg Argument (demo) 81 * @return EOK on success or an error code 82 */ 83 static errno_t wnd_paint(ui_window_t *window, void *arg) 84 { 85 ui_demo_t *demo = (ui_demo_t *) arg; 86 errno_t rc; 87 88 /* Let window paint its background */ 89 rc = ui_window_def_paint(window); 90 if (rc != EOK) 91 return rc; 92 93 return ui_fixed_paint(demo->fixed); 75 94 } 76 95 … … 122 141 ui_demo_t demo; 123 142 gfx_rect_t rect; 124 gfx_rect_t app_rect;125 gfx_color_t *color;126 143 ui_resource_t *ui_res; 127 gfx_context_t *gc;128 144 errno_t rc; 129 145 … … 156 172 157 173 ui_res = ui_window_get_res(window); 158 gc = ui_window_get_gc(window);159 ui_window_get_app_rect(window, &app_rect);160 174 161 175 rc = ui_fixed_create(&demo.fixed); … … 226 240 } 227 241 228 rc = gfx_color_new_rgb_i16(0xc8c8, 0xc8c8, 0xc8c8, &color); 229 if (rc != EOK) { 230 printf("Error allocating color.\n"); 231 return rc; 232 } 233 234 rc = gfx_set_color(gc, color); 235 if (rc != EOK) { 236 printf("Error setting color.\n"); 237 return rc; 238 } 239 240 rc = gfx_fill_rect(gc, &app_rect); 241 if (rc != EOK) { 242 printf("Error filling background.\n"); 243 return rc; 244 } 245 246 rc = ui_fixed_paint(demo.fixed); 247 if (rc != EOK) { 248 printf("Error painting UI controls.\n"); 242 rc = ui_window_paint(window); 243 if (rc != EOK) { 244 printf("Error painting window.\n"); 249 245 return rc; 250 246 }
Note:
See TracChangeset
for help on using the changeset viewer.