void ui_dialog(int dialog_text_id, int button_text_id, float hide_after) { set_dialog_text(dialog_text_id); if (button_text_id != UI_BUTTON_NONE) { set_button_text(button_text_id); show_button(); } else { hide_button(); } show_dialog(); if (hide_after > 0) { hide_dialog_later(hide_after); } }
static int alphabet_game_paint(p_void_data_t p_void_data, rect_t *p_rect, int index, bool sel_flag) { alphabet_game_t *ag=(alphabet_game_t *)p_void_data; rect_t *rct=p_rect; screen_t *scr=NULL; if((NULL==ag)||(NULL==rct)){ return RET_FAILED; } scr=&ag->scr; if((NULL==scr)){ return RET_FAILED; } show_button(scr,rct->top,rct->left,sel_flag,alphabet_game_res[index].pdata,A_BOLD); return RET_SUCCESS; }
static int alphabet_game_help_paint(p_void_data_t p_void_data, rect_t *p_rect,int index, bool sel_flag) { //printf("I'm %s() at %d in %s\n",__func__,__LINE__,__FILE__); alphabet_game_t *ag=(alphabet_game_t *)p_void_data; rect_t *rct=p_rect; screen_t *scr=NULL; if((NULL==ag)||(NULL==rct)){ return RET_FAILED; } scr=&ag->scr; if((NULL==scr)){ return RET_FAILED; } show_button(scr,rct->top,rct->left,sel_flag,alphabet_game_help_res[index].pdata,A_BOLD); return RET_SUCCESS; }
int fw_msgbox(char *title, char *msg, int flag) { int x,y; x = ((gfx->win->res_w - MB_WIDTH) / 2); y = ((gfx->win->res_h - MB_HEIGHT) / 2); gfx->win->text = load_string(title, FONT, 13); gfx->win->dest.w = MB_WIDTH + 2; gfx->win->dest.h = MB_HEIGHT + 2; gfx->win->img = SDL_CreateRGBSurface(SDL_HWSURFACE, gfx->win->dest.w, gfx->win->dest.h, gfx->bpp, gfx->win->sdlMainScreen->format->Rmask, gfx->win->sdlMainScreen->format->Gmask, gfx->win->sdlMainScreen->format->Bmask, gfx->win->sdlMainScreen->format->Amask); SDL_SetColorKey(gfx->win->img, SDL_SRCCOLORKEY,0); SDL_FillRect(gfx->win->img, NULL, SDL_MapRGB(gfx->win->sdlMainScreen->format,208,208,208)); gfx->win->dest.x = 1; gfx->win->dest.y = 1; gfx->win->dest.h = MB_HEIGHT; gfx->win->dest.w = MB_WIDTH; SDL_FillRect(gfx->win->img, &(gfx->win->dest), SDL_MapRGB(gfx->win->sdlMainScreen->format,0,0,42)); gfx->win->dest.x = 1; gfx->win->dest.y = 21; gfx->win->dest.h = 1; gfx->win->dest.w = MB_WIDTH; SDL_FillRect(gfx->win->img, &(gfx->win->dest), SDL_MapRGB(gfx->win->sdlMainScreen->format,208,208,208)); gfx->win->dest.x = x; gfx->win->dest.y = y; aff_surf(gfx->win->img, 255); SDL_FreeSurface(gfx->win->img); gfx->win->dest.x = x + 3; gfx->win->dest.y = y + 2; aff_surf(gfx->win->text, 255); SDL_FreeSurface(gfx->win->text); gfx->win->text = load_string(msg, FONT, 14); gfx->win->dest.x = x + 7; gfx->win->dest.y = y + 24; aff_surf(gfx->win->text, 255); SDL_FreeSurface(gfx->win->text); if (flag == MB_OKCANCEL) { show_button(x, y, "OK", 0, "AFirstChaos/img/menu/mb_button.png"); show_button(x, y, "Cancel", 2, "AFirstChaos/img/menu/mb_button.png"); } else if (flag == MB_YESNO) { show_button(x, y, "Yes", 0, "AFirstChaos/img/menu/mb_button.png"); show_button(x, y, "No", 2, "AFirstChaos/img/menu/mb_button.png"); } else if (flag == MB_YESNOCANCEL) { show_button(x, y, "Yes", 0, "AFirstChaos/img/menu/mb_button.png"); show_button(x, y, "No", 1, "AFirstChaos/img/menu/mb_button.png"); show_button(x, y, "Cancel", 2, "AFirstChaos/img/menu/mb_button.png"); } else { show_button(x, y, "OK", 1, "AFirstChaos/img/menu/mb_button.png"); flag = MB_INFO; } return (get_choice(x, y, flag)); }
YourButtonForm::YourButtonForm( QWidget* parent, const char* name, WFlags fl):YourButtonBaseForm(parent, name, fl) { timer = new QTimer(this); connect (timer, SIGNAL(timeout()), this, SLOT(show_button())); timer -> start(10); }