diff options
Diffstat (limited to 'include/gui/window.h')
-rw-r--r-- | include/gui/window.h | 93 |
1 files changed, 85 insertions, 8 deletions
diff --git a/include/gui/window.h b/include/gui/window.h index 9394c84..329997b 100644 --- a/include/gui/window.h +++ b/include/gui/window.h | |||
@@ -3,24 +3,101 @@ | |||
3 | 3 | ||
4 | /** | 4 | /** |
5 | * File: window.h | 5 | * File: window.h |
6 | * Windows and components handling. | ||
7 | * | ||
8 | * See also: | ||
9 | * The famous OS | ||
6 | */ | 10 | */ |
7 | 11 | ||
8 | typedef void (*ClickHandler)(int x_pos, int y_pos); | 12 | #include "group.h" |
9 | 13 | #include "component.h" | |
10 | typedef struct { | 14 | #include "button.h" |
11 | int width, height; | 15 | #include "pictureframe.h" |
12 | ClickHandler click_handler; | ||
13 | } Component; | ||
14 | 16 | ||
17 | /** | ||
18 | * Struct: Window | ||
19 | * Supports and handles components. | ||
20 | * | ||
21 | * Fields: | ||
22 | * width - width of the window | ||
23 | * height - height of the window | ||
24 | * *title - string printed as name for the window | ||
25 | * *group_buttons - group that handles the buttons added to the window | ||
26 | * *group_pictureframe - group that handles the picture frames added to the window | ||
27 | */ | ||
15 | typedef struct { | 28 | typedef struct { |
16 | int width, height; | 29 | int width, height; |
17 | Component *components; | 30 | char *title; |
31 | Group *group_buttons; | ||
32 | Group *group_pictureframe; | ||
18 | } Window; | 33 | } Window; |
19 | 34 | ||
35 | /** | ||
36 | * Function: window_init | ||
37 | * Initializes a window. | ||
38 | * | ||
39 | * Parameters: | ||
40 | * *window - pointer to the input window | ||
41 | * width - width of the window to initialize | ||
42 | * height - height of the window to initialize | ||
43 | * *title - title of the actual window | ||
44 | */ | ||
20 | void window_init(Window *window, int width, int height, char *title); | 45 | void window_init(Window *window, int width, int height, char *title); |
21 | 46 | ||
47 | /** | ||
48 | * Function: window_free | ||
49 | * Frees the resources supported by the window and the window itself. | ||
50 | * | ||
51 | * Parameters: | ||
52 | * *window - pointer to the input window | ||
53 | */ | ||
22 | void window_free(Window *window); | 54 | void window_free(Window *window); |
23 | 55 | ||
24 | void window_add_component(Window *window, Component *component, int x_pos, int y_pos); | 56 | /** |
57 | * Function: window_add_button | ||
58 | * Adds Button component to the group of buttons of the current window. | ||
59 | * | ||
60 | * Parameters: | ||
61 | * *window - pointer to the input window | ||
62 | * *button - pointer to the input button | ||
63 | */ | ||
64 | void window_add_button(Window *window, Button *button); | ||
65 | |||
66 | /** | ||
67 | * Function: window_add_pictureframe | ||
68 | * Adds PictureFrame component to the group of picture frames of the current window. | ||
69 | * | ||
70 | * Parameters: | ||
71 | * *window - pointer to the input window | ||
72 | * *pictureFrame - pointer to the input picture frame | ||
73 | */ | ||
74 | void window_add_pictureframe(Window *window, PictureFrame *pictureFrame); | ||
75 | |||
76 | /** | ||
77 | * Function: window_create | ||
78 | * Initializes the resources to create a window. | ||
79 | * | ||
80 | * Parameters: | ||
81 | * *window - pointer to the input window | ||
82 | */ | ||
83 | void window_create(Window *window); | ||
84 | |||
85 | /** | ||
86 | * Function: window_print_buttons | ||
87 | * Prints all the buttons to the screen | ||
88 | * | ||
89 | * Parameters: | ||
90 | * *window - pointer to the input window | ||
91 | */ | ||
92 | void window_print_buttons(Window *window); | ||
93 | |||
94 | /** | ||
95 | * Function: window_print_pictureframes | ||
96 | * Prints all the picture frames to the screen | ||
97 | * | ||
98 | * Parameters: | ||
99 | * *window - pointer to the input window | ||
100 | */ | ||
101 | void window_print_pictureframes(Window *window); | ||
25 | 102 | ||
26 | #endif | 103 | #endif |