diff options
Diffstat (limited to 'src/gui/button.c')
-rw-r--r-- | src/gui/button.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/button.c b/src/gui/button.c index 96cbd9a..a1fa1cf 100644 --- a/src/gui/button.c +++ b/src/gui/button.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <MLV/MLV_all.h> | 6 | #include <MLV/MLV_all.h> |
7 | #include <gui/component.h> | 7 | #include <gui/component.h> |
8 | 8 | ||
9 | |||
10 | bool button_is_selected(int x, int y, Button *button) { | 9 | bool button_is_selected(int x, int y, Button *button) { |
11 | assert(x >= 0); | 10 | assert(x >= 0); |
12 | assert(y >= 0); | 11 | assert(y >= 0); |
@@ -33,11 +32,22 @@ void button_click_test(int x, int y, Component *parameterSelf) { | |||
33 | assert(y >= 0); | 32 | assert(y >= 0); |
34 | assert(parameterSelf != NULL); | 33 | assert(parameterSelf != NULL); |
35 | Button *self = (Button *) parameterSelf; | 34 | Button *self = (Button *) parameterSelf; |
36 | if (button_is_selected(x, y, self) && self->component.activated) { | 35 | if (button_is_selected(x, y, self) && mode == WAITING_BUTTON) { |
37 | printf("OK\n"); | 36 | printf("OK\n"); |
38 | } | 37 | } |
39 | } | 38 | } |
40 | 39 | ||
40 | void button_click_add_constraint(int x, int y, Component *parameterSelf){ | ||
41 | assert(x >= 0); | ||
42 | assert(y >= 0); | ||
43 | assert(parameterSelf != NULL); | ||
44 | Button *self = (Button *) parameterSelf; | ||
45 | if (button_is_selected(x, y, self) && mode == WAITING_BUTTON) { | ||
46 | mode = INSERT_ORIGIN; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | |||
41 | void | 51 | void |
42 | button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler) { | 52 | button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler) { |
43 | assert(button != NULL); | 53 | assert(button != NULL); |
@@ -51,7 +61,6 @@ button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int | |||
51 | MLV_get_size_of_adapted_text_box(text, sizeInterligne, &button->component.width, &button->component.height); | 61 | MLV_get_size_of_adapted_text_box(text, sizeInterligne, &button->component.width, &button->component.height); |
52 | button->component.x_pos = x_pos; | 62 | button->component.x_pos = x_pos; |
53 | button->component.y_pos = y_pos; | 63 | button->component.y_pos = y_pos; |
54 | button->component.activated = true; | ||
55 | button->component.print_method = button_print; | 64 | button->component.print_method = button_print; |
56 | button->component.click_handler = clickHandler; | 65 | button->component.click_handler = clickHandler; |
57 | } | 66 | } |