From 6e91c1be2b0abddb6cfe16152b35cd0559b83c4a Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Sun, 10 Dec 2017 13:00:32 +0100 Subject: Updating documentation and reworking the structure of the Window --- include/gui/window.h | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/gui/window.h b/include/gui/window.h index 6ccf00a..a20456d 100644 --- a/include/gui/window.h +++ b/include/gui/window.h @@ -24,8 +24,16 @@ typedef void (*ClickHandler)(int x_pos, int y_pos); typedef void (*PrintMethod)(void); /** - * Type: Component - * Abstract component that handles clicks. + * Struct: Component + * Represents an abstract module handling clicks and a way to be print on the screen. + * + * Fields: + * width - width of the component + * height - height of the component + * x_pos - position on the x axis from the origin meant to be placed in top left + * y_pos - position on the y axis from the origin meant to be placed in top left + * click_handler - pointer of function that is called on mouse click + * print_method - pointer of function that handle the component's print */ typedef struct { int width, height; @@ -34,13 +42,21 @@ typedef struct { PrintMethod print_method; } Component; /** - * Type: Window + * Struct: Window * Supports and handles components. + * + * Fields: + * width - width of the window + * height - height of the window + * *title - string printed as name for the window + * *group_buttons - group that handles the buttons added to the window + * *group_pictureframe - group that handles the picture frames added to the window */ typedef struct { int width, height; + char *title; Group *group_buttons; - Group *group_images; + Group *group_pictureframe; } Window; /** @@ -65,14 +81,24 @@ void window_init(Window *window, int width, int height, char *title); void window_free(Window *window); /** - * Function: window_add_component - * Adds components to the current window at the position specified in x and y. + * Function: window_add_button + * Adds Button component to the group of buttons of the current window. + * + * Parameters: + * *window - pointer to the input window + * *component - pointer to the input component + */ +void window_add_button(Window *window, Component *component); + +/** + * Function: window_add_pictureframe + * Adds PictureFrame component to the group of picture frames of the current window. * * Parameters: * *window - pointer to the input window * *component - pointer to the input component */ -void window_add_component(Window *window, Component *component); +void window_add_pictureframe(Window *window, Component *component); #endif -- cgit v1.2.3