Use wxSingleChoiceDialog to display a choice list

This commit is contained in:
Zane U. Ji 2012-09-04 22:03:07 +08:00
parent ca37b141d8
commit b5d4655986
1 changed files with 8 additions and 5 deletions

View File

@ -875,7 +875,7 @@ MyFrame::MyFrame (
&& wxTheApp->argc == 1 ) && wxTheApp->argc == 1 )
{ {
xercescSSE2Warning = wxMessageBox ( xercescSSE2Warning = wxMessageBox (
_ ("SSE2 is enabled in Xerces-C++ library. Xerces-C++ doesn't "\ _ ("SSE2 is enabled in Xerces-C++ library. Xerces-C++ didn't "\
"use them in a thread-safe way. It may cause program crashes "\ "use them in a thread-safe way. It may cause program crashes "\
"(segmentation faults).\n\n"\ "(segmentation faults).\n\n"\
"If it happens, please try compiling Xerces-C++ with SSE2 "\ "If it happens, please try compiling Xerces-C++ with SSE2 "\
@ -4068,11 +4068,14 @@ void MyFrame::OnCreateSchema ( wxCommandEvent& event )
return; return;
} }
int ret = wxMessageBox ( _("Create W3C schema?\n\nYes:\tW3C Schema\nNo:\tDTD"), const static wxString types[] = { _ ( "W3C Schema" ), _ ( "DTD" ) };
_("Schema type"), wxYES_NO | wxCANCEL | wxICON_QUESTION); const static wxString message = _ ( "Please choose a shema type");
if ( ret == wxCANCEL ) return; wxSingleChoiceDialog dlg ( this, message, _ ( "Schema type" ),
( int ) sizeof ( types ) / sizeof ( types[0] ), types );
int ret = dlg.ShowModal();
if ( ret == wxID_CANCEL ) return;
Grammar::GrammarType type = ( ret == wxYES ) ? Grammar::GrammarType type = ( dlg.GetSelection() == 0 ) ?
Grammar::SchemaGrammarType : Grammar::DTDGrammarType; Grammar::SchemaGrammarType : Grammar::DTDGrammarType;
std::auto_ptr<XmlSchemaGenerator> gen ( new XmlSchemaGenerator() ); std::auto_ptr<XmlSchemaGenerator> gen ( new XmlSchemaGenerator() );
const wxString &schema = gen->generate(type, doc->getFullFileName(), const wxString &schema = gen->generate(type, doc->getFullFileName(),