// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "dialog.h"
#endif
XtSetArg (args[0], XmNdefaultPosition, False);
XtSetArg (args[1], XmNautoUnmanage, False);
Widget dialogShell =
- XmCreateBulletinBoardDialog( parentWidget, (char*)name.c_str(),
+ XmCreateBulletinBoardDialog( parentWidget,
+ wxConstCast(name.c_str(), char),
args, 2);
m_mainWidget = (WXWidget) dialogShell;
wxDialog::~wxDialog()
{
m_isBeingDeleted = TRUE;
+
delete m_eventLoop;
if (m_mainWidget)
{
XtUnmapWidget((Widget) m_mainWidget);
}
+
+ PreDestroy();
+ DoDestroy();
}
void wxDialog::DoDestroy()
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);
}