diff options
author | Adam NAILI | 2018-01-03 19:40:51 +0100 |
---|---|---|
committer | Adam NAILI | 2018-01-03 19:40:51 +0100 |
commit | 2f3d8ebc9b5e10e56bed5da316f5ef098dda0997 (patch) | |
tree | e2df4b6eaf81cb72f6fef75f6cf7324b0e671f23 /include/gui/button.h | |
parent | 54dac24c8f7be833124a90bafdca78810fc0d96a (diff) | |
download | morpher-2f3d8ebc9b5e10e56bed5da316f5ef098dda0997.tar.gz |
Updating documentation, cleaning includes, updating report
Diffstat (limited to 'include/gui/button.h')
-rw-r--r-- | include/gui/button.h | 90 |
1 files changed, 65 insertions, 25 deletions
diff --git a/include/gui/button.h b/include/gui/button.h index 41008c1..b5908cb 100644 --- a/include/gui/button.h +++ b/include/gui/button.h | |||
@@ -5,7 +5,6 @@ | |||
5 | * Buttons handling | 5 | * Buttons handling |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <stdbool.h> | ||
9 | #include "component.h" | 8 | #include "component.h" |
10 | 9 | ||
11 | /** | 10 | /** |
@@ -24,67 +23,108 @@ typedef struct { | |||
24 | } Button; | 23 | } Button; |
25 | 24 | ||
26 | /** | 25 | /** |
27 | * Function: button_init | 26 | * Function: button_create |
28 | * Initializes the button. | 27 | * Allocates and initializes the button. |
29 | * | 28 | * |
30 | * Parameters: | 29 | * Parameters: |
31 | * *button - pointer to the input button | ||
32 | * text - label for the button | 30 | * text - label for the button |
33 | * sizeInterligne - parameter to initialize padding inside the button | 31 | * sizeInterligne - parameter to initialize padding inside the button |
34 | * x_pos - position of the button on x axis | 32 | * x_pos - position of the button on x axis |
35 | * y_pos - position of the button on y axis | 33 | * y_pos - position of the button on y axis |
36 | * clickHandler - pointer of function that will be loaded inside our button to perform its purpose | 34 | * clickHandler - pointer of function that will be loaded inside our button to perform its purpose |
35 | * | ||
36 | * Returns: | ||
37 | * A pointer of Button | ||
37 | */ | 38 | */ |
38 | void button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler); | 39 | Button * |
40 | button_create(const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler); | ||
39 | 41 | ||
40 | /** | 42 | /** |
41 | * Function: button_print | 43 | * Function: button_destroy |
42 | * Prints the button. | 44 | * Frees the resources for the Button |
43 | * | 45 | * |
44 | * Parameters: | 46 | * Parameters: |
45 | * *parameterSelf - pointer to the button | 47 | * *button - pointer to the button |
46 | */ | 48 | */ |
47 | void button_print(Component *parameterSelf); | 49 | void button_destroy(Button *button); |
48 | 50 | ||
49 | /** | 51 | /** |
50 | * Function: button_click_test | 52 | * Function: button_click_add_constraint |
51 | * Debug function to test if the click is working on the current button. | 53 | * Allows to add a constraint point in order on the first picture, then on the second. |
52 | * | 54 | * |
53 | * Parameters: | 55 | * Parameters: |
54 | * x - position of the click on x axis | 56 | * x - position of the click on x axis |
55 | * y - position of the click on y axis | 57 | * y - position of the click on y axis |
56 | * *parameterSelf - pointer on the button that is clicked | 58 | * *parameterSelf - pointer on the button that is clicked |
57 | */ | 59 | */ |
58 | void button_click_test(int x, int y, Component *parameterSelf); | ||
59 | |||
60 | void button_click_add_constraint(int x, int y, Component *parameterSelf); | 60 | void button_click_add_constraint(int x, int y, Component *parameterSelf); |
61 | 61 | ||
62 | /** | ||
63 | * Function: button_click_show_hide | ||
64 | * Allows to show and hide the constraint points and triangles. | ||
65 | * | ||
66 | * Parameters: | ||
67 | * x - position of the click on x axis | ||
68 | * y - position of the click on y axis | ||
69 | * *parameterSelf - pointer on the button that is clicked | ||
70 | */ | ||
62 | void button_click_show_hide(int x, int y, Component *parameterSelf); | 71 | void button_click_show_hide(int x, int y, Component *parameterSelf); |
63 | 72 | ||
73 | /** | ||
74 | * Function: button_click_exit | ||
75 | * Quit the program. | ||
76 | * | ||
77 | * Parameters: | ||
78 | * x - position of the click on x axis | ||
79 | * y - position of the click on y axis | ||
80 | * *parameterSelf - pointer on the button that is clicked. | ||
81 | */ | ||
64 | void button_click_exit(int x, int y, Component *parameterSelf); | 82 | void button_click_exit(int x, int y, Component *parameterSelf); |
65 | 83 | ||
84 | /** | ||
85 | * Function: button_click_none | ||
86 | * Allows the button to do nothing on click. | ||
87 | * | ||
88 | * Parameters: | ||
89 | * x - position of the click on x axis | ||
90 | * y - position of the click on y axis | ||
91 | * *parameterSelf - pointer on the button that is clicked | ||
92 | */ | ||
66 | void button_click_none(int x, int y, Component *parameterSelf); | 93 | void button_click_none(int x, int y, Component *parameterSelf); |
67 | 94 | ||
95 | |||
96 | /** | ||
97 | * Function: button_click_more_frame | ||
98 | * Multiplies by two the number of frames to create when rendering. | ||
99 | * | ||
100 | * Parameters: | ||
101 | * x - position of the click on x axis | ||
102 | * y - position of the click on y axis | ||
103 | * *parameterSelf - pointer on the button that is clicked | ||
104 | */ | ||
68 | void button_click_more_frame(int x, int y, Component *parameterSelf); | 105 | void button_click_more_frame(int x, int y, Component *parameterSelf); |
69 | 106 | ||
107 | /** | ||
108 | * Function: button_click_less_frame | ||
109 | * Divides by two the number of frames to create when rendering. | ||
110 | * | ||
111 | * Parameters: | ||
112 | * x - position of the click on x axis | ||
113 | * y - position of the click on y axis | ||
114 | * *parameterSelf - pointer on the button that is clicked | ||
115 | */ | ||
70 | void button_click_less_frame(int x, int y, Component *parameterSelf); | 116 | void button_click_less_frame(int x, int y, Component *parameterSelf); |
71 | 117 | ||
72 | void button_click_rendering(int x, int y, Component *parameterSelf); | ||
73 | |||
74 | |||
75 | /** | 118 | /** |
76 | * Function: button_is_selected | 119 | * Function: button_click_rendering |
77 | * Checks if the button is selected or not. | 120 | * Launches the rendering of the morphing |
78 | * | 121 | * |
79 | * Parameters: | 122 | * Parameters: |
80 | * x - position in x for the check | 123 | * x - position of the click on x axis |
81 | * y - position in y for the check | 124 | * y - position of the click on y axis |
82 | * *button - pointer to the current button | 125 | * *parameterSelf - pointer on the button that is clicked |
83 | * | ||
84 | * Returns: | ||
85 | * A bool from stdbool | ||
86 | */ | 126 | */ |
127 | void button_click_rendering(int x, int y, Component *parameterSelf); | ||
87 | 128 | ||
88 | bool button_is_selected(int x, int y, Button *button); | ||
89 | 129 | ||
90 | #endif | 130 | #endif |