int MenuSettingsTheme() { int menu = MENU_NONE; int ret = -1; int activated = -1; int i = 0; int focus = 0; OptionList options; sprintf(options.name[i], tr("STANDARD")); if(stricmp(Options.temp_theme.c_str(), tr("STANDARD")) == 0) { sprintf (options.value[i], tr("activated")); activated = i; } else sprintf (options.value[i], " "); i++; DIR *dirHandle; struct dirent * dirEntry; dirHandle = opendir(check_path(Settings.device_dat + ":/config/HBF/Themes").c_str()); if (dirHandle) { while (0 != (dirEntry = readdir(dirHandle))) { if(stricmp(dirEntry->d_name, ".") != 0 && stricmp(dirEntry->d_name, "..") != 0) { sprintf(options.name[i], dirEntry->d_name); if(stricmp(Options.temp_theme.c_str(), dirEntry->d_name) == 0) { sprintf (options.value[i], tr("activated")); activated = i; } else sprintf (options.value[i], " "); i++; } } closedir(dirHandle); } options.length = i; GuiImageData bgImgData(Theme.background); GuiImageData btnOutline(Theme.button_small); GuiImageData btnOutlineOver(Theme.button_small_focus); GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiImage bgImg(&bgImgData); GuiText titleTxt(tr("Themes"), 28, (GXColor){Theme.title_1, Theme.title_2, Theme.title_3, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); GuiText downloadBtnTxt(tr("Download"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage downloadBtnImg(&btnOutline); GuiImage downloadBtnImgOver(&btnOutlineOver); GuiButton downloadBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); downloadBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); downloadBtn.SetPosition(-100, 38); downloadBtn.SetLabel(&downloadBtnTxt); downloadBtn.SetImage(&downloadBtnImg); downloadBtn.SetImageOver(&downloadBtnImgOver); downloadBtn.SetTrigger(&trigA); downloadBtn.SetEffectGrow(); GuiText okBtnTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage okBtnImg(&btnOutline); GuiImage okBtnImgOver(&btnOutlineOver); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetPosition(100, -35); okBtn.SetLabel(&okBtnTxt); okBtn.SetImage(&okBtnImg); okBtn.SetImageOver(&okBtnImgOver); okBtn.SetTrigger(&trigA); okBtn.SetEffectGrow(); GuiText backBtnTxt(tr("Stop"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage backBtnImg(&btnOutline); GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); backBtn.SetPosition(-100, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); backBtn.SetTrigger(&trigA); backBtn.SetEffectGrow(); GuiOptionBrowser optionBrowser(552, 248, &options); optionBrowser.SetPosition(0, 108); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser.Col1Scroll(280); optionBrowser.SetCol2Position(340); HaltGui(); GuiWindow w(screenwidth, screenheight); w.Append(&bgImg); w.Append(&titleTxt); w.Append(&downloadBtn); w.Append(&okBtn); w.Append(&backBtn); mainWindow->Append(&w); mainWindow->Append(&optionBrowser); mainWindow->ChangeFocus(&optionBrowser); ResumeGui(); while(menu == MENU_NONE) { usleep(100); ret = optionBrowser.GetClickedOption(); if(ret != -1) { for(i=0; i < options.length; i++) { if(i == ret) { sprintf (options.value[i], tr("activated")); activated = i; } else sprintf (options.value[i], " "); } optionBrowser.TriggerUpdate(); } if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) || PAD_ButtonsDown(0) & PAD_BUTTON_B || WUPC_ButtonsDown(0) & WPAD_CLASSIC_BUTTON_B) { if(focus == 0) { focus = 1; mainWindow->ChangeFocus(&w); downloadBtn.ResetState(); okBtn.SetState(STATE_SELECTED); } else { focus = 0; mainWindow->ChangeFocus(&optionBrowser); } HaltResumeGui(); } if(downloadBtn.GetState() == STATE_CLICKED) { downloadBtn.ResetState(); string themedownload = checkThemesPrompt(); if(themedownload != "NULL") { if(theme_folder_exists(themedownload)) { themeDownload(themedownload); menu = MENU_SETTINGS_THEME; theme_dl = true; break; } } } if(okBtn.GetState() == STATE_CLICKED) { Options.temp_last_setting = 1; Options.temp_theme = options.name[activated]; menu = MENU_SETTINGS_FILE; } if(backBtn.GetState() == STATE_CLICKED) { Options.temp_last_setting = 1; menu = MENU_SETTINGS_FILE; } if(runaway == true) { Options.temp_last_setting = 1; menu = MENU_SETTINGS_FILE; } } HaltGui(); mainWindow->Remove(&optionBrowser); mainWindow->Remove(&w); return menu; }
/**************************************************************************** * OnScreenKeyboard * * Opens an on-screen keyboard window, with the data entered being stored * into the specified variable. ***************************************************************************/ void OnScreenKeyboard(char * var, u16 maxlen, bool br) { int save = -1; GuiKeyboard keyboard(var, maxlen, br); GuiImageData btnOutline(Theme.button_small); GuiImageData btnOutlineOver(Theme.button_small_focus); GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiText okBtnTxt("OK", 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage okBtnImg(&btnOutline); GuiImage okBtnImgOver(&btnOutlineOver); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetPosition(25, -25); okBtn.SetLabel(&okBtnTxt); okBtn.SetImage(&okBtnImg); okBtn.SetImageOver(&okBtnImgOver); okBtn.SetTrigger(&trigA); okBtn.SetEffectGrow(); GuiText cancelBtnTxt(tr("Stop"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage cancelBtnImg(&btnOutline); GuiImage cancelBtnImgOver(&btnOutlineOver); GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); cancelBtn.SetPosition(-25, -25); cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetImage(&cancelBtnImg); cancelBtn.SetImageOver(&cancelBtnImgOver); cancelBtn.SetTrigger(&trigA); cancelBtn.SetEffectGrow(); keyboard.Append(&okBtn); keyboard.Append(&cancelBtn); HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&keyboard); mainWindow->ChangeFocus(&keyboard); ResumeGui(); int textpointertime = 0; bool textpointerswitch = true; while(save == -1) { usleep(100); textpointertime++; if(textpointerswitch && textpointertime >= 5000) { textpointertime = 0; textpointerswitch = false; } else if(!textpointerswitch && textpointertime >= 5000) { textpointertime = 0; textpointerswitch = true; } keyboard.textpointerImg->SetVisible(textpointerswitch); if(okBtn.GetState() == STATE_CLICKED) save = 1; else if(cancelBtn.GetState() == STATE_CLICKED) save = 0; } if(save) snprintf(var, maxlen, "%s", keyboard.kbtextstr); else snprintf(var, maxlen, "%s", "NULL"); HaltGui(); mainWindow->Remove(&keyboard); mainWindow->SetState(STATE_DEFAULT); ResumeGui(); }
bool GuiBrowser(GuiWindow *mainWindow, GuiWindow *parentWindow, char *path, const char *label) { char temp[256]; char title[100]; int i; ShutoffRumble(); // populate initial directory listing if(BrowseDevice() <= 0) { WindowPrompt( "Error", "Unable to display files on selected load device", "Ok", NULL); return false; } int menu = MENU_NONE; int dev = 0; char mount[2][5] = {"SD", "USB"}; GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); if(OpenDefaultFolder() <= 0) { BrowseDevice(); bzero(temp, sizeof(temp)); } else sprintf(temp, "%s/", Settings.UserFolder); sprintf(title, "Browse files"); bzero(path, sizeof(path)); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM); GuiImageData Textbox(textbox_end_png); GuiImage TextboxImg(&Textbox); GuiButton InsertURL(TextboxImg.GetWidth(), TextboxImg.GetHeight()); GuiImageData Device(textbox_begin_png); GuiImage DeviceImg(&Device); GuiButton InsertDEV(DeviceImg.GetWidth(), DeviceImg.GetHeight()); GuiText URL(strchr(temp, '/'), 20, (GXColor){0, 0, 0, 255}); GuiText DEV("SD", 20, (GXColor){0, 0, 0, 255}); URL.SetMaxWidth(TextboxImg.GetWidth()-20); URL.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); URL.SetPosition(5,0); URL.SetScroll(SCROLL_HORIZONTAL); InsertURL.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); InsertURL.SetPosition(InsertDEV.GetWidth()/2,30); InsertURL.SetLabel(&URL); InsertURL.SetImage(&TextboxImg); InsertURL.SetSoundOver(&btnSoundOver); InsertURL.SetTrigger(&trigA); InsertDEV.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); InsertDEV.SetPosition(InsertURL.GetLeft()-InsertDEV.GetWidth()/2,30); InsertDEV.SetLabel(&DEV); InsertDEV.SetImage(&DeviceImg); InsertDEV.SetSoundOver(&btnSoundOver); InsertDEV.SetTrigger(&trigA); InsertDEV.SetEffectGrow(); GuiText titleTxt(title, 28, (GXColor){0, 0, 0, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); GuiFileBrowser fileBrowser(552, 248); fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); fileBrowser.SetPosition(0, 108); fileBrowser.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 30); GuiImageData btnOutline(button_png); GuiImageData btnOutlineOver(button_over_png); GuiText okBtnTxt(label, 24, (GXColor){0, 0, 0, 255}); GuiImage okBtnImg(&btnOutline); GuiImage okBtnImgOver(&btnOutlineOver); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetPosition(50, -35); okBtn.SetLabel(&okBtnTxt); okBtn.SetImage(&okBtnImg); okBtn.SetImageOver(&okBtnImgOver); okBtn.SetTrigger(&trigA); okBtn.SetEffectGrow(); GuiText cancelBtnTxt("Cancel", 24, (GXColor){0, 0, 0, 255}); GuiImage cancelBtnImg(&btnOutline); GuiImage cancelBtnImgOver(&btnOutlineOver); GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); cancelBtn.SetPosition(-50, -35); cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetImage(&cancelBtnImg); cancelBtn.SetImageOver(&cancelBtnImgOver); cancelBtn.SetTrigger(&trigA); cancelBtn.SetEffectGrow(); GuiWindow buttonWindow(screenwidth, screenheight); buttonWindow.Append(&okBtn); buttonWindow.Append(&cancelBtn); buttonWindow.Append(&InsertURL); buttonWindow.Append(&InsertDEV); buttonWindow.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 30); if (mainWindow) { mainWindow->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50); while(mainWindow->GetEffect() > 0) usleep(100); } HaltGui(); if (mainWindow) parentWindow->Remove(mainWindow); parentWindow->Append(&buttonWindow); parentWindow->Append(&fileBrowser); ResumeGui(); while(menu == MENU_NONE) { usleep(100); if(!strlen(URL.GetText()) || URL.GetText()[0] != '/') { sprintf(temp, "%s", rootdir); URL.SetText(strchr(temp, '/')); } if(InsertURL.GetState() == STATE_CLICKED) { URL.SetScroll(SCROLL_NONE); OnScreenKeyboard(parentWindow, strchr(temp, '/'), 256); URL.SetText(strchr(temp, '/')); URL.SetScroll(SCROLL_HORIZONTAL); InsertURL.ResetState(); } if(InsertDEV.GetState() == STATE_CLICKED) { InsertDEV.ResetState(); dev ^= 1; if(BrowseDevice(dev) <= 0) { BrowseDevice(); dev = 0; } DEV.SetText(mount[dev]); URL.SetText(""); } // update file browser based on arrow buttons // set MENU_EXIT if A button pressed on a file for(i=0; i < FILE_PAGESIZE; i++) { if(fileBrowser.fileList[i]->GetState() == STATE_CLICKED) { fileBrowser.fileList[i]->ResetState(); // check corresponding browser entry if(browserList[browser.selIndex].isdir) { if(BrowserChangeFolder()) { fileBrowser.ResetState(); fileBrowser.fileList[0]->SetState(STATE_SELECTED); fileBrowser.TriggerUpdate(); if(strlen(browser.dir) > 1) sprintf(fullpath, "%s%s/", rootdir, browser.dir+1); // print current path else sprintf(fullpath, "%s", rootdir); // print current path sprintf(temp, fullpath); URL.SetText(strchr(temp, '/')); } else { menu = MENU_HOME; break; } } else { ShutoffRumble(); // load file if(strlen(browser.dir) > 1) sprintf(fullpath, "%s%s/%s", rootdir, browser.dir+1, browserList[browser.selIndex].filename); // print current path else sprintf(fullpath, "%s%s", rootdir, browserList[browser.selIndex].filename); // print current path sprintf(temp, fullpath); URL.SetText(strchr(temp, '/')); } } } if(okBtn.GetState() == STATE_CLICKED) { sprintf(path, temp); menu = MENU_HOME; } if(cancelBtn.GetState() == STATE_CLICKED) menu = MENU_HOME; } fileBrowser.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50); buttonWindow.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50); while(buttonWindow.GetEffect() > 0) usleep(100); fileBrowser.SetVisible(false); buttonWindow.SetVisible(false); if(mainWindow) { mainWindow->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 30); parentWindow->Append(mainWindow); while(mainWindow->GetEffect() > 0) usleep(100); } HaltGui(); parentWindow->Remove(&buttonWindow); parentWindow->Remove(&fileBrowser); ResumeGui(); if (isValidPath(path)) return true; return false; }
/**************************************************************************** * MenuSettings ***************************************************************************/ int MenuSettingsNetwork() { int menu = MENU_NONE; int ret = -1; int i = 0; int focus = 0; int network = Options.temp_network; int wifigecko = Options.temp_wifigecko; int newrevtext = Options.temp_newrevtext; OptionList options; sprintf(options.name[i++], tr("Auto Connect")); sprintf(options.name[i++], tr("Enable Wifi Gecko")); sprintf(options.name[i++], tr("Update Info")); options.length = i; GuiImageData bgImgData(Theme.background); GuiImageData btnOutline(Theme.button_small); GuiImageData btnOutlineOver(Theme.button_small_focus); GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiImage bgImg(&bgImgData); GuiText titleTxt(tr("Network Settings"), 28, (GXColor){Theme.title_1, Theme.title_2, Theme.title_3, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); GuiText okBtnTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage okBtnImg(&btnOutline); GuiImage okBtnImgOver(&btnOutlineOver); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetPosition(100, -35); okBtn.SetLabel(&okBtnTxt); okBtn.SetImage(&okBtnImg); okBtn.SetImageOver(&okBtnImgOver); okBtn.SetTrigger(&trigA); okBtn.SetEffectGrow(); GuiText backBtnTxt(tr("Stop"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiImage backBtnImg(&btnOutline); GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); backBtn.SetPosition(-100, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); backBtn.SetTrigger(&trigA); backBtn.SetEffectGrow(); GuiOptionBrowser optionBrowser(552, 248, &options); optionBrowser.SetPosition(0, 108); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser.SetCol2Position(340); HaltGui(); GuiWindow w(screenwidth, screenheight); w.Append(&bgImg); w.Append(&titleTxt); w.Append(&okBtn); w.Append(&backBtn); mainWindow->Append(&w); mainWindow->Append(&optionBrowser); mainWindow->ChangeFocus(&optionBrowser); ResumeGui(); int change = 0; while(menu == MENU_NONE) { usleep(100); ret = optionBrowser.GetChangedOption(); if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT) || PAD_ButtonsDown(0) & PAD_BUTTON_RIGHT) { change = 0; switch (ret) { case 0: change = network; change++; if(change > 1) change = 1; network = change; break; case 1: change = wifigecko; change++; if(change > 1) change = 1; wifigecko = change; break; case 2: change = newrevtext; change++; if(change > 1) change = 1; newrevtext = change; break; } HaltResumeGui(); } if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT) || PAD_ButtonsDown(0) & PAD_BUTTON_LEFT) { change = 0; switch (ret) { case 0: change = network; change--; if(change < 0) change = 0; network = change; break; case 1: change = wifigecko; change--; if(change < 0) change = 0; wifigecko = change; break; case 2: change = newrevtext; change--; if(change < 0) change = 0; newrevtext = change; break; } HaltResumeGui(); } if(change != -1) { change = -1; if(network == 0) sprintf (options.value[0], tr("No")); else sprintf (options.value[0], tr("Yes")); if(wifigecko == 0) sprintf (options.value[1], tr("No")); else sprintf (options.value[1], tr("Yes")); if(newrevtext == 0) sprintf (options.value[2], tr("No")); else sprintf (options.value[2], tr("Yes")); optionBrowser.TriggerUpdate(); } if(optionBrowser.GetClickedOption() != -1) optionBrowser.TriggerUpdate(); if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) || PAD_ButtonsDown(0) & PAD_BUTTON_B) { if(focus == 0) { focus = 1; mainWindow->ChangeFocus(&w); } else { focus = 0; mainWindow->ChangeFocus(&optionBrowser); } HaltResumeGui(); } if(okBtn.GetState() == STATE_CLICKED) { Options.temp_last_setting = 1; if (Options.temp_network != network) { if(network == 1) { ResumeNetworkThread(); } else { HaltNetworkThread(); } } Options.temp_network = network; Options.temp_wifigecko = wifigecko; Options.temp_newrevtext = newrevtext; menu = MENU_SETTINGS_FILE; } if(backBtn.GetState() == STATE_CLICKED) { Options.temp_last_setting = 1; menu = MENU_SETTINGS_FILE; } if(runaway == true) { Options.temp_last_setting = 1; menu = MENU_SETTINGS_FILE; } } HaltGui(); mainWindow->Remove(&optionBrowser); mainWindow->Remove(&w); return menu; }
/**************************************************************************** * OnScreenKeyboard * * Opens an on-screen keyboard window, with the data entered being stored * into the specified variable. ***************************************************************************/ static void OnScreenKeyboard(char * var, u16 maxlen) { int save = -1; GuiKeyboard keyboard(var, maxlen); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM); GuiImageData btnOutline(xenon_button_png); GuiImageData btnOutlineOver(xenon_button_over_png); GuiTrigger trigA; // trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A); GuiText okBtnTxt("OK", 22, (GXColor) { 0, 0, 0, 255 }); GuiImage okBtnImg(&btnOutline); GuiImage okBtnImgOver(&btnOutlineOver); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetPosition(25, -25); okBtn.SetLabel(&okBtnTxt); okBtn.SetImage(&okBtnImg); okBtn.SetImageOver(&okBtnImgOver); okBtn.SetSoundOver(&btnSoundOver); okBtn.SetTrigger(&trigA); okBtn.SetEffectGrow(); GuiText cancelBtnTxt("Cancel", 22, (GXColor) { 0, 0, 0, 255 }); GuiImage cancelBtnImg(&btnOutline); GuiImage cancelBtnImgOver(&btnOutlineOver); GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); cancelBtn.SetPosition(-25, -25); cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetImage(&cancelBtnImg); cancelBtn.SetImageOver(&cancelBtnImgOver); cancelBtn.SetSoundOver(&btnSoundOver); cancelBtn.SetTrigger(&trigA); cancelBtn.SetEffectGrow(); keyboard.Append(&okBtn); keyboard.Append(&cancelBtn); HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&keyboard); mainWindow->ChangeFocus(&keyboard); ResumeGui(); while (save == -1) { UGUI(); usleep(THREAD_SLEEP); if (okBtn.GetState() == STATE_CLICKED) save = 1; else if (cancelBtn.GetState() == STATE_CLICKED) save = 0; } if (save) { snprintf(var, maxlen, "%s", keyboard.kbtextstr); } HaltGui(); mainWindow->Remove(&keyboard); mainWindow->SetState(STATE_DEFAULT); ResumeGui(); }