Fixed ComboBox enable/disable support + Button disabled state

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2614 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 874a6d4af5f0c12c01be6c21f81f3b33c70efd12
Former-commit-id: 5e05d2b682cad5ed862516477f38bcf196e35094
This commit is contained in:
pouillot 2010-08-05 12:50:35 +00:00
parent 38c0ed6634
commit 1154b49798
3 changed files with 40 additions and 27 deletions

View file

@ -195,6 +195,7 @@ typedef struct
typedef struct
{
int labelId;
int leftButtonId, rightButtonId;
void *scr;
tComboBoxInfo *pInfo;

View file

@ -166,23 +166,25 @@ GfuiComboboxCreate(void *scr, int font, int x, int y, int width,
break;
}
//Create text
// Create label control.
int xm = object->xmin + (object->xmax-object->xmin)/2;
int ym = object->ymin + (object->ymax-object->ymin)/2;
int xmax = object->xmax;
int xmin = object->xmin;
combobox->labelId = GfuiLabelCreate(scr, pszText, font, xm, ym, GFUI_ALIGN_HC_VC, 99);
GfuiGrButtonCreate(scr, "data/img/arrow-left.png", "data/img/arrow-left.png",
// Create the left arrow button control.
combobox->leftButtonId =
GfuiGrButtonCreate(scr, "data/img/arrow-left-disabled.png", "data/img/arrow-left.png",
"data/img/arrow-left.png", "data/img/arrow-left-pushed.png",
xmin, ym, GFUI_ALIGN_HL_VC, GFUI_MOUSE_UP,
object->xmin, ym, GFUI_ALIGN_HL_VC, GFUI_MOUSE_UP,
(void*)(object->id), gfuiLeftArrow,
NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
GfuiGrButtonCreate(scr, "data/img/arrow-right.png", "data/img/arrow-right.png",
// Create the right arrow button control.
combobox->rightButtonId =
GfuiGrButtonCreate(scr, "data/img/arrow-right-disabled.png", "data/img/arrow-right.png",
"data/img/arrow-right.png", "data/img/arrow-right-pushed.png",
xmax,ym, GFUI_ALIGN_HR_VC, GFUI_MOUSE_UP,
object->xmax, ym, GFUI_ALIGN_HR_VC, GFUI_MOUSE_UP,
(void*)(object->id), gfuiRightArrow,
NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);

View file

@ -483,14 +483,24 @@ GfuiEnable(void *scr, int id, int flag)
return -1;
}
if (curObject->widget == GFUI_BUTTON)
switch (curObject->widget)
{
case GFUI_BUTTON:
if (curObject->state == GFUI_DISABLE)
curObject->u.button.state = GFUI_BTN_RELEASED;
curObject->u.button.state = GFUI_BTN_DISABLE;
else
curObject->u.button.state = GFUI_BTN_RELEASED;
}
break;
case GFUI_COMBOBOX:
GfuiEnable(scr, curObject->u.combobox.leftButtonId, flag);
GfuiEnable(scr, curObject->u.combobox.rightButtonId, flag);
GfuiEnable(scr, curObject->u.combobox.labelId, flag);
break;
default:
break;
}
return 0;
}