From 9b7a6f66182020913cd9b5b1205634dabbcf081e Mon Sep 17 00:00:00 2001 From: Dusan Durech Date: Mon, 15 Jun 2009 14:49:04 +0200 Subject: add widget container, hi is use in mainMenu and small diff --- src/widget/widget.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/widget/widget.c') diff --git a/src/widget/widget.c b/src/widget/widget.c index 4e4143e..57c247b 100644 --- a/src/widget/widget.c +++ b/src/widget/widget.c @@ -5,6 +5,15 @@ #include "widget.h" #include "widget_label.h" +#include "widget_button.h" +#include "widget_buttonimage.h" +#include "widget_textfield.h" +#include "widget_catchkey.h" +#include "widget_check.h" +#include "widget_choicegroup.h" +#include "widget_image.h" +#include "widget_select.h" +#include "widget_statusbar.h" widget_t *widget_new(int type, int x, int y, int w, int h, void *private_data) { @@ -55,6 +64,40 @@ 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; + } +} + +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; + } +} + void widget_destroy(widget_t *p) { free(p); -- cgit v1.2.3