diff options
-rw-r--r-- | include/gui/group.h | 4 | ||||
-rw-r--r-- | src/gui/group.c | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/include/gui/group.h b/include/gui/group.h index b766ded..1887bf6 100644 --- a/include/gui/group.h +++ b/include/gui/group.h | |||
@@ -29,13 +29,15 @@ typedef struct _GroupElement { | |||
29 | * Parameters: | 29 | * Parameters: |
30 | * component - Component used for the Group to catch clicks and handle print to delegate to the components contented in it | 30 | * component - Component used for the Group to catch clicks and handle print to delegate to the components contented in it |
31 | * *group_head - pointer to the head of the list that regroup all the components contained inside of the group | 31 | * *group_head - pointer to the head of the list that regroup all the components contained inside of the group |
32 | * padding - padding for all components | ||
32 | */ | 33 | */ |
33 | typedef struct { | 34 | typedef struct { |
34 | Component component; | 35 | Component component; |
35 | GroupElement *group_head; | 36 | GroupElement *group_head; |
37 | int padding; | ||
36 | } Group; | 38 | } Group; |
37 | 39 | ||
38 | void group_init(Group *group, int padding); | 40 | void group_init(Group *group, int width, int height, int x_pos, int y_pos, int padding); |
39 | 41 | ||
40 | void group_free(Group *group); | 42 | void group_free(Group *group); |
41 | 43 | ||
diff --git a/src/gui/group.c b/src/gui/group.c index 8b13789..dc48c50 100644 --- a/src/gui/group.c +++ b/src/gui/group.c | |||
@@ -1 +1,26 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <gui/group.h> | ||
1 | 3 | ||
4 | void group_init(Group *group, int width, int height, int x_pos, int y_pos, int padding) { | ||
5 | group->component.width = width; | ||
6 | group->component.height = height; | ||
7 | group->component.x_pos = x_pos; | ||
8 | group->component.y_pos = y_pos; | ||
9 | group->padding = padding; | ||
10 | } | ||
11 | |||
12 | void group_free(Group *group) { | ||
13 | if (group->group_head != NULL) { | ||
14 | GroupElement *p = group->group_head; | ||
15 | while (p->next != NULL) { | ||
16 | GroupElement *tmp = group->group_head; | ||
17 | p = p->next; | ||
18 | free(tmp); | ||
19 | } | ||
20 | group->group_head = NULL; | ||
21 | } | ||
22 | } | ||
23 | |||
24 | void group_add_component(Group *group, Component *component) { | ||
25 | |||
26 | } \ No newline at end of file | ||