diff options
author | Adam NAILI | 2017-12-08 21:31:50 +0100 |
---|---|---|
committer | Adam NAILI | 2017-12-08 21:31:50 +0100 |
commit | 81eb171910e03ecb06b3b984375622efbe48b739 (patch) | |
tree | d9fbc8eb82407212162e36705dc9663e2329eaf3 | |
parent | 68672a10cc01c5f0c50aaa5779eab8af33046f43 (diff) | |
download | morpher-81eb171910e03ecb06b3b984375622efbe48b739.tar.gz |
Updating window.h doc and rework of the Component struct (adding a pointer of function to print)
-rw-r--r-- | include/gui/window.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/gui/window.h b/include/gui/window.h index defc6f7..c7e12cf 100644 --- a/include/gui/window.h +++ b/include/gui/window.h | |||
@@ -9,14 +9,27 @@ | |||
9 | * The famous OS | 9 | * The famous OS |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /** | ||
13 | * Type: ClickHandler | ||
14 | * Type of functions that handle mouse's clicks. | ||
15 | */ | ||
12 | typedef void (*ClickHandler)(int x_pos, int y_pos); | 16 | typedef void (*ClickHandler)(int x_pos, int y_pos); |
17 | |||
18 | /** | ||
19 | * Type: PrintMethod | ||
20 | * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. | ||
21 | */ | ||
22 | typedef void (*PrintMethod)(void); | ||
23 | |||
13 | /** | 24 | /** |
14 | * Type: Component | 25 | * Type: Component |
15 | * Abstract component that handles clicks. | 26 | * Abstract component that handles clicks. |
16 | */ | 27 | */ |
17 | typedef struct { | 28 | typedef struct { |
18 | int width, height; | 29 | int width, height; |
30 | int x_pos, y_pos; | ||
19 | ClickHandler click_handler; | 31 | ClickHandler click_handler; |
32 | PrintMethod print_method; | ||
20 | } Component; | 33 | } Component; |
21 | /** | 34 | /** |
22 | * Type: Window | 35 | * Type: Window |
@@ -26,6 +39,7 @@ typedef struct { | |||
26 | int width, height; | 39 | int width, height; |
27 | Component *components; | 40 | Component *components; |
28 | } Window; | 41 | } Window; |
42 | |||
29 | /** | 43 | /** |
30 | * Function: window_init | 44 | * Function: window_init |
31 | * Initializes a window. | 45 | * Initializes a window. |
@@ -37,6 +51,7 @@ typedef struct { | |||
37 | * *title - title of the actual window | 51 | * *title - title of the actual window |
38 | */ | 52 | */ |
39 | void window_init(Window *window, int width, int height, char *title); | 53 | void window_init(Window *window, int width, int height, char *title); |
54 | |||
40 | /** | 55 | /** |
41 | * Function: window_free | 56 | * Function: window_free |
42 | * Frees the resources supported by the window and the window itself. | 57 | * Frees the resources supported by the window and the window itself. |
@@ -45,6 +60,7 @@ void window_init(Window *window, int width, int height, char *title); | |||
45 | * *window - pointer to the input window | 60 | * *window - pointer to the input window |
46 | */ | 61 | */ |
47 | void window_free(Window *window); | 62 | void window_free(Window *window); |
63 | |||
48 | /** | 64 | /** |
49 | * Function: window_add_component | 65 | * Function: window_add_component |
50 | * Adds components to the current window at the position specified in x and y. | 66 | * Adds components to the current window at the position specified in x and y. |
@@ -52,9 +68,8 @@ void window_free(Window *window); | |||
52 | * Parameters: | 68 | * Parameters: |
53 | * *window - pointer to the input window | 69 | * *window - pointer to the input window |
54 | * *component - pointer to the input component | 70 | * *component - pointer to the input component |
55 | * x_pos - coordinate on x axis to place the component | ||
56 | * y_pos - coordinate on y axis to place the component | ||
57 | */ | 71 | */ |
58 | void window_add_component(Window *window, Component *component, int x_pos, int y_pos); | 72 | void window_add_component(Window *window, Component *component); |
73 | |||
59 | 74 | ||
60 | #endif | 75 | #endif |