From 27b78c91216f397e9aed3c0dd87db2c54dca50fa Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Sun, 10 Dec 2017 17:03:55 +0100 Subject: Creation of component.h and move the content about Component to this header file --- include/gui/component.h | 45 ++++++++++++++++++++++++++++++++++++++ include/gui/group.h | 2 +- include/gui/window.h | 57 +++++++++++++++++++++++-------------------------- 3 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 include/gui/component.h (limited to 'include') diff --git a/include/gui/component.h b/include/gui/component.h new file mode 100644 index 0000000..d61b713 --- /dev/null +++ b/include/gui/component.h @@ -0,0 +1,45 @@ +#ifndef UPEM_C_COMPONENT_H +#define UPEM_C_COMPONENT_H + +/** + * File: component.h + * Windows and components handling. + * + * See also: + * The famous OS + */ + +#include "group.h" + +/** + * Type: ClickHandler + * Type of functions that handle mouse's clicks. + */ +typedef void (*ClickHandler)(int x_pos, int y_pos); + +/** + * Type: PrintMethod + * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. + */ +typedef void (*PrintMethod)(void); + +/** + * 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; + int x_pos, y_pos; + ClickHandler click_handler; + PrintMethod print_method; +} Component; + +#endif //UPEM_C_COMPONENT_H diff --git a/include/gui/group.h b/include/gui/group.h index bd46852..b766ded 100644 --- a/include/gui/group.h +++ b/include/gui/group.h @@ -5,7 +5,7 @@ * File: group.h * Group of components */ -#include "window.h" +#include "component.h" /** * Struct: _GroupElement diff --git a/include/gui/window.h b/include/gui/window.h index a20456d..3212a49 100644 --- a/include/gui/window.h +++ b/include/gui/window.h @@ -10,37 +10,8 @@ */ #include "group.h" +#include "component.h" -/** - * Type: ClickHandler - * Type of functions that handle mouse's clicks. - */ -typedef void (*ClickHandler)(int x_pos, int y_pos); - -/** - * Type: PrintMethod - * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. - */ -typedef void (*PrintMethod)(void); - -/** - * 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; - int x_pos, y_pos; - ClickHandler click_handler; - PrintMethod print_method; -} Component; /** * Struct: Window * Supports and handles components. @@ -100,5 +71,31 @@ void window_add_button(Window *window, Component *component); */ void window_add_pictureframe(Window *window, Component *component); +/** + * Function: window_create + * Initializes the resources to create a window. + * + * Parameters: + * *window - pointer to the input window + */ +void window_create(Window *window); + +/** + * Function: window_print_buttons + * Prints all the buttons to the screen + * + * Parameters: + * *window - pointer to the input window + */ +void window_print_buttons(Window *window); + +/** + * Function: window_print_pictureframes + * Prints all the picture frames to the screen + * + * Parameters: + * *window - pointer to the input window + */ +void window_print_pictureframes(Window *window); #endif -- cgit v1.2.3