X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..41ab357ed9b661d9bbc55c841420b323237dbc15:/src/mac/carbon/dialog.cpp diff --git a/src/mac/carbon/dialog.cpp b/src/mac/carbon/dialog.cpp index 9ec4ef5220..4f037becd7 100644 --- a/src/mac/carbon/dialog.cpp +++ b/src/mac/carbon/dialog.cpp @@ -9,9 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "dialog.h" -#endif +#include "wx/wxprec.h" #include "wx/dialog.h" #include "wx/utils.h" @@ -27,7 +25,6 @@ wxList wxModalDialogs; //wxList wxModelessWindows; // Frames and modeless dialogs extern wxList wxPendingDelete; -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) @@ -42,8 +39,6 @@ BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) EVT_CLOSE(wxDialog::OnCloseWindow) END_EVENT_TABLE() -#endif - void wxDialog::Init() { m_isModalStyle = false; @@ -61,7 +56,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, // All dialogs should really have this style style |= wxTAB_TRAVERSAL; - if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO|wxCANCEL) , name) ) + if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO /*|wxCANCEL*/) , name) ) return FALSE; return TRUE; @@ -113,7 +108,8 @@ void wxDialog::OnCharHook(wxKeyEvent& event) bool wxDialog::IsModal() const { - return m_isModalStyle; + return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast + // return m_isModalStyle; } @@ -136,7 +132,7 @@ bool wxDialog::Show(bool show) InitDialog(); } - if ( IsModal() ) + if ( m_isModalStyle ) { if ( show ) { @@ -163,6 +159,8 @@ void wxDialog::DoShowModal() wxModalDialogs.Append(this); + SetFocus() ; + #if TARGET_CARBON BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ; #else @@ -188,7 +186,7 @@ void wxDialog::DoShowModal() // Replacement for Show(TRUE) for modal dialogs - returns return code int wxDialog::ShowModal() { - if ( !IsModal() ) + if ( !m_isModalStyle ) { SetModal(TRUE); } @@ -201,8 +199,9 @@ int wxDialog::ShowModal() // dialogs and should work for both of them void wxDialog::EndModal(int retCode) { - SetReturnCode(retCode); - Show(FALSE); + SetReturnCode(retCode); + Show(FALSE); + SetModal(false); } // Standard buttons