diff options
Diffstat (limited to 'include/gui/component.h')
-rw-r--r-- | include/gui/component.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/gui/component.h b/include/gui/component.h new file mode 100644 index 0000000..0275d45 --- /dev/null +++ b/include/gui/component.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef UPEM_C_COMPONENT_H | ||
2 | #define UPEM_C_COMPONENT_H | ||
3 | typedef enum { | ||
4 | WAITING_BUTTON_SHOW, WAITING_BUTTON_HIDE, INSERT_ORIGIN, INSERT_TARGET, PRINTING, EXITING, PRINTING_BUTTONS, RENDERING | ||
5 | } Mode; | ||
6 | |||
7 | extern Mode mode; | ||
8 | extern int frame; | ||
9 | extern char labelFrame[20]; | ||
10 | /** | ||
11 | * File: component.h | ||
12 | * Windows and components handling. | ||
13 | * | ||
14 | * See also: | ||
15 | * The famous OS | ||
16 | */ | ||
17 | struct Component; | ||
18 | |||
19 | /** | ||
20 | * Type: ClickHandler | ||
21 | * Type of functions that handle mouse's clicks. | ||
22 | */ | ||
23 | typedef void (*ClickHandler)(int x_pos, int y_pos, struct Component *parameter); | ||
24 | |||
25 | /** | ||
26 | * Type: PrintMethod | ||
27 | * Type of functions that will be used to print our component. This must be initialized by the initialization function of the component. | ||
28 | */ | ||
29 | typedef void (*PrintMethod)(struct Component *); | ||
30 | |||
31 | /** | ||
32 | * Struct: Component | ||
33 | * Represents an abstract module handling clicks and a way to be print on the screen. | ||
34 | * | ||
35 | * Fields: | ||
36 | * width - width of the component | ||
37 | * height - height of the component | ||
38 | * x_pos - position on the x axis from the origin meant to be placed in top left | ||
39 | * y_pos - position on the y axis from the origin meant to be placed in top left | ||
40 | * click_handler - pointer of function that is called on mouse click | ||
41 | * print_method - pointer of function that handle the component's print | ||
42 | */ | ||
43 | typedef struct Component { | ||
44 | int width, height; | ||
45 | int x_pos, y_pos; | ||
46 | ClickHandler click_handler; | ||
47 | PrintMethod print_method; | ||
48 | } Component; | ||
49 | |||
50 | #endif //UPEM_C_COMPONENT_H | ||