// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "dialog.h"
-#endif
+#include "wx/wxprec.h"
#include "wx/dialog.h"
#include "wx/utils.h"
//wxList wxModelessWindows; // Frames and modeless dialogs
extern wxList wxPendingDelete;
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
-#endif
-
void wxDialog::Init()
{
m_isModalStyle = false;
// 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;
bool wxDialog::IsModal() const
{
- return m_isModalStyle;
+ return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
+ // return m_isModalStyle;
}
InitDialog();
}
- if ( IsModal() )
+ if ( m_isModalStyle )
{
if ( show )
{
wxModalDialogs.Append(this);
+ SetFocus() ;
+
#if TARGET_CARBON
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
#else
// Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal()
{
- if ( !IsModal() )
+ if ( !m_isModalStyle )
{
SetModal(TRUE);
}
// 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