summaryrefslogtreecommitdiff
path: root/include/gui/component.h
diff options
context:
space:
mode:
authorAdam NAILI2017-12-31 17:52:59 +0100
committerAdam NAILI2017-12-31 17:52:59 +0100
commit3e6c3cea17042e83d8e48b87abd89c617a2f70f3 (patch)
tree0d6b22c672e670daa3cb464668500535af0ee988 /include/gui/component.h
parente275a679a1fb9377dd1a74329420ce6e95a03da3 (diff)
parentf1d17a0bb9d1ba98cc94488ecbdb539f123b33ab (diff)
downloadmorpher-3e6c3cea17042e83d8e48b87abd89c617a2f70f3.tar.gz
Merge remote-tracking branch 'origin/gui'
Diffstat (limited to 'include/gui/component.h')
-rw-r--r--include/gui/component.h50
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
3typedef enum {
4 WAITING_BUTTON_SHOW, WAITING_BUTTON_HIDE, INSERT_ORIGIN, INSERT_TARGET, PRINTING, EXITING, PRINTING_BUTTONS, RENDERING
5} Mode;
6
7extern Mode mode;
8extern int frame;
9extern char labelFrame[20];
10/**
11 * File: component.h
12 * Windows and components handling.
13 *
14 * See also:
15 * The famous OS
16 */
17struct Component;
18
19/**
20 * Type: ClickHandler
21 * Type of functions that handle mouse's clicks.
22 */
23typedef 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 */
29typedef 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 */
43typedef 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