summaryrefslogtreecommitdiff
path: root/include/gui/button.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/gui/button.h')
-rw-r--r--include/gui/button.h80
1 files changed, 77 insertions, 3 deletions
diff --git a/include/gui/button.h b/include/gui/button.h
index 62f75a3..41008c1 100644
--- a/include/gui/button.h
+++ b/include/gui/button.h
@@ -1,16 +1,90 @@
1#ifndef UPEM_MORPHING_BUTTON 1#ifndef UPEM_MORPHING_BUTTON
2#define UPEM_MORPHING_BUTTON 2#define UPEM_MORPHING_BUTTON
3
4/** 3/**
5 * File: button.h 4 * File: button.h
5 * Buttons handling
6 */ 6 */
7 7
8#include <stdbool.h>
9#include "component.h"
10
11/**
12 * Struct: Button
13 * Component that can be triggered by click to execute a specific action.
14 *
15 * Fields:
16 * component - component that will acted as a button thanks to a rightful initialization
17 * *label - title on the button
18 * sizeInterligne - parameter that change padding of the button
19 */
8typedef struct { 20typedef struct {
9 Component component; 21 Component component;
22 char *label;
23 int sizeInterligne;
10} Button; 24} Button;
11 25
12void button_init(Button *button, char *text); 26/**
27 * Function: button_init
28 * Initializes the button.
29 *
30 * Parameters:
31 * *button - pointer to the input button
32 * text - label for the button
33 * sizeInterligne - parameter to initialize padding inside the button
34 * x_pos - position of the button on x axis
35 * 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
37 */
38void button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler);
39
40/**
41 * Function: button_print
42 * Prints the button.
43 *
44 * Parameters:
45 * *parameterSelf - pointer to the button
46 */
47void button_print(Component *parameterSelf);
48
49/**
50 * Function: button_click_test
51 * Debug function to test if the click is working on the current button.
52 *
53 * Parameters:
54 * x - position of the click on x axis
55 * y - position of the click on y axis
56 * *parameterSelf - pointer on the button that is clicked
57 */
58void button_click_test(int x, int y, Component *parameterSelf);
59
60void button_click_add_constraint(int x, int y, Component *parameterSelf);
61
62void button_click_show_hide(int x, int y, Component *parameterSelf);
63
64void button_click_exit(int x, int y, Component *parameterSelf);
65
66void button_click_none(int x, int y, Component *parameterSelf);
67
68void button_click_more_frame(int x, int y, Component *parameterSelf);
69
70void button_click_less_frame(int x, int y, Component *parameterSelf);
71
72void button_click_rendering(int x, int y, Component *parameterSelf);
73
74
75/**
76 * Function: button_is_selected
77 * Checks if the button is selected or not.
78 *
79 * Parameters:
80 * x - position in x for the check
81 * y - position in y for the check
82 * *button - pointer to the current button
83 *
84 * Returns:
85 * A bool from stdbool
86 */
13 87
14void button_free(Button *button); 88bool button_is_selected(int x, int y, Button *button);
15 89
16#endif 90#endif