summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam NAILI2017-12-22 18:31:33 +0100
committerAdam NAILI2017-12-22 18:31:33 +0100
commita05d3ad97d513c03d671059a5bae18487af23e24 (patch)
treee5ff2cf856974f1d535937ab7ca96772a56a323c /include
parenta42fdf7d5c9712297f1bbe3dd0951baa8ee32447 (diff)
downloadmorpher-a05d3ad97d513c03d671059a5bae18487af23e24.tar.gz
Updating doc of button, implementing button_is_selected, button_print, button_click_test (debug click handling), button_init
Diffstat (limited to 'include')
-rw-r--r--include/gui/button.h49
1 files changed, 46 insertions, 3 deletions
diff --git a/include/gui/button.h b/include/gui/button.h
index fda83e9..6f91e37 100644
--- a/include/gui/button.h
+++ b/include/gui/button.h
@@ -5,17 +5,23 @@
5 * File: button.h 5 * File: button.h
6 * Buttons handling 6 * Buttons handling
7 */ 7 */
8#include "window.h" 8
9#include <stdbool.h>
10#include "component.h"
9 11
10/** 12/**
11 * Struct: Button 13 * Struct: Button
12 * Component that can be triggered by click to execute a specific action. 14 * Component that can be triggered by click to execute a specific action.
13 * 15 *
14 * Fields: 16 * Fields:
15 * component - component that will acted as a button thanks to a rightful initialization. 17 * component - component that will acted as a button thanks to a rightful initialization
18 * *label - title on the button
19 * sizeInterligne - parameter that change padding of the button
16 */ 20 */
17typedef struct { 21typedef struct {
18 Component component; 22 Component component;
23 char *label;
24 int sizeInterligne;
19} Button; 25} Button;
20 26
21/** 27/**
@@ -25,8 +31,45 @@ typedef struct {
25 * Parameters: 31 * Parameters:
26 * *button - pointer to the input button 32 * *button - pointer to the input button
27 * text - label for the button 33 * text - label for the button
34 * sizeInterligne - parameter to initialize padding inside the button
35 * x_pos - position of the button on x axis
36 * y_pos - position of the button on y axis
37 * clickHandler - pointer of function that will be loaded inside our button to perform its purpose
38 */
39void button_init(Button *button, const char *text, int sizeInterligne, int x_pos, int y_pos, ClickHandler clickHandler);
40
41/**
42 * Function: button_print
43 * Prints the button.
44 *
45 * Parameters:
46 * *parameterSelf - pointer to the button
47 */
48void button_print(Component *parameterSelf);
49
50/**
51 * Function: button_click_test
52 * Debug function to test if the click is working on the current button.
53 *
54 * Parameters:
55 * x - position of the click on x axis
56 * y - position of the click on y axis
57 * *parameterSelf - pointer on the button that is clicked
28 */ 58 */
29void button_init(Button *button, char *text); 59void button_click_test(int x, int y, Component *parameterSelf);
30 60
61/**
62 * Function: button_is_selected
63 * Checks if the button is selected or not.
64 *
65 * Parameters:
66 * x - position in x for the check
67 * y - position in y for the check
68 * *button - pointer to the current button
69 *
70 * Returns:
71 * A bool from stdbool
72 */
73bool button_is_selected(int x, int y, Button *button);
31 74
32#endif 75#endif