]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/dialog.mm
Map between int page ids and page pointers using hashes so that it works when
[wxWidgets.git] / src / cocoa / dialog.mm
index e15c2937aa8eaaf96ba5c66f16fde91958dbeba7..352e7eb9230f4a207cfd22aaa6fce5c61124b184 100644 (file)
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
+
+#include "wx/dialog.h"
+
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/app.h"
-    #include "wx/dialog.h"
     #include "wx/settings.h"
 #endif //WX_PRECOMP
 
@@ -32,10 +34,10 @@ static wxWindowList wxModalDialogs;
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
 
 BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
-  EVT_BUTTON(wxID_OK, wxDialog::OnOK)
-  EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
-  EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
-  EVT_CLOSE(wxDialog::OnCloseWindow)
+    EVT_BUTTON(wxID_OK, wxDialog::OnOK)
+    EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
+    EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
+    EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
 WX_IMPLEMENT_COCOA_OWNER(wxDialog,NSPanel,NSWindow,NSWindow)
@@ -175,6 +177,14 @@ void wxDialog::EndModal(int retCode)
     Show(false);
 }
 
+void wxDialog::EndDialog(int retCode)
+{
+    if(IsModal())
+        EndModal(retCode);
+    else
+        Show(false);
+}
+
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // We'll send a Cancel message by default,
@@ -216,7 +226,7 @@ void wxDialog::OnOK(wxCommandEvent& event)
 {
     if ( Validate() && TransferDataFromWindow() )
     {
-        EndModal(wxID_OK);
+        EndDialog(wxID_OK);
     }
 }
 
@@ -230,6 +240,5 @@ void wxDialog::OnApply(wxCommandEvent& event)
 void wxDialog::OnCancel(wxCommandEvent& event)
 {
     wxLogTrace(wxTRACE_COCOA,wxT("Cancelled!"));
-    EndModal(wxID_CANCEL);
+    EndDialog(wxID_CANCEL);
 }
-