diff options
Diffstat (limited to 'src/widget')
| -rw-r--r-- | src/widget/widget.c | 52 | ||||
| -rw-r--r-- | src/widget/widget.h | 33 | ||||
| -rw-r--r-- | src/widget/widget_button.c | 55 | ||||
| -rw-r--r-- | src/widget/widget_button.h | 13 | ||||
| -rw-r--r-- | src/widget/widget_buttonimage.c | 55 | ||||
| -rw-r--r-- | src/widget/widget_buttonimage.h | 13 | ||||
| -rw-r--r-- | src/widget/widget_catchkey.c | 61 | ||||
| -rw-r--r-- | src/widget/widget_catchkey.h | 14 | ||||
| -rw-r--r-- | src/widget/widget_check.c | 64 | ||||
| -rw-r--r-- | src/widget/widget_check.h | 12 | ||||
| -rw-r--r-- | src/widget/widget_choicegroup.c | 96 | ||||
| -rw-r--r-- | src/widget/widget_choicegroup.h | 13 | ||||
| -rw-r--r-- | src/widget/widget_image.c | 33 | ||||
| -rw-r--r-- | src/widget/widget_image.h | 10 | ||||
| -rw-r--r-- | src/widget/widget_label.c | 40 | ||||
| -rw-r--r-- | src/widget/widget_label.h | 11 | ||||
| -rw-r--r-- | src/widget/widget_select.c | 95 | ||||
| -rw-r--r-- | src/widget/widget_select.h | 18 | ||||
| -rw-r--r-- | src/widget/widget_textfield.c | 88 | ||||
| -rw-r--r-- | src/widget/widget_textfield.h | 13 |
20 files changed, 597 insertions, 192 deletions
diff --git a/src/widget/widget.c b/src/widget/widget.c new file mode 100644 index 0000000..2d9ee19 --- /dev/null +++ b/src/widget/widget.c @@ -0,0 +1,52 @@ + +#include <stdlib.h> +#include <assert.h> + +#include "main.h" + +#include "widget.h" +#include "widget_label.h" + +widget_t* newWidget(int type, int x, int y, int w, int h, void *private_data) +{ + widget_t *new; + + new = malloc( sizeof(widget_t) ); + new->type = type; + new->x = x; + new->y = y; + new->w = w; + new->h = h; + new->private_data = private_data; + + return new; +} + +void widgetSetLocation(widget_t *p, int x, int y) +{ + p->x = x; + p->y = y; +} + +void widgetGetLocation(widget_t *p, int *x, int *y) +{ + if( x != NULL )*x = p->x; + if( y != NULL )*y = p->y; +} + +void widgetSetSize(widget_t *p, int w, int h) +{ + p->w = w; + p->h = h; +} + +void widgetGetSize(widget_t *p, int *w, int *h) +{ + if( w != NULL )*w = p->w; + if( h != NULL )*h = p->h; +} + +void destroyWidget(widget_t *p) +{ + free(p); +} diff --git a/src/widget/widget.h b/src/widget/widget.h new file mode 100644 index 0000000..0fcb86c --- /dev/null +++ b/src/widget/widget.h @@ -0,0 +1,33 @@ + +#ifndef WIDGET_H + +#define WIDGET_H + +#include "main.h" + +#define WIDGET_TYPE_LABEL 1 +#define WIDGET_TYPE_BUTTON 2 +#define WIDGET_TYPE_BUTTONIMAGE 3 +#define WIDGET_TYPE_TEXTFILED 4 +#define WIDGET_TYPE_CATCHKEY 4 +#define WIDGET_TYPE_CHECK 5 +#define WIDGET_TYPE_CHOICE 6 +#define WIDGET_TYPE_IMAGE 7 +#define WIDGET_TYPE_SELECT 8 + +typedef struct widget_struct +{ + int type; + int x, y; + int w, h; + void *private_data; +} widget_t; + +extern widget_t* newWidget(int type, int x, int y, int w, int h, void *private_data); +extern void widgetSetLocation(widget_t *p, int x, int y); +extern void widgetGetLocation(widget_t *p, int *x, int *y); +extern void widgetSetSize(widget_t *p, int w, int h); +extern void widgetGetSize(widget_t *p, int *w, int *h); +extern void destroyWidget(widget_t *p); + +#endif diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c index 4cff900..add6adf 100644 --- a/src/widget/widget_button.c +++ b/src/widget/widget_button.c @@ -1,5 +1,6 @@ #include <stdlib.h> +#include <assert.h> #include "main.h" @@ -7,28 +8,32 @@ #include "image.h" #include "font.h" +#include "widget.h" #include "widget_button.h" -widget_button_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(void *)) +widget_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(void *)) { widget_button_t *new; new = malloc( sizeof(widget_button_t) ); new->text = strdup(text); - new->x = x; - new->y = y; new->fce_event = fce_event; - getTextSize(text, &new->w, &new->h); + getTextSize(text, &(new->w), &(new->h)); - return new; + return newWidget(WIDGET_TYPE_BUTTON, x, y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, new); } -void drawWidgetButton(widget_button_t *p) +void drawWidgetButton(widget_t *widget) { + widget_button_t *p; static image_t *g_button0 = NULL; static image_t *g_button1 = NULL; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTON ); + + p = (widget_button_t *) widget->private_data; getMousePosition(&x, &y); if( g_button0 == NULL ) @@ -41,25 +46,33 @@ void drawWidgetButton(widget_button_t *p) g_button1 = addImageData("button1.png", IMAGE_ALPHA, "button1", IMAGE_GROUP_BASE); } - if( x >= p->x && x <= p->x+WIDGET_BUTTON_WIDTH && - y >= p->y && y <= p->y+WIDGET_BUTTON_HEIGHT ) + if( x >= widget->x && x <= widget->x+WIDGET_BUTTON_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_BUTTON_HEIGHT ) { - drawImage(g_button1, p->x, p->y, 0, 0, g_button0->w, g_button0->h); + drawImage(g_button1, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h); } else { - drawImage(g_button0, p->x, p->y, 0, 0, g_button0->w, g_button0->h); + drawImage(g_button0, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h); } //drawFont(p->text, p->x+WIDGET_BUTTON_WIDTH/2-p->w/2, p->y+p->h/2, COLOR_WHITE); - drawFont(p->text, p->x + WIDGET_BUTTON_WIDTH/2 - p->w/2, p->y + WIDGET_BUTTON_HEIGHT/2 - p->h/2, COLOR_WHITE); + drawFont(p->text, + widget->x + WIDGET_BUTTON_WIDTH/2 - p->w/2, + widget->y + WIDGET_BUTTON_HEIGHT/2 - p->h/2, COLOR_WHITE); } -void eventWidgetButton(widget_button_t *p) +void eventWidgetButton(widget_t *widget) { + widget_button_t *p; static int time = 0; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTON ); + + p = (widget_button_t *) widget->private_data; + if( time > 0) { time--; @@ -68,17 +81,27 @@ void eventWidgetButton(widget_button_t *p) getMousePosition(&x, &y); - if( x >= p->x && x <= p->x+WIDGET_BUTTON_WIDTH && - y >= p->y && y <= p->y+WIDGET_BUTTON_HEIGHT && + if( x >= widget->x && x <= widget->x+WIDGET_BUTTON_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_BUTTON_HEIGHT && isMouseClicked() ) { time = WIDGET_BUTTON_TIME; - p->fce_event(p); + printf("event\n"); + p->fce_event(widget); } } -void destroyWidgetButton(widget_button_t *p) +void destroyWidgetButton(widget_t *widget) { + widget_button_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTON ); + + p = (widget_button_t *) widget->private_data; + free(p->text); free(p); + + destroyWidget(widget); } diff --git a/src/widget/widget_button.h b/src/widget/widget_button.h index 5090e55..4bdf7c0 100644 --- a/src/widget/widget_button.h +++ b/src/widget/widget_button.h @@ -4,6 +4,7 @@ #define WIDGET_BUTTON_H #include "main.h" +#include "widget.h" #define WIDGET_BUTTON_TIME 10 @@ -12,16 +13,14 @@ typedef struct widget_button { - int x, y; - int w, h; char *text; + int w, h; void (*fce_event)(void *); } widget_button_t; -extern widget_button_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(void *)); -extern void drawWidgetButton(widget_button_t *p); -extern void eventWidgetButton(widget_button_t *p); -extern void destroyWidgetButton(widget_button_t *p); +extern widget_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(void *)); +extern void drawWidgetButton(widget_t *widget); +extern void eventWidgetButton(widget_t *widget); +extern void destroyWidgetButton(widget_t *widget); #endif - diff --git a/src/widget/widget_buttonimage.c b/src/widget/widget_buttonimage.c index 6dfbe66..27e94a3 100644 --- a/src/widget/widget_buttonimage.c +++ b/src/widget/widget_buttonimage.c @@ -1,37 +1,61 @@ #include <stdlib.h> +#include <assert.h> + #include "main.h" #include "interface.h" #include "font.h" #include "image.h" + +#include "widget.h" #include "widget_buttonimage.h" -widget_buttonimage_t* newWidgetButtonimage(image_t *image, int x, int y, void (*fce_event)(void *)) +widget_t* newWidgetButtonimage(image_t *image, int x, int y, void (*fce_event)(void *)) { widget_buttonimage_t *new; new = malloc( sizeof(widget_buttonimage_t) ); new->image = image; - new->x = x; - new->y = y; new->w = image->w/2; new->h = image->h; new->active = 0; new->fce_event = fce_event; - return new; + return newWidget(WIDGET_TYPE_BUTTONIMAGE, x, y, new->w, new->h, new); } -void drawWidgetButtonimage(widget_buttonimage_t *p) +void setWidgetButtonimageActive(widget_t *widget, bool_t active) { - drawImage(p->image, p->x, p->y, p->active*p->w, 0, p->w, p->h); + widget_buttonimage_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTONIMAGE ); + + p = (widget_buttonimage_t *)widget->private_data; + p->active = active; } -void eventWidgetButtonimage(widget_buttonimage_t *p) +void drawWidgetButtonimage(widget_t *widget) { + widget_buttonimage_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTONIMAGE ); + + p = (widget_buttonimage_t *)widget->private_data; + drawImage(p->image, widget->x, widget->y, p->active*p->w, 0, p->w, p->h); +} + +void eventWidgetButtonimage(widget_t *widget) +{ + widget_buttonimage_t *p; static int time = 0; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTONIMAGE ); + + p = (widget_buttonimage_t *) widget->private_data; if( time > 0) { time--; @@ -40,16 +64,25 @@ void eventWidgetButtonimage(widget_buttonimage_t *p) getMousePosition(&x, &y); - if( x >= p->x && x <= p->x+p->w && - y >= p->y && y <= p->y+p->h && + if( x >= widget->x && x <= widget->x+p->w && + y >= widget->y && y <= widget->y+p->h && isMouseClicked() ) { time = WIDGET_BUTTONIMAGE_TIME; - p->fce_event(p); + p->active = 1; + p->fce_event(widget); } } -void destroyWidgetButtonimage(widget_buttonimage_t *p) +void destroyWidgetButtonimage(widget_t *widget) { + widget_buttonimage_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_BUTTONIMAGE ); + + p = (widget_buttonimage_t *) widget->private_data; + free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_buttonimage.h b/src/widget/widget_buttonimage.h index e85ce70..c57b143 100644 --- a/src/widget/widget_buttonimage.h +++ b/src/widget/widget_buttonimage.h @@ -7,21 +7,22 @@ #define WIDGET_BUTTONIMAGE_TIME 10 +#include "widget.h" + typedef struct widget_buttonimageimage { - int x, y; int w, h; int active; image_t *image; void (*fce_event)(void *); } widget_buttonimage_t; -extern widget_buttonimage_t* newWidgetButtonimage(image_t *image, int x, int y, +extern widget_t* newWidgetButtonimage(image_t *image, int x, int y, void (*fce_event)(void *)); -extern void drawWidgetButtonimage(widget_buttonimage_t *p); -extern void eventWidgetButtonimage(widget_buttonimage_t *p); -extern void destroyWidgetButtonimage(widget_buttonimage_t *p); +extern void setWidgetButtonimageActive(widget_t *widget, bool_t active); +extern void drawWidgetButtonimage(widget_t *widget); +extern void eventWidgetButtonimage(widget_t *widget); +extern void destroyWidgetButtonimage(widget_t *widget); #endif - diff --git a/src/widget/widget_catchkey.c b/src/widget/widget_catchkey.c index 793c76a..bd281db 100644 --- a/src/widget/widget_catchkey.c +++ b/src/widget/widget_catchkey.c @@ -1,40 +1,59 @@ #include <stdlib.h> +#include <assert.h> #include "main.h" #include "interface.h" #include "font.h" + +#include "widget.h" #include "widget_catchkey.h" -widget_catchkey_t* newWidgetCatchkey(int key, int x, int y, void *event) +widget_t* newWidgetCatchkey(int key, int x, int y, void *event) { widget_catchkey_t *new; new = malloc( sizeof(widget_catchkey_t) ); - - new->x = x; - new->y = y; new->key = key; new->fce_event = event; new->active = FALSE; - return new; + return newWidget(WIDGET_TYPE_CATCHKEY, x, y, WIDGET_CATCHKEY_WIDTH, WIDGET_CATCHKEY_HEIGHT, new); } -int getWidgetCatchKey(widget_catchkey_t *p) +int getWidgetCatchKey(widget_t *widget) { + widget_catchkey_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CATCHKEY ); + + p = (widget_catchkey_t *) widget->private_data; + return p->key; } -void setWidgetCatchKey(widget_catchkey_t *p, int key) +void setWidgetCatchKey(widget_t *widget, int key) { + widget_catchkey_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CATCHKEY ); + + p = (widget_catchkey_t *) widget->private_data; + p->key = key; } -void drawWidgetCatchkey(widget_catchkey_t *p) +void drawWidgetCatchkey(widget_t *widget) { + widget_catchkey_t *p; char *name; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CATCHKEY ); + + p = (widget_catchkey_t *) widget->private_data; name = NULL; if( p->key != WIDGET_CATCHKEY_NOKEY ) @@ -49,11 +68,11 @@ void drawWidgetCatchkey(widget_catchkey_t *p) if( p->active ) { - drawFont(name, p->x, p->y, COLOR_RED); + drawFont(name, widget->x, widget->y, COLOR_RED); } else { - drawFont(name, p->x, p->y, COLOR_WHITE); + drawFont(name, widget->x, widget->y, COLOR_WHITE); } } @@ -82,16 +101,22 @@ static int getPessAnyKey() return WIDGET_CATCHKEY_NOKEY; } -void eventWidgetCatchkey(widget_catchkey_t *p) +void eventWidgetCatchkey(widget_t *widget) { + widget_catchkey_t *p; int x, y; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CATCHKEY ); + + p = (widget_catchkey_t *) widget->private_data; getMousePosition(&x, &y); if( isMouseClicked() ) { - if( x >= p->x && x <= p->x+WIDGET_CATCHKEY_WIDTH && - y >= p->y && y <= p->y+WIDGET_CATCHKEY_HEIGHT ) + if( x >= widget->x && x <= widget->x+WIDGET_CATCHKEY_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_CATCHKEY_HEIGHT ) { p->active = TRUE; } @@ -115,7 +140,15 @@ void eventWidgetCatchkey(widget_catchkey_t *p) } } -void destroyWidgetCatchkey(widget_catchkey_t *p) +void destroyWidgetCatchkey(widget_t *widget) { + widget_catchkey_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CATCHKEY ); + + p = (widget_catchkey_t *) widget->private_data; + free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_catchkey.h b/src/widget/widget_catchkey.h index 4b09d20..cec2110 100644 --- a/src/widget/widget_catchkey.h +++ b/src/widget/widget_catchkey.h @@ -3,6 +3,7 @@ #define WIDGET_CATCHKEY_H #include "main.h" +#include "widget.h" #define WIDGET_CATCHKEY_WIDTH 110 #define WIDGET_CATCHKEY_HEIGHT 12 @@ -11,18 +12,17 @@ typedef struct widget_catchkey_struct { - int x, y; int w, h; int key; bool_t active; void (*fce_event)(void *p); } widget_catchkey_t; -extern widget_catchkey_t* newWidgetCatchkey(int key, int x, int y, void *event); -extern int getWidgetCatchKey(widget_catchkey_t *p); -extern void setWidgetCatchKey(widget_catchkey_t *p, int key); -extern void drawWidgetCatchkey(widget_catchkey_t *p); -extern void eventWidgetCatchkey(widget_catchkey_t *p); -extern void destroyWidgetCatchkey(widget_catchkey_t *p); +extern widget_t* newWidgetCatchkey(int key, int x, int y, void *event); +extern int getWidgetCatchKey(widget_t *p); +extern void setWidgetCatchKey(widget_t *p, int key); +extern void drawWidgetCatchkey(widget_t *p); +extern void eventWidgetCatchkey(widget_t *p); +extern void destroyWidgetCatchkey(widget_t *p); #endif diff --git a/src/widget/widget_check.c b/src/widget/widget_check.c index 584b6da..2d94238 100644 --- a/src/widget/widget_check.c +++ b/src/widget/widget_check.c @@ -1,30 +1,38 @@ #include <stdlib.h> +#include <assert.h> + #include "main.h" #include "interface.h" #include "image.h" + +#include "widget.h" #include "widget_check.h" -widget_check_t* newWidgetCheck(int x, int y, bool_t status, void (*fce_event)(void *)) +widget_t* newWidgetCheck(int x, int y, bool_t status, void (*fce_event)(void *)) { widget_check_t *new; new = malloc( sizeof(widget_check_t) ); - new->x = x; - new->y = y; new->time = 0; new->status = status; new->fce_event = fce_event; - return new; + return newWidget(WIDGET_TYPE_CHECK, x, y, WIDGET_CHECK_WIDTH, WIDGET_CHECK_HEIGHT, new); } -void drawWidgetCheck(widget_check_t *p) +void drawWidgetCheck(widget_t *widget) { + widget_check_t *p; static image_t *g_check = NULL; int x, y; int offset; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHECK ); + + p = (widget_check_t *) widget->private_data; + getMousePosition(&x, &y); if( g_check == NULL ) @@ -41,13 +49,19 @@ void drawWidgetCheck(widget_check_t *p) offset = WIDGET_CHECK_WIDTH; } - drawImage(g_check, p->x, p->y, offset, 0, WIDGET_CHECK_WIDTH, WIDGET_CHECK_HEIGHT); + drawImage(g_check, widget->x, widget->y, offset, 0, WIDGET_CHECK_WIDTH, WIDGET_CHECK_HEIGHT); } -void eventWidgetCheck(widget_check_t *p) +void eventWidgetCheck(widget_t *widget) { + widget_check_t *p; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHECK ); + + p = (widget_check_t *) widget->private_data; + if( p->time > 0 ) { p->time--; @@ -56,8 +70,8 @@ void eventWidgetCheck(widget_check_t *p) getMousePosition(&x, &y); - if( x >= p->x && x <= p->x+WIDGET_CHECK_WIDTH && - y >= p->y && y <= p->y+WIDGET_CHECK_HEIGHT && + if( x >= widget->x && x <= widget->x+WIDGET_CHECK_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_CHECK_HEIGHT && isMouseClicked() ) { if( p->status == TRUE ) @@ -78,7 +92,37 @@ void eventWidgetCheck(widget_check_t *p) } } -void destroyWidgetCheck(widget_check_t *p) +bool_t getWidgetCheckStatus(widget_t *widget) { + widget_check_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHECK ); + + p = (widget_check_t *) widget->private_data; + + return p->status; +} + +void setWidgetCheckStatus(widget_t *widget, bool_t status) +{ + widget_check_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHECK ); + + p = (widget_check_t *) widget->private_data; + p->status = status; +} + +void destroyWidgetCheck(widget_t *widget) +{ + widget_check_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHECK ); + + p = (widget_check_t *) widget->private_data; free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_check.h b/src/widget/widget_check.h index 2e3a3a3..c8b13b0 100644 --- a/src/widget/widget_check.h +++ b/src/widget/widget_check.h @@ -4,6 +4,7 @@ #define WIDGET_CHECK_H #include "main.h" +#include "widget.h" #define WIDGET_CHECK_TIME_SWITCH_STATUS 5 @@ -12,16 +13,17 @@ typedef struct widget_check { - int x, y; bool_t status; int time; void (*fce_event)(void *); } widget_check_t; -extern widget_check_t* newWidgetCheck(int x, int y, bool_t status, void (*fce_event)(void *)); -extern void drawWidgetCheck(widget_check_t *p); -extern void eventWidgetCheck(widget_check_t *p); -extern void destroyWidgetCheck(widget_check_t *p); +extern widget_t* newWidgetCheck(int x, int y, bool_t status, void (*fce_event)(void *)); +extern void drawWidgetCheck(widget_t *widget); +extern void eventWidgetCheck(widget_t *widget); +extern bool_t getWidgetCheckStatus(widget_t *widget); +extern void setWidgetCheckStatus(widget_t *widget, bool_t status); +extern void destroyWidgetCheck(widget_t *widget); #endif diff --git a/src/widget/widget_choicegroup.c b/src/widget/widget_choicegroup.c index 5404461..fc4fd01 100644 --- a/src/widget/widget_choicegroup.c +++ b/src/widget/widget_choicegroup.c @@ -5,35 +5,44 @@ #include "main.h" #include "interface.h" #include "image.h" + +#include "widget.h" #include "widget_choicegroup.h" -widget_choicegroup_t* newWidgetChoicegroup(int x, int y, bool_t status, list_t *list, void (*fce_event)(void *)) +widget_t* newWidgetChoicegroup(int x, int y, bool_t status, list_t *list, void (*fce_event)(void *)) { widget_choicegroup_t *new; + widget_t *widget; new = malloc( sizeof(widget_choicegroup_t) ); - new->x = x; - new->y = y; new->time = 0; new->status = status; new->fce_event = fce_event; new->list = list; - addList(new->list, new); - return new; + widget = newWidget(WIDGET_TYPE_CHOICE, x, y, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT, new); + addList(new->list, widget); + + return widget; } -void drawWidgetChoicegroup(widget_choicegroup_t *p) +void drawWidgetChoicegroup(widget_t *widget) { + widget_choicegroup_t *p; static image_t *g_choicegroup = NULL; int x, y; int offset; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + getMousePosition(&x, &y); if( g_choicegroup == NULL ) { - g_choicegroup = addImageData("check.png", IMAGE_ALPHA, "choicegroup", IMAGE_GROUP_BASE); + g_choicegroup = addImageData("choice.png", IMAGE_ALPHA, "choicegroup", IMAGE_GROUP_BASE); } if( p->status == TRUE ) @@ -45,36 +54,73 @@ void drawWidgetChoicegroup(widget_choicegroup_t *p) offset = WIDGET_CHOICEGROUP_WIDTH; } - drawImage(g_choicegroup, p->x, p->y, offset, 0, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT); + drawImage(g_choicegroup, widget->x, widget->y, offset, 0, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT); } -static void setActive(widget_choicegroup_t *p) +void setWidgetChoiceActive(widget_t *widget) { + widget_choicegroup_t *p; int i; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + for( i = 0 ; i < p->list->count ; i++ ) { - widget_choicegroup_t *this; + widget_t *this; + widget_choicegroup_t *thisChoice; - this = (widget_choicegroup_t *) p->list->list[i]; + this = (widget_t *) p->list->list[i]; + thisChoice = (widget_choicegroup_t *) this->private_data; - if( this == p ) + if( widget == this ) { - this->status = TRUE; - this->time = WIDGET_CHOICEGROUP_TIME_SWITCH_STATUS; - this->fce_event(p); + thisChoice->status = TRUE; + thisChoice->time = WIDGET_CHOICEGROUP_TIME_SWITCH_STATUS; + thisChoice->fce_event(p); } else { - this->status = FALSE; + thisChoice->status = FALSE; } } } -void eventWidgetChoicegroup(widget_choicegroup_t *p) +bool_t getWidgetChoiceStatus(widget_t *widget) +{ + widget_choicegroup_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + + return p->status; +} + +void setWidgetChoiceStatus(widget_t *widget, bool_t status) +{ + widget_choicegroup_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + p->status = status; +} + +void eventWidgetChoicegroup(widget_t *widget) { + widget_choicegroup_t *p; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + if( p->time > 0 ) { p->time--; @@ -83,21 +129,27 @@ void eventWidgetChoicegroup(widget_choicegroup_t *p) getMousePosition(&x, &y); - if( x >= p->x && x <= p->x+WIDGET_CHOICEGROUP_WIDTH && - y >= p->y && y <= p->y+WIDGET_CHOICEGROUP_HEIGHT && + if( x >= widget->x && x <= widget->x+WIDGET_CHOICEGROUP_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_CHOICEGROUP_HEIGHT && isMouseClicked() ) { - setActive(p); + setWidgetChoiceActive(widget); } } -void destroyWidgetChoicegroup(widget_choicegroup_t *p) +void destroyWidgetChoicegroup(widget_t *widget) { + widget_choicegroup_t *p; int index; - index = searchListItem(p->list, p); + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_CHOICE ); + + p = (widget_choicegroup_t *) widget->private_data; + index = searchListItem(p->list, widget); assert( index != -1 ); delList(p->list, index); free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_choicegroup.h b/src/widget/widget_choicegroup.h index 93d88fc..05e6532 100644 --- a/src/widget/widget_choicegroup.h +++ b/src/widget/widget_choicegroup.h @@ -5,6 +5,7 @@ #include "main.h" #include "list.h" +#include "widget.h" #define WIDGET_CHOICEGROUP_TIME_SWITCH_STATUS 5 @@ -13,19 +14,21 @@ typedef struct widget_choicegroup { - int x, y; bool_t status; int time; void (*fce_event)(void *); list_t *list; } widget_choicegroup_t; -extern widget_choicegroup_t* newWidgetChoicegroup(int x, int y, bool_t status, +extern widget_t* newWidgetChoicegroup(int x, int y, bool_t status, list_t *list, void (*fce_event)(void *)); -extern void drawWidgetChoicegroup(widget_choicegroup_t *p); -extern void eventWidgetChoicegroup(widget_choicegroup_t *p); -extern void destroyWidgetChoicegroup(widget_choicegroup_t *p); +extern void drawWidgetChoicegroup(widget_t *p); +extern void setWidgetChoiceActive(widget_t *widget); +extern bool_t getWidgetChoiceStatus(widget_t *widget); +extern void setWidgetChoiceStatus(widget_t *widget, bool_t status); +extern void eventWidgetChoicegroup(widget_t *p); +extern void destroyWidgetChoicegroup(widget_t *p); #endif diff --git a/src/widget/widget_image.c b/src/widget/widget_image.c index 8be8080..926a714 100644 --- a/src/widget/widget_image.c +++ b/src/widget/widget_image.c @@ -1,35 +1,52 @@ #include <stdlib.h> +#include <assert.h> #include <stdlib.h> #include "main.h" #include "image.h" #include "interface.h" #include "font.h" + +#include "widget.h" #include "widget_image.h" -widget_image_t* newWidgetImage(int x, int y, image_t *image) +widget_t* newWidgetImage(int x, int y, image_t *image) { widget_image_t *new; new = malloc( sizeof(widget_image_t) ); - new->x = x; - new->y = y; new->image = image; - return new; + return newWidget(WIDGET_TYPE_IMAGE, x, y, image->w, image->h, new); } -void drawWidgetImage(widget_image_t *p) +void drawWidgetImage(widget_t *widget) { - drawImage(p->image, p->x, p->y, 0, 0, p->image->w, p->image->h); + widget_image_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_IMAGE ); + + p = (widget_image_t *) widget->private_data; + drawImage(p->image, widget->x, widget->y, 0, 0, p->image->w, p->image->h); } -void eventWidgetImage(widget_image_t *p) +void eventWidgetImage(widget_t *widget) { + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_IMAGE ); } -void destroyWidgetImage(widget_image_t *p) +void destroyWidgetImage(widget_t *widget) { + widget_image_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_IMAGE ); + + p = (widget_image_t *) widget->private_data; + free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_image.h b/src/widget/widget_image.h index 8a038da..6f661e4 100644 --- a/src/widget/widget_image.h +++ b/src/widget/widget_image.h @@ -5,17 +5,17 @@ #include "main.h" #include "interface.h" +#include "widget.h" typedef struct widget_image { - int x, y; image_t *image; } widget_image_t; -extern widget_image_t* newWidgetImage(int x, int y, image_t *image); -extern void drawWidgetImage(widget_image_t *p); -extern void eventWidgetImage(widget_image_t *p); -extern void destroyWidgetImage(widget_image_t *p); +extern widget_t* newWidgetImage(int x, int y, image_t *image); +extern void drawWidgetImage(widget_t *p); +extern void eventWidgetImage(widget_t *p); +extern void destroyWidgetImage(widget_t *p); #endif diff --git a/src/widget/widget_label.c b/src/widget/widget_label.c index 15dea4d..c0b3f35 100644 --- a/src/widget/widget_label.c +++ b/src/widget/widget_label.c @@ -1,47 +1,65 @@ #include <stdlib.h> +#include <assert.h> #include "main.h" #include "interface.h" #include "font.h" #include "widget_label.h" +#include "widget.h" -widget_label_t* newWidgetLabel(char *text, int x, int y, int bind) +widget_t* newWidgetLabel(char *text, int x, int y, int bind) { widget_label_t *new; new = malloc( sizeof(widget_label_t) ); new->text = strdup(text); - new->x = x; - new->y = y; new->bind = bind; - getTextSize(text, &new->w, &new->h); + getTextSize(text, &(new->w), &(new->h)); - return new; + return newWidget(WIDGET_TYPE_LABEL, x, y, new->w, new->h, new); } -void drawWidgetLabel(widget_label_t *p) +void drawWidgetLabel(widget_t *widget) { + widget_label_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_LABEL ); + + p = (widget_label_t *) widget->private_data; + switch( p->bind ) { case WIDGET_LABEL_RIGHT : - drawFont(p->text, p->x+p->w, p->y + p->h/2, COLOR_WHITE); + drawFont(p->text, widget->x+p->w, widget->y + p->h/2, COLOR_WHITE); break; case WIDGET_LABEL_LEFT : - drawFont(p->text, p->x, p->y + p->h/2, COLOR_WHITE); + drawFont(p->text, widget->x, widget->y + widget->h/2, COLOR_WHITE); break; case WIDGET_LABEL_CENTER : - drawFont(p->text, p->x-p->w/2, p->y + p->h/2, COLOR_WHITE); + drawFont(p->text, widget->x-p->w/2, widget->y + p->h/2, COLOR_WHITE); break; } } -void eventWidgetLabel(widget_label_t *p) +void eventWidgetLabel(widget_t *widget) { + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_LABEL ); } -void destroyWidgetLabel(widget_label_t *p) +void destroyWidgetLabel(widget_t *widget) { + widget_label_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_LABEL ); + + p = (widget_label_t *) widget->private_data; + free(p->text); free(p); + + destroyWidget(widget); } diff --git a/src/widget/widget_label.h b/src/widget/widget_label.h index f976bbc..0893d68 100644 --- a/src/widget/widget_label.h +++ b/src/widget/widget_label.h @@ -4,10 +4,10 @@ #define WIDGET_LABEL_H #include "main.h" +#include "widget.h" typedef struct widget_label { - int x, y; int w, h; char *text; int bind; @@ -17,10 +17,9 @@ typedef struct widget_label #define WIDGET_LABEL_LEFT 2 #define WIDGET_LABEL_CENTER 3 -extern widget_label_t* newWidgetLabel(char *text, int x, int y, int bind); -extern void drawWidgetLabel(widget_label_t *p); -extern void eventWidgetLabel(widget_label_t *p); -extern void destroyWidgetLabel(widget_label_t *p); +extern widget_t* newWidgetLabel(char *text, int x, int y, int bind); +extern void drawWidgetLabel(widget_t *widget); +extern void eventWidgetLabel(widget_t *widget); +extern void destroyWidgetLabel(widget_t *widget); #endif - diff --git a/src/widget/widget_select.c b/src/widget/widget_select.c index 3ab5638..0ec90c1 100644 --- a/src/widget/widget_select.c +++ b/src/widget/widget_select.c @@ -1,36 +1,35 @@ #include <stdlib.h> +#include <assert.h> + #include "main.h" #include "interface.h" #include "font.h" + +#include "widget.h" #include "widget_select.h" -/* -typedef struct widget_select -{ - int x, y; - int w, h; - list_t *list; - void (*fce_event)(void *); -} widget_select_t; -*/ - -widget_select_t* newWidgetSelect(int x, int y, void (*fce_event)(void *)) +widget_t* newWidgetSelect(int x, int y, void (*fce_event)(void *)) { widget_select_t *new; new = malloc( sizeof(widget_select_t) ); - new->x = x; - new->y = y; new->select = -1; new->fce_event = fce_event; new->list = newList(); - return new; + return newWidget(WIDGET_TYPE_SELECT, x, y, 0, 0, new); } -char* getWidgetSelectItem(widget_select_t *p) +char* getWidgetSelectItem(widget_t *widget) { + widget_select_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; + if( p->select == -1 ) { return NULL; @@ -39,25 +38,56 @@ char* getWidgetSelectItem(widget_select_t *p) return (char *)p->list->list[p->select]; } -void addToWidgetSelect(widget_select_t *p, char *s) +int getWidgetSelectIndex(widget_t *widget) +{ + widget_select_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; + + return p->select; +} + +void addToWidgetSelect(widget_t *widget, char *s) { + widget_select_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; + addList(p->list, strdup(s) ); } -void removeAllFromWidgetSelect(widget_select_t *p) +void removeAllFromWidgetSelect(widget_t *widget) { + widget_select_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; + while( p->list->count > 0 ) { delListItem(p->list, 0, free); } } -void drawWidgetSelect(widget_select_t *p) +void drawWidgetSelect(widget_t *widget) { + widget_select_t *p; int x, y, w, h; int i; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + getMousePosition(&x, &y); + p = (widget_select_t *)widget->private_data; for( i = 0 ; i < p->list->count ; i++ ) { @@ -67,29 +97,34 @@ void drawWidgetSelect(widget_select_t *p) getTextSize(line, &w, &h); - if( x > p->x && y > p->y + i*20 && x < p->x+w && y < p->y + i*20 + h ) + if( x > widget->x && y > widget->y + i*20 && x < widget->x+w && y < widget->y + i*20 + h ) { - drawFont(line, p->x, p->y + i*20, COLOR_YELLOW); + drawFont(line, widget->x, widget->y + i*20, COLOR_YELLOW); } else { if( p->select == i ) { - drawFont(line, p->x, p->y + i*20, COLOR_RED); + drawFont(line, widget->x, widget->y + i*20, COLOR_RED); } else { - drawFont(line, p->x, p->y + i*20, COLOR_WHITE); + drawFont(line, widget->x, widget->y + i*20, COLOR_WHITE); } } } } -void eventWidgetSelect(widget_select_t *p) +void eventWidgetSelect(widget_t *widget) { + widget_select_t *p; int x, y, w, h; int i; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; getMousePosition(&x, &y); for( i = 0 ; i < p->list->count ; i++ ) @@ -100,7 +135,9 @@ void eventWidgetSelect(widget_select_t *p) getTextSize(line, &w, &h); - if( x > p->x && y > p->y + i*20 && x < p->x+w && y < p->y + i*20 + h && isMouseClicked() ) + if( x > widget->x && y > widget->y + i*20 && + x < widget->x+w && y < widget->y + i*20 + h && + isMouseClicked() ) { p->select = i; p->fce_event(p); @@ -108,8 +145,16 @@ void eventWidgetSelect(widget_select_t *p) } } -void destroyWidgetSelect(widget_select_t *p) +void destroyWidgetSelect(widget_t *widget) { + widget_select_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_SELECT ); + + p = (widget_select_t *)widget->private_data; + destroyListItem(p->list, free); free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_select.h b/src/widget/widget_select.h index 0f5f712..a0be1b1 100644 --- a/src/widget/widget_select.h +++ b/src/widget/widget_select.h @@ -5,24 +5,24 @@ #include "main.h" #include "list.h" - +#include "widget.h" typedef struct widget_select { - int x, y; int w, h; list_t *list; int select; void (*fce_event)(void *); } widget_select_t; -extern widget_select_t* newWidgetSelect(int x, int y, void (*fce_event)(void *)); -extern char* getWidgetSelectItem(widget_select_t *p); -extern void addToWidgetSelect(widget_select_t *p, char *s); -extern void removeAllFromWidgetSelect(widget_select_t *p); -extern void drawWidgetSelect(widget_select_t *p); -extern void eventWidgetSelect(widget_select_t *p); -extern void destroyWidgetSelect(widget_select_t *p); +extern widget_t* newWidgetSelect(int x, int y, void (*fce_event)(void *)); +extern char* getWidgetSelectItem(widget_t *widget); +extern int getWidgetSelectIndex(widget_t *widget); +extern void addToWidgetSelect(widget_t *widget, char *s); +extern void removeAllFromWidgetSelect(widget_t *widget); +extern void drawWidgetSelect(widget_t *widget); +extern void eventWidgetSelect(widget_t *widget); +extern void destroyWidgetSelect(widget_t *widget); #endif diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c index ee1cf76..0e5576b 100644 --- a/src/widget/widget_textfield.c +++ b/src/widget/widget_textfield.c @@ -1,14 +1,18 @@ #include <stdlib.h> +#include <assert.h> + #include "main.h" #include "interface.h" #include "font.h" #include "image.h" + +#include "widget.h" #include "widget_textfield.h" //#define ZZEEXX86_READKEY -widget_textfield_t* newWidgetTextfield(char *text, int filter, int x, int y) +widget_t* newWidgetTextfield(char *text, int filter, int x, int y) { widget_textfield_t *new; @@ -16,8 +20,6 @@ widget_textfield_t* newWidgetTextfield(char *text, int filter, int x, int y) memset(new, 0, sizeof(widget_textfield_t)); strcpy(new->text, text); - new->x = x; - new->y = y; new->time = 0; new->timeBlick = 0; new->atime = 0; @@ -25,16 +27,19 @@ widget_textfield_t* newWidgetTextfield(char *text, int filter, int x, int y) new->filter = filter; getTextSize(text, &new->w, &new->h); - return new; + return newWidget(WIDGET_TYPE_TEXTFILED, x, y, WIDGET_TEXTFIELD_WIDTH, WIDGET_TEXTFIELD_HEIGHT, new); } -static void drawBackground(widget_textfield_t *p) +static void drawBackground(widget_t *widget) { static image_t *g_textfield0 = NULL; static image_t *g_textfield1 = NULL; - //int x, y; + widget_textfield_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); - //getMousePosition(&x, &y); + p = (widget_textfield_t *) widget->private_data; if( g_textfield0 == NULL ) { @@ -48,17 +53,23 @@ static void drawBackground(widget_textfield_t *p) if( p->active ) { - drawImage(g_textfield1, p->x, p->y, 0, 0, g_textfield1->w, g_textfield1->h); + drawImage(g_textfield1, widget->x, widget->y, 0, 0, g_textfield1->w, g_textfield1->h); } else { - drawImage(g_textfield0, p->x, p->y, 0, 0, g_textfield0->w, g_textfield0->h); + drawImage(g_textfield0, widget->x, widget->y, 0, 0, g_textfield0->w, g_textfield0->h); } } -static void drawText(widget_textfield_t *p) +static void drawText(widget_t *widget) { char str[STR_SIZE]; + widget_textfield_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + p = (widget_textfield_t *) widget->private_data; strcpy(str, p->text); @@ -77,23 +88,48 @@ static void drawText(widget_textfield_t *p) } //drawFont(str, p->x+WIDGET_TEXTFIELD_TEXT_OFFSET_X, p->y+p->h/2, COLOR_WHITE); - drawFont(str, p->x+WIDGET_TEXTFIELD_TEXT_OFFSET_X, p->y+WIDGET_TEXTFIELD_HEIGHT/2-p->h/2, COLOR_WHITE); //printf("p->y: %d\nheight: %d\n p->h: %d\n", p->y, WIDGET_TEXTFIELD_HEIGHT, p->h); + + drawFont(str, + widget->x+WIDGET_TEXTFIELD_TEXT_OFFSET_X, + widget->y+WIDGET_TEXTFIELD_HEIGHT/2-p->h/2, + COLOR_WHITE); } -void drawWidgetTextfield(widget_textfield_t *p) +void drawWidgetTextfield(widget_t *widget) { - drawBackground(p); - drawText(p); + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + drawBackground(widget); + drawText(widget); } -void setWidgetTextFiledText(widget_textfield_t *p, char *text) +void setWidgetTextFiledText(widget_t *widget, char *text) { + widget_textfield_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + p = (widget_textfield_t *) widget->private_data; + memset(p->text, 0, STR_SIZE); strcpy(p->text, text); getTextSize(text, &p->w, &p->h); } +char* getTextFromWidgetTextfield(widget_t *widget) +{ + widget_textfield_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + p = (widget_textfield_t *) widget->private_data; + return p->text; +} + static void checkText(widget_textfield_t *p) { int len; @@ -408,16 +444,22 @@ static void readKey(widget_textfield_t *p) } #endif -void eventWidgetTextfield(widget_textfield_t *p) +void eventWidgetTextfield(widget_t *widget) { + widget_textfield_t *p; int x, y; + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + p = (widget_textfield_t *) widget->private_data; + getMousePosition(&x, &y); if( isMouseClicked() ) { - if( x >= p->x && x <= p->x+WIDGET_TEXTFIELD_WIDTH && - y >= p->y && y <= p->y+WIDGET_TEXTFIELD_HEIGHT ) + if( x >= widget->x && x <= widget->x+WIDGET_TEXTFIELD_WIDTH && + y >= widget->y && y <= widget->y+WIDGET_TEXTFIELD_HEIGHT ) { p->active = TRUE; } @@ -430,8 +472,16 @@ void eventWidgetTextfield(widget_textfield_t *p) readKey(p); } -void destroyWidgetTextfield(widget_textfield_t *p) +void destroyWidgetTextfield(widget_t *widget) { + widget_textfield_t *p; + + assert( widget != NULL ); + assert( widget->type == WIDGET_TYPE_TEXTFILED ); + + p = (widget_textfield_t *) widget->private_data; + free(p); + destroyWidget(widget); } diff --git a/src/widget/widget_textfield.h b/src/widget/widget_textfield.h index 11b135c..00a147b 100644 --- a/src/widget/widget_textfield.h +++ b/src/widget/widget_textfield.h @@ -4,6 +4,7 @@ #define WIDGET_TEXTFIELD_H #include "main.h" +#include "widget.h" #define WIDGET_TEXTFIELD_WIDTH 175 #define WIDGET_TEXTFIELD_HEIGHT 36 @@ -21,7 +22,6 @@ typedef struct widget_textfield { - int x, y; int w, h; int canWrite; int timeBlick; @@ -32,11 +32,12 @@ typedef struct widget_textfield bool_t active; } widget_textfield_t; -extern widget_textfield_t* newWidgetTextfield(char *text, int filter, int x, int y); -extern void setWidgetTextFiledText(widget_textfield_t *p, char *text); -extern void drawWidgetTextfield(widget_textfield_t *p); -extern void eventWidgetTextfield(widget_textfield_t *p); -extern void destroyWidgetTextfield(widget_textfield_t *p); +extern widget_t* newWidgetTextfield(char *text, int filter, int x, int y); +extern void setWidgetTextFiledText(widget_t *widget, char *text); +extern char* getTextFromWidgetTextfield(widget_t *widget); +extern void drawWidgetTextfield(widget_t *widget); +extern void eventWidgetTextfield(widget_t *widget); +extern void destroyWidgetTextfield(widget_t *widget); #endif |