summaryrefslogtreecommitdiff
path: root/include/gui
diff options
context:
space:
mode:
authorAdam NAILI2017-12-10 13:00:32 +0100
committerAdam NAILI2017-12-10 13:00:32 +0100
commit6e91c1be2b0abddb6cfe16152b35cd0559b83c4a (patch)
tree30736f1d8c682ccd4f1634fb16eb2d9e34d4f193 /include/gui
parente94826bd09fd785c8ae80c132c3e0a8f4125892b (diff)
downloadmorpher-6e91c1be2b0abddb6cfe16152b35cd0559b83c4a.tar.gz
Updating documentation and reworking the structure of the Window
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/window.h40
1 files changed, 33 insertions, 7 deletions
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);
24typedef void (*PrintMethod)(void); 24typedef void (*PrintMethod)(void);
25 25
26/** 26/**
27 * Type: Component 27 * Struct: Component
28 * Abstract component that handles clicks. 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
29 */ 37 */
30typedef struct { 38typedef struct {
31 int width, height; 39 int width, height;
@@ -34,13 +42,21 @@ typedef struct {
34 PrintMethod print_method; 42 PrintMethod print_method;
35} Component; 43} Component;
36/** 44/**
37 * Type: Window 45 * Struct: Window
38 * Supports and handles components. 46 * Supports and handles components.
47 *
48 * Fields:
49 * width - width of the window
50 * height - height of the window
51 * *title - string printed as name for the window
52 * *group_buttons - group that handles the buttons added to the window
53 * *group_pictureframe - group that handles the picture frames added to the window
39 */ 54 */
40typedef struct { 55typedef struct {
41 int width, height; 56 int width, height;
57 char *title;
42 Group *group_buttons; 58 Group *group_buttons;
43 Group *group_images; 59 Group *group_pictureframe;
44} Window; 60} Window;
45 61
46/** 62/**
@@ -65,14 +81,24 @@ void window_init(Window *window, int width, int height, char *title);
65void window_free(Window *window); 81void window_free(Window *window);
66 82
67/** 83/**
68 * Function: window_add_component 84 * Function: window_add_button
69 * Adds components to the current window at the position specified in x and y. 85 * Adds Button component to the group of buttons of the current window.
86 *
87 * Parameters:
88 * *window - pointer to the input window
89 * *component - pointer to the input component
90 */
91void window_add_button(Window *window, Component *component);
92
93/**
94 * Function: window_add_pictureframe
95 * Adds PictureFrame component to the group of picture frames of the current window.
70 * 96 *
71 * Parameters: 97 * Parameters:
72 * *window - pointer to the input window 98 * *window - pointer to the input window
73 * *component - pointer to the input component 99 * *component - pointer to the input component
74 */ 100 */
75void window_add_component(Window *window, Component *component); 101void window_add_pictureframe(Window *window, Component *component);
76 102
77 103
78#endif 104#endif