diff options
author | Marvin Borner | 2021-06-28 16:37:30 +0200 |
---|---|---|
committer | Marvin Borner | 2021-06-28 16:37:30 +0200 |
commit | 5a4eea5c6b39d221fe4828cb279c68c60bad8fae (patch) | |
tree | 64b91481a4257980785b3a57684b5580e5d81f80 /apps/paint | |
parent | 461e6fcb6a0abbf594ea08d6828b841ea6dc964e (diff) |
Implemented basic layout rendering
Diffstat (limited to 'apps/paint')
-rw-r--r-- | apps/paint/main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/paint/main.c b/apps/paint/main.c index 626d41d..0f0dd8c 100644 --- a/apps/paint/main.c +++ b/apps/paint/main.c @@ -20,7 +20,7 @@ static void mousemove(struct gui_event_mouse *event) if (event->but.left) { gui_draw_line(event->win, event->widget, GUI_LAYER_FG, last, event->pos, size, current_color); - gui_redraw_widget(event->win, event->widget); + gui_widget_redraw(event->win, event->widget); } last = event->pos; } @@ -37,27 +37,27 @@ int main(void) u32 win = gui_window(APPNAME); vec2 win_size = gui_window_size(win); - u32 toolbar = gui_widget(win, gui_main_widget(win), vec2(0, 0), + gui_widget_margin(win, gui_widget_main(win), vec2(0, 0)); + gui_widget_layout(win, gui_widget_main(win), GUI_VLAYOUT); + + u32 toolbar = gui_widget(win, gui_widget_main(win), vec2(win_size.x, COLOR_SIZE + 2 * TOOLBAR_MARGIN)); gui_fill(win, toolbar, GUI_LAYER_BG, COLOR_WHITE); u32 color_count = COUNT(colors); for (u32 i = 0; i < color_count; i++) { - u32 color = gui_widget(win, toolbar, - vec2(TOOLBAR_MARGIN + i * (COLOR_SIZE + TOOLBAR_MARGIN), - TOOLBAR_MARGIN), - vec2(COLOR_SIZE, COLOR_SIZE)); + u32 color = gui_widget(win, toolbar, vec2(COLOR_SIZE, COLOR_SIZE)); gui_fill(win, color, GUI_LAYER_FG, colors[i]); gui_draw_border(win, color, GUI_LAYER_FG, 2, COLOR_BLACK); gui_widget_listen(win, color, GUI_LISTEN_MOUSECLICK, (u32)color_click); } - u32 canvas = gui_widget(win, gui_main_widget(win), vec2(0, COLOR_SIZE + 2 * TOOLBAR_MARGIN), + u32 canvas = gui_widget(win, gui_widget_main(win), vec2(win_size.x, win_size.y - (COLOR_SIZE + 2 * TOOLBAR_MARGIN))); gui_fill(win, canvas, GUI_LAYER_BG, COLOR_WHITE); gui_widget_listen(win, canvas, GUI_LISTEN_MOUSEMOVE, (u32)mousemove); - gui_redraw_window(win); + gui_window_redraw(win); gui_loop(); return 0; } |