// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "dialog.h"
#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#ifdef __VMS
#define XtDisplay XTDISPLAY
#define XtWindow XTWINDOW
void wxDialog::SetModal(bool flag)
{
- if ( flag )
+#ifdef __VMS
+#pragma message disable codcauunr
+#endif
+ if ( flag )
m_windowStyle |= wxDIALOG_MODAL ;
else
if ( m_windowStyle & wxDIALOG_MODAL )
wxModelessWindows.DeleteObject(this);
if (!flag)
wxModelessWindows.Append(this);
+#ifdef __VMS
+#pragma message enable codcauunr
+#endif
}
wxDialog::~wxDialog()
{
m_isBeingDeleted = TRUE;
+
delete m_eventLoop;
if (m_mainWidget)
{
XtUnmapWidget((Widget) m_mainWidget);
}
+
+ PreDestroy();
+ DoDestroy();
}
void wxDialog::DoDestroy()
bool wxDialog::Show( bool show )
{
- if( !wxTopLevelWindowMotif::Show( show ) )
- return FALSE;
+ if( !wxWindowBase::Show( show ) )
+ return false;
m_isShown = show;
else
XtUnmanageChild((Widget)m_mainWidget) ;
- XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
- XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
+ XFlush(XtDisplay((Widget)m_mainWidget));
+ XSync(XtDisplay((Widget)m_mainWidget), FALSE);
}
return TRUE;
Show(TRUE);
+ // after the event loop ran, the widget might already have been destroyed
+ WXDisplay* display = (WXDisplay*)XtDisplay( (Widget)m_mainWidget );
+
if (m_modalShowing)
return 0;
m_eventLoop = new wxEventLoop;
m_eventLoop->Run();
// Now process all events in case they get sent to a destroyed dialog
- XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
- while (m_eventLoop->Pending())
- {
- XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
- m_eventLoop->Dispatch();
- }
+ wxFlushEvents( display );
delete m_eventLoop;
m_eventLoop = NULL;
void wxDialog::ChangeBackgroundColour()
{
if (GetMainWidget())
- DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
+ wxDoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
}
void wxDialog::ChangeForegroundColour()
{
if (GetMainWidget())
- DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
+ wxDoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
}