diff --git a/src/libs/tgfclient/gui.h b/src/libs/tgfclient/gui.h index 8f05e6e25..b6d09d852 100644 --- a/src/libs/tgfclient/gui.h +++ b/src/libs/tgfclient/gui.h @@ -62,12 +62,12 @@ Color GetColor(const float* color); typedef struct { char *text; /* text */ - Color bgColor; /* RGBA */ - Color fgColor; + Color bgColor; /* RGBA */ + Color fgColor; GfuiFontClass *font; /* ttf font */ - int x, y; /* label position */ - int align; - int maxlen; + int x, y; /* label position */ + int align; + int maxlen; } tGfuiLabel; /* button state */ @@ -195,11 +195,12 @@ typedef struct typedef struct { int labelId; + int leftButtonId, rightButtonId; void *scr; tComboBoxInfo *pInfo; - Color fgColor[3]; - int comboType; + Color fgColor[3]; + int comboType; tfuiComboboxCallback onChange; } tGfuiCombobox; @@ -209,7 +210,7 @@ typedef struct void *scr; tCheckBoxInfo *pInfo; - Color fgColor[3]; + Color fgColor[3]; int checkId; int uncheckId; diff --git a/src/libs/tgfclient/guicombobox.cpp b/src/libs/tgfclient/guicombobox.cpp index a761f19c7..499a5e6bd 100644 --- a/src/libs/tgfclient/guicombobox.cpp +++ b/src/libs/tgfclient/guicombobox.cpp @@ -166,25 +166,27 @@ 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", - "data/img/arrow-left.png", "data/img/arrow-left-pushed.png", - xmin, ym, GFUI_ALIGN_HL_VC, GFUI_MOUSE_UP, - (void*)(object->id), gfuiLeftArrow, - NULL, (tfuiCallback)NULL, (tfuiCallback)NULL); + // 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", + 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", - "data/img/arrow-right.png", "data/img/arrow-right-pushed.png", - xmax,ym, GFUI_ALIGN_HR_VC, GFUI_MOUSE_UP, - (void*)(object->id), gfuiRightArrow, - NULL, (tfuiCallback)NULL, (tfuiCallback)NULL); + // 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", + object->xmax, ym, GFUI_ALIGN_HR_VC, GFUI_MOUSE_UP, + (void*)(object->id), gfuiRightArrow, + NULL, (tfuiCallback)NULL, (tfuiCallback)NULL); gfuiAddObject(screen, object); diff --git a/src/libs/tgfclient/guiobject.cpp b/src/libs/tgfclient/guiobject.cpp index 259d0e610..f73ad1e4e 100644 --- a/src/libs/tgfclient/guiobject.cpp +++ b/src/libs/tgfclient/guiobject.cpp @@ -483,14 +483,24 @@ GfuiEnable(void *scr, int id, int flag) return -1; } - if (curObject->widget == GFUI_BUTTON) + switch (curObject->widget) { - if (curObject->state == GFUI_DISABLE) - curObject->u.button.state = GFUI_BTN_RELEASED; - else - curObject->u.button.state = GFUI_BTN_RELEASED; - } + case GFUI_BUTTON: + if (curObject->state == GFUI_DISABLE) + 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; }