]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dialog.cpp
reverted last commit, still broken for VC6
[wxWidgets.git] / src / msw / dialog.cpp
index 67f6fec03654f3dcfa533668a17d0af83f2321ac..32678cc5781d2020eda1385eefa72501c6f39e0b 100644 (file)
     #include <commdlg.h>
 #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