diff options
Diffstat (limited to 'include/gui/component.h')
-rw-r--r-- | include/gui/component.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/gui/component.h b/include/gui/component.h new file mode 100644 index 0000000..dd101dc --- /dev/null +++ b/include/gui/component.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef UPEM_C_COMPONENT_H | ||
2 | #define UPEM_C_COMPONENT_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | /** | ||
6 | * File: component.h | ||
7 | * Windows and components handling. | ||
8 | * | ||
9 | * See also: | ||
10 | * The famous OS | ||
11 | */ | ||
12 | struct Component; | ||
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, struct Component *parameter); | ||
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)(struct Component *); | ||
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 Component { | ||
39 | int width, height; | ||
40 | int x_pos, y_pos; | ||
41 | bool activated; | ||
42 | ClickHandler click_handler; | ||
43 | PrintMethod print_method; | ||
44 | } Component; | ||
45 | |||
46 | #endif //UPEM_C_COMPONENT_H | ||