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 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 include/gui/component.h (limited to 'include/gui/component.h') 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 -- cgit v1.2.3 From 00a6e1d29ad8dae2d769810b9af65c3934788487 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Tue, 12 Dec 2017 13:08:47 +0100 Subject: Reworking on the signature of PrintMethod --- include/gui/component.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/gui/component.h') diff --git a/include/gui/component.h b/include/gui/component.h index d61b713..50aee63 100644 --- a/include/gui/component.h +++ b/include/gui/component.h @@ -21,7 +21,7 @@ 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); +typedef void (*PrintMethod)(void*); /** * Struct: Component -- cgit v1.2.3 From 1a4d7b44eaefd7831860b2ffdf178b00af3e1c7e Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Fri, 22 Dec 2017 18:56:31 +0100 Subject: Modifying signature of ClickHandler pointer of function, PrintMethod pointer of function, adding a boolean to lock a component --- include/gui/component.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/gui/component.h') diff --git a/include/gui/component.h b/include/gui/component.h index 50aee63..dd101dc 100644 --- a/include/gui/component.h +++ b/include/gui/component.h @@ -1,6 +1,7 @@ #ifndef UPEM_C_COMPONENT_H #define UPEM_C_COMPONENT_H +#include /** * File: component.h * Windows and components handling. @@ -8,20 +9,19 @@ * See also: * The famous OS */ - -#include "group.h" +struct Component; /** * Type: ClickHandler * Type of functions that handle mouse's clicks. */ -typedef void (*ClickHandler)(int x_pos, int y_pos); +typedef void (*ClickHandler)(int x_pos, int y_pos, struct Component *parameter); /** * 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*); +typedef void (*PrintMethod)(struct Component *); /** * Struct: Component @@ -35,9 +35,10 @@ typedef void (*PrintMethod)(void*); * click_handler - pointer of function that is called on mouse click * print_method - pointer of function that handle the component's print */ -typedef struct { +typedef struct Component { int width, height; int x_pos, y_pos; + bool activated; ClickHandler click_handler; PrintMethod print_method; } Component; -- cgit v1.2.3 From 9ed3c28a0335137d34e51d5fd49be6e523f65a89 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Thu, 28 Dec 2017 22:52:28 +0100 Subject: Implementing the add constraint feature, need to be fixed --- include/gui/component.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/gui/component.h') diff --git a/include/gui/component.h b/include/gui/component.h index dd101dc..0e8f437 100644 --- a/include/gui/component.h +++ b/include/gui/component.h @@ -1,7 +1,10 @@ #ifndef UPEM_C_COMPONENT_H #define UPEM_C_COMPONENT_H +typedef enum { + WAITING_BUTTON, INSERT_ORIGIN, INSERT_TARGET,PRINTING +} Mode; -#include +extern Mode mode; /** * File: component.h * Windows and components handling. @@ -38,7 +41,6 @@ typedef void (*PrintMethod)(struct Component *); typedef struct Component { int width, height; int x_pos, y_pos; - bool activated; ClickHandler click_handler; PrintMethod print_method; } Component; -- cgit v1.2.3 From 41da8b54ed619ea869ca286cd8ec02e105e21c19 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Sun, 31 Dec 2017 15:00:23 +0100 Subject: Implementing all kinds of buttons. Rendering to fix --- include/gui/component.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/gui/component.h') diff --git a/include/gui/component.h b/include/gui/component.h index 0e8f437..0275d45 100644 --- a/include/gui/component.h +++ b/include/gui/component.h @@ -1,10 +1,12 @@ #ifndef UPEM_C_COMPONENT_H #define UPEM_C_COMPONENT_H typedef enum { - WAITING_BUTTON, INSERT_ORIGIN, INSERT_TARGET,PRINTING + WAITING_BUTTON_SHOW, WAITING_BUTTON_HIDE, INSERT_ORIGIN, INSERT_TARGET, PRINTING, EXITING, PRINTING_BUTTONS, RENDERING } Mode; extern Mode mode; +extern int frame; +extern char labelFrame[20]; /** * File: component.h * Windows and components handling. -- cgit v1.2.3