diff options
| author | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:53:48 +0200 |
|---|---|---|
| committer | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:53:48 +0200 |
| commit | 130d45bfc935da1702a7b5c246a099ea3b4a0bdf (patch) | |
| tree | 5cc4b029f24e7a3cfaf1fcbc671772059a9b8e73 /src/widget/widget_label.c | |
| parent | 44daf03024fbf7cbffa10349044786f6ab784821 (diff) | |
Ident all code correctly.
Diffstat (limited to 'src/widget/widget_label.c')
| -rw-r--r-- | src/widget/widget_label.c | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/src/widget/widget_label.c b/src/widget/widget_label.c index c0b3f35..449f916 100644 --- a/src/widget/widget_label.c +++ b/src/widget/widget_label.c @@ -8,58 +8,63 @@ #include "widget_label.h" #include "widget.h" -widget_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; + widget_label_t *new; - new = malloc( sizeof(widget_label_t) ); - new->text = strdup(text); - new->bind = bind; - getTextSize(text, &(new->w), &(new->h)); + new = malloc(sizeof(widget_label_t)); + new->text = strdup(text); + new->bind = bind; + getTextSize(text, &(new->w), &(new->h)); - return newWidget(WIDGET_TYPE_LABEL, x, y, new->w, new->h, new); + return newWidget(WIDGET_TYPE_LABEL, x, y, new->w, new->h, new); } -void drawWidgetLabel(widget_t *widget) +void +drawWidgetLabel(widget_t * widget) { - widget_label_t *p; + widget_label_t *p; - assert( widget != NULL ); - assert( widget->type == WIDGET_TYPE_LABEL ); + assert(widget != NULL); + assert(widget->type == WIDGET_TYPE_LABEL); - p = (widget_label_t *) widget->private_data; + p = (widget_label_t *) widget->private_data; - switch( p->bind ) - { - case WIDGET_LABEL_RIGHT : - drawFont(p->text, widget->x+p->w, widget->y + p->h/2, COLOR_WHITE); - break; - case WIDGET_LABEL_LEFT : - drawFont(p->text, widget->x, widget->y + widget->h/2, COLOR_WHITE); - break; - case WIDGET_LABEL_CENTER : - drawFont(p->text, widget->x-p->w/2, widget->y + p->h/2, COLOR_WHITE); - break; - } + switch (p->bind) { + case WIDGET_LABEL_RIGHT: + drawFont(p->text, widget->x + p->w, widget->y + p->h / 2, + COLOR_WHITE); + break; + case WIDGET_LABEL_LEFT: + drawFont(p->text, widget->x, widget->y + widget->h / 2, COLOR_WHITE); + break; + case WIDGET_LABEL_CENTER: + drawFont(p->text, widget->x - p->w / 2, widget->y + p->h / 2, + COLOR_WHITE); + break; + } } -void eventWidgetLabel(widget_t *widget) +void +eventWidgetLabel(widget_t * widget) { - assert( widget != NULL ); - assert( widget->type == WIDGET_TYPE_LABEL ); + assert(widget != NULL); + assert(widget->type == WIDGET_TYPE_LABEL); } -void destroyWidgetLabel(widget_t *widget) +void +destroyWidgetLabel(widget_t * widget) { - widget_label_t *p; + widget_label_t *p; - assert( widget != NULL ); - assert( widget->type == WIDGET_TYPE_LABEL ); + assert(widget != NULL); + assert(widget->type == WIDGET_TYPE_LABEL); - p = (widget_label_t *) widget->private_data; + p = (widget_label_t *) widget->private_data; - free(p->text); - free(p); + free(p->text); + free(p); - destroyWidget(widget); + destroyWidget(widget); } |