X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..431a3edc641e379b8f5d6010220250017e99a3ff:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index a0fecfed09..90f30bb4f6 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -47,6 +47,10 @@ #include #endif +#ifdef __SMARTPHONE__ + #include "wx/msw/wince/resources.h" +#endif // __SMARTPHONE__ + // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- @@ -182,6 +186,10 @@ bool wxDialog::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); +#ifdef __SMARTPHONE__ + 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