]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dialog.cpp
Moved the cleanup code to an EVT_WINDOW_DESTROY handler.
[wxWidgets.git] / src / os2 / dialog.cpp
index c73062da3cdced61562b81068a9da4c212e342f5..eb635379c9397889fc060f65593ee8d60ef6634a 100644 (file)
@@ -35,7 +35,7 @@ wxWindowList wxModalDialogs;
 
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
 
-BEGIN_EVENT_TABLE(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)
@@ -49,7 +49,7 @@ void wxDialog::Init()
     m_pOldFocus = (wxWindow *)NULL;
     m_isShown = FALSE;
     m_pWindowDisabler = (wxWindowDisabler *)NULL;
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
 } // end of wxDialog::Init
 
 bool wxDialog::Create(
@@ -92,7 +92,13 @@ bool wxDialog::Create(
                                   ,rsName
                                  ))
         return FALSE;
-    SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+    SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+
+    //
+    // Must defer setting the title until after dialog is created and sized
+    //
+    if (!rsTitle.IsNull())
+        SetTitle(rsTitle);
     return TRUE;
 } // end of wxDialog::Create
 
@@ -194,7 +200,11 @@ void wxDialog::DoShowModal()
     //
     wxASSERT_MSG(!m_pWindowDisabler, _T("disabling windows twice?"));
 
-    m_pWindowDisabler = new wxWindowDisabler(this);
+    //
+    // Disables other app windows and window proc message processing
+    // until WinDismissDlg called
+    //
+    ::WinProcessDlg((HWND)GetHwnd());
 
     //
     // Enter the modal loop
@@ -237,7 +247,8 @@ bool wxDialog::Show(
         //
         // If we had disabled other app windows, reenable them back now because
         // if they stay disabled Windows will activate another window (one
-        // which is enabled, anyhow) and we will lose activation
+        // which is enabled, anyhow) and we will lose activation.  We really don't
+        // do this in OS/2 since PM does this for us.
         //
         if (m_pWindowDisabler)
         {
@@ -265,6 +276,8 @@ bool wxDialog::Show(
         InitDialog();
     }
 
+    if (GetTitle().c_str())
+        ::WinSetWindowText((HWND)GetHwnd(), GetTitle().c_str());
     if (IsModal())
     {
         if (bShow)
@@ -318,6 +331,7 @@ void wxDialog::EndModal(
 {
     SetReturnCode(nRetCode);
     Show(FALSE);
+    ::WinDismissDlg((HWND)GetHwnd(), nRetCode);
 } // end of wxDialog::EndModal
 
 // ----------------------------------------------------------------------------
@@ -392,7 +406,7 @@ void wxDialog::OnSysColourChanged(
   wxSysColourChangedEvent&          rEvent
 )
 {
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
     Refresh();
 } // end of wxDialog::OnSysColourChanged