diff options
author | Adam NAILI | 2017-12-10 17:03:55 +0100 |
---|---|---|
committer | Adam NAILI | 2017-12-10 17:09:15 +0100 |
commit | 27b78c91216f397e9aed3c0dd87db2c54dca50fa (patch) | |
tree | 273b4fcc8be9a89eba078bc595089bb114cc1e0a | |
parent | 3449e695fa8885bb8150e105c267d92ab8a3d4ee (diff) | |
download | morpher-27b78c91216f397e9aed3c0dd87db2c54dca50fa.tar.gz |
Creation of component.h and move the content about Component to this header file
-rw-r--r-- | include/gui/component.h | 45 | ||||
-rw-r--r-- | include/gui/group.h | 2 | ||||
-rw-r--r-- | include/gui/window.h | 57 |
3 files changed, 73 insertions, 31 deletions
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 @@ | |||
1 | #ifndef UPEM_C_COMPONENT_H | ||
2 | #define UPEM_C_COMPONENT_H | ||
3 | |||
4 | /** | ||
5 | * File: component.h | ||
6 | * Windows and components handling. | ||
7 | * | ||
8 | * See also: | ||
9 | * The famous OS | ||
10 | */ | ||
11 | |||
12 | #include "group.h" | ||
13 | |||
14 | /** | ||
15 | * Type: ClickHandler | ||
16 | * Type of functions that handle mouse's clicks. | ||
17 | */ | ||
18 | typedef void (*ClickHandler)(int x_pos, int y_pos); | ||
19 | |||
20 | /** | ||
21 | * Type: PrintMethod | ||
22 | * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. | ||
23 | */ | ||
24 | typedef void (*PrintMethod)(void); | ||
25 | |||
26 | /** | ||
27 | * Struct: Component | ||
28 | * Represents an abstract module handling clicks and a way to be print on the screen. | ||
29 | * | ||
30 | * Fields: | ||
31 | * width - width of the component | ||
32 | * height - height of the component | ||
33 | * x_pos - position on the x axis from the origin meant to be placed in top left | ||
34 | * y_pos - position on the y axis from the origin meant to be placed in top left | ||
35 | * click_handler - pointer of function that is called on mouse click | ||
36 | * print_method - pointer of function that handle the component's print | ||
37 | */ | ||
38 | typedef struct { | ||
39 | int width, height; | ||
40 | int x_pos, y_pos; | ||
41 | ClickHandler click_handler; | ||
42 | PrintMethod print_method; | ||
43 | } Component; | ||
44 | |||
45 | #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 @@ | |||
5 | * File: group.h | 5 | * File: group.h |
6 | * Group of components | 6 | * Group of components |
7 | */ | 7 | */ |
8 | #include "window.h" | 8 | #include "component.h" |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Struct: _GroupElement | 11 | * 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,38 +10,9 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "group.h" | 12 | #include "group.h" |
13 | #include "component.h" | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Type: ClickHandler | ||
16 | * Type of functions that handle mouse's clicks. | ||
17 | */ | ||
18 | typedef void (*ClickHandler)(int x_pos, int y_pos); | ||
19 | |||
20 | /** | ||
21 | * Type: PrintMethod | ||
22 | * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. | ||
23 | */ | ||
24 | typedef void (*PrintMethod)(void); | ||
25 | |||
26 | /** | ||
27 | * Struct: Component | ||
28 | * Represents an abstract module handling clicks and a way to be print on the screen. | ||
29 | * | ||
30 | * Fields: | ||
31 | * width - width of the component | ||
32 | * height - height of the component | ||
33 | * x_pos - position on the x axis from the origin meant to be placed in top left | ||
34 | * y_pos - position on the y axis from the origin meant to be placed in top left | ||
35 | * click_handler - pointer of function that is called on mouse click | ||
36 | * print_method - pointer of function that handle the component's print | ||
37 | */ | ||
38 | typedef struct { | ||
39 | int width, height; | ||
40 | int x_pos, y_pos; | ||
41 | ClickHandler click_handler; | ||
42 | PrintMethod print_method; | ||
43 | } Component; | ||
44 | /** | ||
45 | * Struct: Window | 16 | * Struct: Window |
46 | * Supports and handles components. | 17 | * Supports and handles components. |
47 | * | 18 | * |
@@ -100,5 +71,31 @@ void window_add_button(Window *window, Component *component); | |||
100 | */ | 71 | */ |
101 | void window_add_pictureframe(Window *window, Component *component); | 72 | void window_add_pictureframe(Window *window, Component *component); |
102 | 73 | ||
74 | /** | ||
75 | * Function: window_create | ||
76 | * Initializes the resources to create a window. | ||
77 | * | ||
78 | * Parameters: | ||
79 | * *window - pointer to the input window | ||
80 | */ | ||
81 | void window_create(Window *window); | ||
82 | |||
83 | /** | ||
84 | * Function: window_print_buttons | ||
85 | * Prints all the buttons to the screen | ||
86 | * | ||
87 | * Parameters: | ||
88 | * *window - pointer to the input window | ||
89 | */ | ||
90 | void window_print_buttons(Window *window); | ||
91 | |||
92 | /** | ||
93 | * Function: window_print_pictureframes | ||
94 | * Prints all the picture frames to the screen | ||
95 | * | ||
96 | * Parameters: | ||
97 | * *window - pointer to the input window | ||
98 | */ | ||
99 | void window_print_pictureframes(Window *window); | ||
103 | 100 | ||
104 | #endif | 101 | #endif |