diff options
| author | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
|---|---|---|
| committer | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
| commit | 44daf03024fbf7cbffa10349044786f6ab784821 (patch) | |
| tree | fe311eb22e2d853dfc18fde1a9e55d21815f4f82 /src/widget/widget_choicegroup.c~ | |
| parent | e12753d2ec9db83ec08bb9db63902a82fb245cdd (diff) | |
Revert "X"
This reverts commit e12753d2ec9db83ec08bb9db63902a82fb245cdd.
Diffstat (limited to 'src/widget/widget_choicegroup.c~')
| -rw-r--r-- | src/widget/widget_choicegroup.c~ | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/src/widget/widget_choicegroup.c~ b/src/widget/widget_choicegroup.c~ deleted file mode 100644 index fc4fd01..0000000 --- a/src/widget/widget_choicegroup.c~ +++ /dev/null @@ -1,155 +0,0 @@ - -#include <stdlib.h> -#include <assert.h> - -#include "main.h" -#include "interface.h" -#include "image.h" - -#include "widget.h" -#include "widget_choicegroup.h" - -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->time = 0; - new->status = status; - new->fce_event = fce_event; - new->list = list; - - widget = newWidget(WIDGET_TYPE_CHOICE, x, y, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT, new); - addList(new->list, widget); - - return widget; -} - -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("choice.png", IMAGE_ALPHA, "choicegroup", IMAGE_GROUP_BASE); - } - - if( p->status == TRUE ) - { - offset = 0; - } - else - { - offset = WIDGET_CHOICEGROUP_WIDTH; - } - - drawImage(g_choicegroup, widget->x, widget->y, offset, 0, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT); -} - -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_t *this; - widget_choicegroup_t *thisChoice; - - this = (widget_t *) p->list->list[i]; - thisChoice = (widget_choicegroup_t *) this->private_data; - - if( widget == this ) - { - thisChoice->status = TRUE; - thisChoice->time = WIDGET_CHOICEGROUP_TIME_SWITCH_STATUS; - thisChoice->fce_event(p); - } - else - { - thisChoice->status = FALSE; - } - } -} - -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--; - return; - } - - getMousePosition(&x, &y); - - if( x >= widget->x && x <= widget->x+WIDGET_CHOICEGROUP_WIDTH && - y >= widget->y && y <= widget->y+WIDGET_CHOICEGROUP_HEIGHT && - isMouseClicked() ) - { - setWidgetChoiceActive(widget); - } -} - -void destroyWidgetChoicegroup(widget_t *widget) -{ - widget_choicegroup_t *p; - int index; - - 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); -} |