From 2aed52d89856847ea394b06d7b70782fa6b21d24 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Sun, 10 Dec 2017 13:01:42 +0100 Subject: Implementing init, free, add_button, add_pictureframe functions for window --- src/gui/window.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/gui/window.c') diff --git a/src/gui/window.c b/src/gui/window.c index 2b4c7e0..bd96050 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -1,13 +1,30 @@ -#include "gui/window.h" +#include +#include +#include +#include "string.h" +#include "assert.h" void window_init(Window *window, int width, int height, char *title) { -//TODO + window = malloc_or_die(sizeof(window)); + assert(width > 0); + assert(height > 0); + window->width = width; + window->height = height; + assert(title != NULL); + strcpy(window->title,title); + window->group_buttons = malloc_or_die(sizeof(Group)); + window->group_pictureframe = malloc_or_die(sizeof(Group)); } void window_free(Window *window) { -//TODO + group_free(window->group_buttons); + group_free(window->group_pictureframe); } -void window_add_component(Window *window, Component *component) { -//TODO +void window_add_button(Window *window, Component *component){ + group_add_component(window->group_buttons,component); } + +void window_add_pictureframe(Window *window, Component *component){ + group_add_component(window->group_pictureframe,component); +} \ No newline at end of file -- cgit v1.2.3