]> 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 5aee28f39c33adf77520e0a507c6a658b59aa451..32678cc5781d2020eda1385eefa72501c6f39e0b 100644 (file)
@@ -47,9 +47,9 @@
     #include <commdlg.h>
 #endif
 
-#ifdef __SMARTPHONE__
+#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
     #include "wx/msw/wince/resources.h"
-#endif // __SMARTPHONE__
+#endif // __SMARTPHONE__ && __WXWINCE__
 
 // ----------------------------------------------------------------------------
 // wxWin macros
@@ -110,15 +110,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
 #endif
 
 BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
-#ifdef __SMARTPHONE__
-    EVT_MENU(wxID_OK, wxDialog::OnOK)
-    EVT_MENU(wxID_APPLY, wxDialog::OnApply)
-    EVT_MENU(wxID_CANCEL, wxDialog::OnCancel)
-#else
     EVT_BUTTON(wxID_OK, wxDialog::OnOK)
     EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
     EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
-#endif
 
     EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
 
@@ -192,7 +186,7 @@ bool wxDialog::Create(wxWindow *parent,
 
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
 
-#ifdef __SMARTPHONE__
+#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
     SetLeftMenu(wxID_OK, _("OK"));
 #endif
 
@@ -212,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))
@@ -368,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();
 }
 
 // ----------------------------------------------------------------------------
@@ -380,7 +382,7 @@ void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
 {
   if ( Validate() && TransferDataFromWindow() )
   {
-      EndModal(wxID_OK);
+      EndDialog(wxID_OK);
   }
 }
 
@@ -394,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))