summaryrefslogtreecommitdiff
path: root/src/gui/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/button.c')
-rw-r--r--src/gui/button.c75
1 files changed, 71 insertions, 4 deletions
diff --git a/src/gui/button.c b/src/gui/button.c
index a1fa1cf..03addf8 100644
--- a/src/gui/button.c
+++ b/src/gui/button.c
@@ -32,21 +32,88 @@ void button_click_test(int x, int y, Component *parameterSelf) {
32 assert(y >= 0); 32 assert(y >= 0);
33 assert(parameterSelf != NULL); 33 assert(parameterSelf != NULL);
34 Button *self = (Button *) parameterSelf; 34 Button *self = (Button *) parameterSelf;
35 if (button_is_selected(x, y, self) && mode == WAITING_BUTTON) { 35 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
36 printf("OK\n");
37 } 36 }
38} 37}
39 38
40void button_click_add_constraint(int x, int y, Component *parameterSelf){ 39void button_click_add_constraint(int x, int y, Component *parameterSelf) {
41 assert(x >= 0); 40 assert(x >= 0);
42 assert(y >= 0); 41 assert(y >= 0);
43 assert(parameterSelf != NULL); 42 assert(parameterSelf != NULL);
44 Button *self = (Button *) parameterSelf; 43 Button *self = (Button *) parameterSelf;
45 if (button_is_selected(x, y, self) && mode == WAITING_BUTTON) { 44 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
46 mode = INSERT_ORIGIN; 45 mode = INSERT_ORIGIN;
47 } 46 }
48} 47}
49 48
49void button_click_show_hide(int x, int y, Component *parameterSelf) {
50 assert(x >= 0);
51 assert(y >= 0);
52 assert(parameterSelf != NULL);
53 Button *self = (Button *) parameterSelf;
54 if (button_is_selected(x, y, self)) {
55 if (mode == WAITING_BUTTON_SHOW) {
56 mode = WAITING_BUTTON_HIDE;
57 } else if (mode == WAITING_BUTTON_HIDE) {
58 mode = WAITING_BUTTON_SHOW;
59 }
60 }
61}
62
63void button_click_exit(int x, int y, Component *parameterSelf) {
64 assert(x >= 0);
65 assert(y >= 0);
66 assert(parameterSelf != NULL);
67 Button *self = (Button *) parameterSelf;
68 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
69 mode = EXITING;
70 }
71}
72
73void button_click_less_frame(int x, int y, Component *parameterSelf) {
74 assert(x >= 0);
75 assert(y >= 0);
76 assert(parameterSelf != NULL);
77 Button *self = (Button *) parameterSelf;
78 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
79 if (frame > 2) {
80 frame = frame / 2;
81 sprintf(labelFrame,"%03d frames", frame);
82 mode = PRINTING_BUTTONS;
83 }
84 }
85}
86
87void button_click_more_frame(int x, int y, Component *parameterSelf) {
88 assert(x >= 0);
89 assert(y >= 0);
90 assert(parameterSelf != NULL);
91 Button *self = (Button *) parameterSelf;
92 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
93 if (frame < 256) {
94 frame = frame * 2;
95 sprintf(labelFrame,"%03d frames", frame);
96 mode = PRINTING_BUTTONS;
97 }
98 }
99}
100
101void button_click_rendering(int x,int y, Component *parameterSelf) {
102 assert(x >= 0);
103 assert(y >= 0);
104 assert(parameterSelf != NULL);
105 Button *self = (Button *) parameterSelf;
106 if (button_is_selected(x, y, self) && (mode == WAITING_BUTTON_SHOW || mode == WAITING_BUTTON_HIDE)) {
107 mode = RENDERING;
108 }
109}
110
111void button_click_none(int x, int y, Component *parameterSelf) {
112 assert(x >= 0);
113 assert(y >= 0);
114 assert(parameterSelf != NULL);
115}
116
50 117
51void 118void
52button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler) { 119button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler) {