From cd8d3fef9569f7ff9973ab466f914944af6829ab Mon Sep 17 00:00:00 2001 From: Michal Zima Date: Mon, 6 Jul 2009 13:35:01 +0200 Subject: More coding style fixes - now in widget stuff --- src/widget/widget.c | 46 +++++++++++++++++++++---------------------- src/widget/widget.h | 2 +- src/widget/widget_container.c | 12 +++++------ src/widget/widget_container.h | 2 -- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/widget/widget.c b/src/widget/widget.c index 57c247b..2c0651b 100644 --- a/src/widget/widget.c +++ b/src/widget/widget.c @@ -66,35 +66,33 @@ void widget_set_size(widget_t *p, int *w, int *h) void widget_draw(widget_t *p) { - switch (p->type) - { - case WIDGET_TYPE_LABEL: label_draw(p); break; - case WIDGET_TYPE_BUTTON: button_draw(p); break; - case WIDGET_TYPE_BUTTONIMAGE: button_image_draw(p); break; - case WIDGET_TYPE_TEXTFILED: text_field_draw(p); break; - case WIDGET_TYPE_CATCHKEY: catch_key_draw(p); break; - case WIDGET_TYPE_CHECK: check_draw(p); break; - case WIDGET_TYPE_CHOICE: choice_group_draw(p); break; - case WIDGET_TYPE_IMAGE: wid_image_draw(p); break; - case WIDGET_TYPE_SELECT: select_draw(p); break; - case WIDGET_TYPE_STATUSBAR: statusbar_draw(p); break; + switch (p->type) { + case WIDGET_TYPE_LABEL: label_draw(p); break; + case WIDGET_TYPE_BUTTON: button_draw(p); break; + case WIDGET_TYPE_BUTTONIMAGE: button_image_draw(p); break; + case WIDGET_TYPE_TEXTFILED: text_field_draw(p); break; + case WIDGET_TYPE_CATCHKEY: catch_key_draw(p); break; + case WIDGET_TYPE_CHECK: check_draw(p); break; + case WIDGET_TYPE_CHOICE: choice_group_draw(p); break; + case WIDGET_TYPE_IMAGE: wid_image_draw(p); break; + case WIDGET_TYPE_SELECT: select_draw(p); break; + case WIDGET_TYPE_STATUSBAR: statusbar_draw(p); break; } } void widget_event(widget_t *p) { - switch (p->type) - { - case WIDGET_TYPE_LABEL: label_event(p); break; - case WIDGET_TYPE_BUTTON: button_event(p); break; - case WIDGET_TYPE_BUTTONIMAGE: button_image_event(p); break; - case WIDGET_TYPE_TEXTFILED: text_field_event(p); break; - case WIDGET_TYPE_CATCHKEY: catch_key_event(p); break; - case WIDGET_TYPE_CHECK: check_event(p); break; - case WIDGET_TYPE_CHOICE: choice_group_event(p); break; - case WIDGET_TYPE_IMAGE: wid_image_event(p); break; - case WIDGET_TYPE_SELECT: select_event(p); break; - case WIDGET_TYPE_STATUSBAR: statusbar_event(p); break; + switch (p->type) { + case WIDGET_TYPE_LABEL: label_event(p); break; + case WIDGET_TYPE_BUTTON: button_event(p); break; + case WIDGET_TYPE_BUTTONIMAGE: button_image_event(p); break; + case WIDGET_TYPE_TEXTFILED: text_field_event(p); break; + case WIDGET_TYPE_CATCHKEY: catch_key_event(p); break; + case WIDGET_TYPE_CHECK: check_event(p); break; + case WIDGET_TYPE_CHOICE: choice_group_event(p); break; + case WIDGET_TYPE_IMAGE: wid_image_event(p); break; + case WIDGET_TYPE_SELECT: select_event(p); break; + case WIDGET_TYPE_STATUSBAR: statusbar_event(p); break; } } diff --git a/src/widget/widget.h b/src/widget/widget.h index 2f20c90..b5898c2 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -15,7 +15,7 @@ #define WIDGET_TYPE_STATUSBAR 10 #define WIDGET_TYPE_CONTAINER 11 -#define WIDGET_NONE_VALUE -1 +#define WIDGET_NONE_VALUE -1 typedef struct widget_struct { int type; diff --git a/src/widget/widget_container.c b/src/widget/widget_container.c index 3e0888c..8e1b821 100644 --- a/src/widget/widget_container.c +++ b/src/widget/widget_container.c @@ -1,4 +1,3 @@ - #include #include @@ -44,14 +43,13 @@ void widget_set_layout_table(widget_t *widget, int countW, int countH, int w, in for (j = 0; j < countW; j++) { widget_t *widget_tmp; - if( count >= p->listWidget->count ) - { + if (count >= p->listWidget->count) { break; } - widget_tmp = (widget_t*)p->listWidget->list[count]; + widget_tmp = (widget_t *) p->listWidget->list[count]; - widget_set_location(widget_tmp, widget->x+j*w, widget->y+i*h); + widget_set_location(widget_tmp, widget->x + j * w, widget->y + i * h); count++; } } @@ -70,7 +68,7 @@ void widget_container_draw(widget_t *widget) for (i = 0; i < p->listWidget->count; i++) { widget_t *widget; - widget = (widget_t*)p->listWidget->list[i]; + widget = (widget_t *) p->listWidget->list[i]; widget_draw(widget); } @@ -89,7 +87,7 @@ void widget_container_event(widget_t *widget) for (i = 0; i < p->listWidget->count; i++) { widget_t *widget; - widget = (widget_t*)p->listWidget->list[i]; + widget = (widget_t *) p->listWidget->list[i]; widget_event(widget); } diff --git a/src/widget/widget_container.h b/src/widget/widget_container.h index 7b7708d..5ee5784 100644 --- a/src/widget/widget_container.h +++ b/src/widget/widget_container.h @@ -1,12 +1,10 @@ #ifndef WIDGET_CONTAINER_H - #define WIDGET_CONTAINER_H #include "list.h" #include "widget.h" typedef struct widget_container { - list_t *listWidget; } widget_container_t; -- cgit v1.2.3