X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/acf2ac3757581e8d272d2bdb427a4fc0bbed4cf7..228146b08230df0b1d1e8c52783d9322ae74ad4a:/src/common/dlgcmn.cpp diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 26fa7ab530..d32ba91318 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -56,7 +56,8 @@ WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase) void wxDialogBase::Init() { m_returnCode = 0; - + m_affirmativeId = wxID_OK; + // the dialogs have this flag on by default to prevent the events from the // dialog controls from reaching the parent frame which is usually // undesirable and can lead to unexpected and hard to find bugs @@ -101,11 +102,11 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) switch ( text[pos] ) { case wxT('\n'): - if (!line.IsEmpty()) + if (!line.empty()) { wxStaticText *s = new wxStaticText( this, wxID_ANY, line ); box->Add( s ); - line = wxT(""); + line = wxEmptyString; } else { @@ -148,14 +149,14 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) pos = last_space; last_space = 0; - line = wxT(""); + line = wxEmptyString; } } } } // remaining text behind last '\n' - if (!line.IsEmpty()) + if (!line.empty()) { wxStaticText *s2 = new wxStaticText( this, wxID_ANY, line ); box->Add( s2 ); @@ -170,45 +171,64 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) wxSizer *wxDialogBase::CreateButtonSizer( long flags ) { +#ifdef __SMARTPHONE__ + wxDialog* dialog = (wxDialog*) this; + if (flags & wxOK){ + dialog->SetLeftMenu(wxID_OK); + } + + if (flags & wxCANCEL){ + dialog->SetRightMenu(wxID_CANCEL); + } + + if (flags & wxYES){ + dialog->SetLeftMenu(wxID_YES); + } + + if (flags & wxNO){ + dialog->SetLeftMenu(wxID_NO); + } + wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); + return sizer; +#else return CreateStdDialogButtonSizer( flags ); +#endif } wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) { wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer(); wxButton *ok = NULL; - wxButton *cancel = NULL; wxButton *yes = NULL; wxButton *no = NULL; - wxButton *help = NULL; - + if (flags & wxOK){ - ok = new wxButton(this, wxID_OK, _("OK")); - sizer->AddButton(ok); + ok = new wxButton(this, wxID_OK); + sizer->AddButton(ok); } - + if (flags & wxCANCEL){ - cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); - sizer->AddButton(cancel); + wxButton *cancel = new wxButton(this, wxID_CANCEL); + sizer->AddButton(cancel); } - + if (flags & wxYES){ - yes = new wxButton(this, wxID_YES, _("Yes")); - sizer->AddButton(yes); + yes = new wxButton(this, wxID_YES); + sizer->AddButton(yes); } - + if (flags & wxNO){ - no = new wxButton(this, wxID_NO, _("No")); - sizer->AddButton(no); + no = new wxButton(this, wxID_NO); + sizer->AddButton(no); } - + if (flags & wxHELP){ - help = new wxButton(this, wxID_HELP, _("Help")); - sizer->AddButton(help); + wxButton *help = new wxButton(this, wxID_HELP); + sizer->AddButton(help); } - - sizer->Finalise(); - + + sizer->Realize(); + if (flags & wxNO_DEFAULT) { if (no) @@ -230,6 +250,11 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) yes->SetFocus(); } } + + if (flags & wxOK) + SetAffirmativeId(wxID_OK); + else if (flags & wxYES) + SetAffirmativeId(wxID_YES); return sizer; }