/** * @brief Runs a dialogue with both yes and no options. * * @param caption Caption to use for the dialogue. * @param msg Message to display. * @return 1 if yes is clicked or 0 if no is clicked. */ int dialogue_YesNoRaw( const char* caption, const char *msg ) { unsigned int wid; int w,h; glFont* font; int done[2]; font = dialogue_getSize( caption, msg, &w, &h ); /* create window */ wid = window_create( caption, -1, -1, w, h+110 ); window_setData( wid, &done ); /* text */ window_addText( wid, 20, -40, w-40, h, 0, "txtYesNo", font, &cBlack, msg ); /* buttons */ window_addButtonKey( wid, w/2-50-10, 20, 50, 30, "btnYes", "Yes", dialogue_YesNoClose, SDLK_y ); window_addButtonKey( wid, w/2+10, 20, 50, 30, "btnNo", "No", dialogue_YesNoClose, SDLK_n ); /* tricky secondary loop */ dialogue_open++; done[1] = -1; /* Default to negative. */ toolkit_loop( done ); /* Close the dialogue. */ dialogue_close( wid, NULL ); /* return the result */ return done[1]; }
static void dialogue_listClose( unsigned int wid, char* str ) { dialogue_listSelected = toolkit_getListPos( wid, "lstDialogue" ); dialogue_close( wid, str ); }