BBString * bmx_wxgetsinglechoice(BBString * message, BBString * caption, BBArray * choices, wxWindow * parent, int x, int y, int centre, int width, int height) { if (parent) { return bbStringFromWxString(wxGetSingleChoice(wxStringFromBBString(message), wxStringFromBBString(caption), bbStringArrayTowxArrayStr(choices), parent, x, y, static_cast<bool>(centre), width, height)); } else { return bbStringFromWxString(wxGetSingleChoice(wxStringFromBBString(message), wxStringFromBBString(caption), bbStringArrayTowxArrayStr(choices), NULL, x, y, static_cast<bool>(centre), width, height)); } }
void DWeather::ChangeIceClick( wxCommandEvent& ) { const wxString opts[2] = { wxT("No"), wxT("Yes") }; wxString ws = wxGetSingleChoice( wxT("Ice on selected zone(s):"), wxT("HexTools"), 2, opts, this ); if ( ws.IsEmpty( ) ) return; int selection = listWZ->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); while ( selection >= 0 ) { _rivers_lakes_frozen[selection] = strcmp( ws.ToAscii( ), "Yes" ) == 0 ? TRUE : FALSE; listWZ->SetItem( selection, 2, strcmp( ws.ToAscii( ), "Yes" ) == 0 ? wxT("Yes") : wxT("No") ); #if 0 //int zone = selections + 11; // because choice is 0-based and WZs are 1-based if ( strcmp( ws.ToAscii( ), "Yes" ) == 0 ) { //Frozen[zone] = TRUE; Frozen[selections] = TRUE; listWZ->SetItem( selections, 2, wxT("Yes") ); } else { //Frozen[zone] = FALSE; Frozen[selections] = FALSE; listWZ->SetItem( selections, 2, wxT("No") ); } #endif selection = listWZ->GetNextItem( selection, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); } }
void PropEditCtrlXRCID::OnDetails() { wxString choices[] = {wxString(_T("-1")) #define stdID(id) , wxString(#id) stdID(wxID_OK) stdID(wxID_CANCEL) stdID(wxID_YES) stdID(wxID_NO) stdID(wxID_APPLY) stdID(wxID_HELP) stdID(wxID_HELP_CONTEXT) stdID(wxID_OPEN) stdID(wxID_CLOSE) stdID(wxID_NEW) stdID(wxID_SAVE) stdID(wxID_SAVEAS) stdID(wxID_REVERT) stdID(wxID_EXIT) stdID(wxID_UNDO) stdID(wxID_REDO) stdID(wxID_PRINT) stdID(wxID_PRINT_SETUP) stdID(wxID_PREVIEW) stdID(wxID_ABOUT) stdID(wxID_HELP_CONTENTS) stdID(wxID_HELP_COMMANDS) stdID(wxID_HELP_PROCEDURES) stdID(wxID_CUT) stdID(wxID_COPY) stdID(wxID_PASTE) stdID(wxID_CLEAR) stdID(wxID_FIND) stdID(wxID_DUPLICATE) stdID(wxID_SELECTALL) stdID(wxID_STATIC) stdID(wxID_FORWARD) stdID(wxID_BACKWARD) stdID(wxID_DEFAULT) stdID(wxID_MORE) stdID(wxID_SETUP) stdID(wxID_RESET) #undef stdID }; wxString s = wxGetSingleChoice(_("Choose from predefined IDs:"), _("XRCID"), 38/*sizeof choices*/, choices); if (!s) return; m_TextCtrl->SetValue(s); WriteValue(); EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); }
void DWeather::ChangeWeatherClick( wxCommandEvent& ) { wxString ws = wxGetSingleChoice( wxT("New weather for selected zone(s):"), wxT("HexTools"), 5, _weather_condition_string, this ); if ( ws.IsEmpty( ) ) return; int i = 0; int selection = listWZ->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); while ( selection >= 0 ) { #if 0 int zone = selections + 11; // because selection is zero based and zones are 1-based #endif for ( i = 0; i < 5; ++i ) // TODO: variable-ize this wx condition count if ( strcmp( _weather_condition_string[i].ToAscii( ), ws.ToAscii( ) ) == 0 ) { #if 0 Weather[zone] = i; #endif _weather_condition[selection] = i; listWZ->SetItem( selection, 1, _weather_condition_string[i] ); break; } selection = listWZ->GetNextItem( selection, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); } if ( i == 5 ) // TODO: variable-ize this wx condition count wxMessageBox( wxT("For some reason setting of the weather failed!"), wxT("HexTools"), wxOK | wxICON_HAND, this ); }
const wxString mmDialogs::selectLanguageDlg(wxWindow *parent, const wxString &langPath, bool verbose) { wxString lang; wxArrayString lang_files; wxFileName fn(langPath, ""); fn.AppendDir("en"); size_t cnt = wxDir::GetAllFiles(fn.GetPath(), &lang_files, "*.mo"); if (!cnt) { if (verbose) { wxString s = wxString::Format("Can't find language files (.mo) at \"%s\"", fn.GetPath()); wxMessageDialog dlg(parent, s, "Error", wxOK | wxICON_ERROR); dlg.ShowModal(); } return lang; } for (size_t i = 0; i < cnt; ++i) { wxFileName fname(lang_files[i]); lang_files[i] = fname.GetName().Left(1).Upper() + fname.GetName().SubString(1, fname.GetName().Len()); } lang_files.Sort(CaseInsensitiveCmp); lang = wxGetSingleChoice("Please choose language", "Languages", lang_files, parent); return lang.Lower(); }
void TestClassDlg::DoRefreshFunctions(bool repportError) { std::vector<TagEntryPtr> matches; // search m_tags for suitable name for(size_t i = 0; i < m_tags.size(); i++) { TagEntryPtr tag = m_tags.at(i); if(tag->GetName() == m_textCtrlClassName->GetValue()) { matches.push_back(tag); } } if(matches.empty()) { if(repportError) { wxMessageBox(_("Could not find match for class '") + m_textCtrlClassName->GetValue() + wxT("'"), _("CodeLite"), wxICON_WARNING | wxOK); } return; } wxString theClass; if(matches.size() == 1) { // single match we are good theClass = matches.at(0)->GetPath(); } else { // suggest the user a multiple choice wxArrayString choices; for(size_t i = 0; i < matches.size(); i++) { wxString option; TagEntryPtr t = matches.at(i); choices.Add(t->GetPath()); } theClass = wxGetSingleChoice(_("Select class:"), _("Select class:"), choices, this); } if(theClass.empty()) { // user clicked 'Cancel' return; } // get list of methods for the given path matches.clear(); m_manager->GetTagsManager()->TagsByScope(theClass, wxT("prototype"), matches, false, true); // populate the list control wxArrayString methods; for(size_t i = 0; i < matches.size(); i++) { TagEntryPtr t = matches.at(i); methods.Add(t->GetName() + t->GetSignature()); } m_checkListMethods->Clear(); m_checkListMethods->Append(methods); // check all items for(unsigned int idx = 0; idx < m_checkListMethods->GetCount(); idx++) { m_checkListMethods->Check(idx, true); } }
void PartitioningTreeCtrl::onadd_c(wxCommandEvent& event) { wxArrayString ac = ACTreeCtrl->get_CompArray(); wxString cid= wxGetSingleChoice("Choose the component", "Add Component",ac,this,-1, -1, TRUE,150, 200); Qedo::Implementation impl = ACTreeCtrl->get_Implementation(cid); wxString text="Component("; text.Append(cid); text.Append(")"); wxTreeItemId itemid = AppendItem(GetSelection(),text, TreeCtrlIcon_Folder,TreeCtrlIcon_FolderSelected,NULL); Expand(GetSelection()); Refresh(); ItemTyp itype; itype.itemid=itemid; itype.type=comp; itemtypes.push_back(itype); Comp c; c.idref=cid; c.impl=impl; c.link=ACTreeCtrl->getLink(cid); c.file_archive=ACTreeCtrl->getFilearchive(cid); c.itemid=itemid; comps.push_back(c); }
void IntegrateWiz::OnButton(wxCommandEvent& event) { switch (event.GetId()) { case special_from: { wxString choices[] = {wxT("Pi"), wxT("E"), _("Infinity"), _("- Infinity")}; wxString choice = wxGetSingleChoice(_("Select a constant"), _("Constant"), 4, choices, this); if (choice.Length()) { if (choice == wxT("Pi")) text_ctrl_3->SetValue(wxT("%pi")); else if (choice == wxT("E")) text_ctrl_3->SetValue(wxT("%e")); else if (choice == _("Infinity")) text_ctrl_3->SetValue(wxT("inf")); else if (choice == _("- Infinity")) text_ctrl_3->SetValue(wxT("minf")); } } break; case special_to: { wxString choices[] = {wxT("Pi"), wxT("E"), _("Infinity"), _("- Infinity")}; wxString choice = wxGetSingleChoice(_("Select a constant"), _("Constant"), 4, choices, this); if (choice.Length()) { if (choice == wxT("Pi")) text_ctrl_4->SetValue(wxT("%pi")); else if (choice == wxT("E")) text_ctrl_4->SetValue(wxT("%e")); else if (choice == _("Infinity")) text_ctrl_4->SetValue(wxT("inf")); else if (choice == _("- Infinity")) text_ctrl_4->SetValue(wxT("minf")); } } break; } }
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, const wxString *choices, int initialSelection, wxWindow *parent) { return wxGetSingleChoice(message, caption, n, choices, parent, wxDefaultCoord, wxDefaultCoord, true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, initialSelection); }
void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event ) { wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString, m_RegulatorList.GetRegList() ); if( name.IsEmpty() ) return; m_RegulatorList.Remove( name ); m_RegulatorListChanged = true; m_choiceRegulatorSelector->Clear(); m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() ); if( m_lastSelectedRegulatorName == name ) m_lastSelectedRegulatorName.Empty(); SelectLastSelectedRegulator(); }
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, const wxArrayString& aChoices, wxWindow *parent, int x, int y, bool centre, int width, int height) { wxString *choices; int n = ConvertWXArrayToC(aChoices, &choices); wxString res = wxGetSingleChoice(message, caption, n, choices, parent, x, y, centre, width, height); delete [] choices; return res; }
void SeriesWiz::OnButton(wxCommandEvent& event) { wxString choices[] = { wxT("Pi"), wxT("E") }; wxString choice = wxGetSingleChoice(_("Select a constant"), _("Constant"), 2, choices, this); if (choice.Length()) { if (choice == wxT("Pi")) text_ctrl_3->SetValue(wxT("%pi")); else if (choice == wxT("E")) text_ctrl_3->SetValue(wxT("%e")); } }
void CUnitPane::OnIdle(wxIdleEvent& event) { // Set sorting if (m_ColClicked>=0) { CListLayoutItem * p; int col = m_ColClicked; m_ColClicked = -1; p = (CListLayoutItem*)m_pLayout->At(col); if (p) { wxString choice, message=wxString::FromAscii(p->m_Caption), caption=wxT("Set sort order"); wxString choices[NUM_SORTS-1]; choices[0]=wxT("primary"); choices[1]=wxT("secondary"); choices[2]=wxT("tertiary"); choice = wxGetSingleChoice(message, caption, NUM_SORTS-1, choices, m_pParent); if (!choice.IsEmpty()) { int key; if (0==stricmp(choice.mb_str(), "primary")) key = 0; else if (0==stricmp(choice.mb_str(), "secondary")) key = 1; else key = 2; SetSortName(key, p->m_Name); Sort(); } } } //CListPane::OnIdle(event); event.Skip(); }
const wxString mmDialogs::selectLanguageDlg(wxWindow *parent, const wxString &langPath, bool verbose) { wxArrayString lang_files; wxFileName fn(langPath, ""); fn.AppendDir("en"); size_t cnt = wxDir::GetAllFiles(fn.GetPath(), &lang_files, "*.mo"); if (!cnt) { if (verbose) { wxString s = wxString::Format("Can't find language files (.mo) at \"%s\"", fn.GetPath()); wxMessageDialog dlg(parent, s, "Error", wxOK | wxICON_ERROR); dlg.ShowModal(); } return "english"; } int os_lang_id = wxLocale::GetSystemLanguage(); const wxString os_language_name = wxLocale::GetLanguageName(os_lang_id); int sel = 0; for (size_t i = 0; i < cnt; ++i) { wxFileName fname(lang_files[i]); lang_files[i] = fname.GetName().Capitalize(); //wxLogDebug("%s | %s | %s", lang_files[i], fname.GetFullName(), os_language_name); if (lang_files[i] == os_language_name) sel = i; } lang_files.Sort(CaseInsensitiveCmp); const wxString lang = wxGetSingleChoice("Please choose language", "Languages", lang_files, sel, parent); return lang.Lower(); }
bool NewBuildTab::DoSelectAndOpen(const wxDataViewItem& item) { if( item.IsOk() == false ) return false; m_listctrl->UnselectAll(); // Clear any selection m_listctrl->EnsureVisible(item); m_listctrl->Select(item); BuildLineInfo* bli = (BuildLineInfo*)m_listctrl->GetItemData(item); if( bli ) { wxFileName fn(bli->GetFilename()); if ( !fn.IsAbsolute() ) { std::vector<wxFileName> files; std::vector<wxFileName> candidates; ManagerST::Get()->GetWorkspaceFiles(files, true); for(size_t i=0; i<files.size(); ++i) { if( files.at(i).GetFullName() == fn.GetFullName() ) { candidates.push_back( files.at(i) ); } } if ( candidates.empty() ) return false; if ( candidates.size() == 1 ) fn = candidates.at(0); else { // prompt the user wxArrayString fileArr; for(size_t i=0; i<candidates.size(); ++i) { fileArr.Add( candidates.at(i).GetFullPath() ); } wxString selection = wxGetSingleChoice(_("Select a file to open:"), _("Choose a file"), fileArr); if(selection.IsEmpty()) return false; fn = wxFileName(selection); // if we resolved it now, open the file there is no point in searching this file // in m_buildInfoPerFile since the key on this map is kept as full name LEditor* editor = clMainFrame::Get()->GetMainBook()->FindEditor(fn.GetFullPath()); if ( !editor ) { editor = clMainFrame::Get()->GetMainBook()->OpenFile(fn.GetFullPath(), wxT(""), bli->GetLineNumber(), wxNOT_FOUND, OF_AddJump); } if ( editor ) { // We already got compiler markers set here, just goto the line clMainFrame::Get()->GetMainBook()->SelectPage( editor ); editor->GotoLine(bli->GetLineNumber()); SetActive(editor); return true; } } } if ( fn.IsAbsolute() ) { // try to locate the editor first LEditor* editor = clMainFrame::Get()->GetMainBook()->FindEditor(fn.GetFullPath()); if ( !editor ) { // Open it editor = clMainFrame::Get()->GetMainBook()->OpenFile(bli->GetFilename(), wxT(""), bli->GetLineNumber(), wxNOT_FOUND, OF_AddJump); } if ( editor ) { if ( !editor->HasCompilerMarkers()) MarkEditor( editor ); int lineNumber = bli->GetLineNumber(); if ( lineNumber > 0 ) { lineNumber --; } // We already got compiler markers set here, just goto the line clMainFrame::Get()->GetMainBook()->SelectPage( editor ); editor->GotoLine( bli->GetLineNumber() ); editor->ScrollToLine( bli->GetLineNumber() ); editor->EnsureVisible( lineNumber ); editor->EnsureCaretVisible(); SetActive(editor); return true; } } } return false; }