int Dialog::select(const String& heading, const std::vector<String>& list, int autoclose) throw (WindowException) { DelayedCallGuard dcguard(languageHook); const int window = WINDOW_DIALOG_SELECT; CGUIDialogSelect* pDialog= (CGUIDialogSelect*)g_windowManager.GetWindow(window); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); pDialog->Reset(); if (!heading.empty()) pDialog->SetHeading(heading); String listLine; for(unsigned int i = 0; i < list.size(); i++) { listLine = list[i]; pDialog->Add(listLine); } if (autoclose > 0) pDialog->SetAutoClose(autoclose); //send message and wait for user input XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW); return pDialog->GetSelectedLabel(); }
bool Dialog::ok(const String& heading, const String& line1, const String& line2, const String& line3) throw (WindowException) { DelayedCallGuard dcguard(languageHook); const int window = WINDOW_DIALOG_OK; CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(window); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); if (!heading.empty()) pDialog->SetHeading(heading); if (!line1.empty()) pDialog->SetLine(0, line1); if (!line2.empty()) pDialog->SetLine(1, line2); if (!line3.empty()) pDialog->SetLine(2, line3); //send message and wait for user input XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW); return pDialog->IsConfirmed(); }
bool Dialog::yesno(const String& heading, const String& line1, const String& line2, const String& line3, const String& nolabel, const String& yeslabel) throw (WindowException) { DelayedCallGuard dcguard(languageHook); const int window = WINDOW_DIALOG_YES_NO; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(window); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); // get lines, last 4 lines are optional. if (!heading.empty()) pDialog->SetHeading(heading); if (!line1.empty()) pDialog->SetLine(0, line1); if (!line2.empty()) pDialog->SetLine(1, line2); if (!line3.empty()) pDialog->SetLine(2, line3); if (!nolabel.empty()) pDialog->SetChoice(0,nolabel); if (!yeslabel.empty()) pDialog->SetChoice(1,yeslabel); //send message and wait for user input XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW); return pDialog->IsConfirmed(); }