X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..1d6560d796aefb5dbdf217109767b1054c68c291:/src/msw/dialog.cpp?ds=sidebyside diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 67f6fec036..32678cc578 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -47,6 +47,10 @@ #include #endif +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) + #include "wx/msw/wince/resources.h" +#endif // __SMARTPHONE__ && __WXWINCE__ + // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- @@ -182,6 +186,10 @@ bool wxDialog::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) + SetLeftMenu(wxID_OK, _("OK")); +#endif + return true; } @@ -198,7 +206,7 @@ wxDialog::wxDialog(wxWindow *parent, { Init(); - Create(parent, -1, title, wxPoint(x, y), wxSize(w, h), style, name); + Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h), style, name); } void wxDialog::SetModal(bool WXUNUSED(flag)) @@ -354,7 +362,15 @@ void wxDialog::EndModal(int retCode) m_endModalCalled = true; SetReturnCode(retCode); - Show(false); + Hide(); +} + +void wxDialog::EndDialog(int rc) +{ + if ( IsModal() ) + EndModal(rc); + else + Hide(); } // ---------------------------------------------------------------------------- @@ -366,7 +382,7 @@ void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { if ( Validate() && TransferDataFromWindow() ) { - EndModal(wxID_OK); + EndDialog(wxID_OK); } } @@ -380,7 +396,7 @@ void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event)) void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - EndModal(wxID_CANCEL); + EndDialog(wxID_CANCEL); } void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) @@ -437,18 +453,28 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar #ifdef __WXWINCE__ // react to pressing the OK button in the title case WM_COMMAND: - if (LOWORD(wParam) == IDOK) + { + switch ( LOWORD(wParam) ) { - wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton); - if ( btn && btn->IsEnabled() ) - { - // if we do have a cancel button, do press it - btn->MSWCommand(BN_CLICKED, 0 /* unused */); - processed = true; +#ifndef __SMARTPHONE__ + case IDOK: + wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton); + if ( btn && btn->IsEnabled() ) + { + // if we do have a cancel button, do press it + btn->MSWCommand(BN_CLICKED, 0 /* unused */); + processed = true; + break; + } +#else // ifdef __SMARTPHONE__ + case IDM_LEFT: + case IDM_RIGHT: + processed = HandleCommand( LOWORD(wParam) , 0 , NULL ); break; - } +#endif // __SMARTPHONE__ } break; + } #endif case WM_CLOSE: // if we can't close, tell the system that we processed the