// may be called to terminate the dialog with the given return code
virtual void EndModal(int retCode);
+
+ static bool OSXHasModalDialogsOpen();
+ static void OSXBeginModalDialog();
+ static void OSXEndModalDialog();
// implementation
// --------------
info.theColor.color.rgb.red = currentColor.red ;
info.theColor.color.rgb.green = currentColor.green ;
info.theColor.color.rgb.blue = currentColor.blue ;
+ wxDialog::OSXBeginModalDialog();
err = NPickColor(&info);
+ wxDialog::OSXEndModalDialog();
if ((err == noErr) && info.newColorChosen)
{
currentColor.red = info.theColor.color.rgb.red ;
//
// Start the color panel modal loop
//
+ wxDialog::OSXBeginModalDialog();
NSModalSession session = [NSApp beginModalSessionForWindow:theColorPanel];
for (;;)
{
break;
}
[NSApp endModalSession:session];
+ wxDialog::OSXEndModalDialog();
//free up the memory for the delegates - we don't need them anymore
[theColorPanel setDelegate:nil];
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
if (err == noErr)
{
+ wxDialog::OSXBeginModalDialog();
err = NavDialogRun(dialog);
+ wxDialog::OSXEndModalDialog();
if ( err == noErr )
{
err = NavDialogGetReply(dialog, &reply);
SetupExtraControls(NavDialogGetWindow(dialog));
if (err == noErr)
+ {
+ wxDialog::OSXBeginModalDialog();
err = ::NavDialogRun(dialog);
+ wxDialog::OSXEndModalDialog();
+ }
// clean up filter related data, etc.
if (navFilterUPP)
if ( !FPIsFontPanelVisible() )
FPShowHideFontPanel();
#endif
+ wxDialog::OSXBeginModalDialog();
int retval = RunMixedFontDialog(this);
-
+ wxDialog::OSXEndModalDialog();
#if wxOSX_USE_CARBON
::RemoveEventHandler(handler);
#endif
// the color panel until the color panel closes, switching
// back to the font panel modal loop once it does close.
//
+ wxDialog::OSXBeginModalDialog();
do
{
//
//out of its modal loop because the color panel was
//opened) return the font panel modal loop
}while([theFPDelegate isClosed] == NO);
-
+ wxDialog::OSXEndModalDialog();
+
//free up the memory for the delegates - we don't need them anymore
[theFPDelegate release];
[theCPDelegate release];
{
DialogRef alertRef;
CreateStandardAlert( alertType, cfTitle, cfText, ¶m, &alertRef );
+ wxDialog::OSXBeginModalDialog();
RunStandardAlert( alertRef, NULL, &result );
+ wxDialog::OSXEndModalDialog();
}
else
{
OSErr err = noErr;
Boolean accepted;
wxOSXPrintData* nativeData = (wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData();
+ wxDialog::OSXBeginModalDialog();
err = PMSessionPrintDialog(nativeData->GetPrintSession(), nativeData->GetPrintSettings(),
nativeData->GetPageFormat(), &accepted );
+ wxDialog::OSXEndModalDialog();
if ((err == noErr) && !accepted)
{
OSErr err = noErr;
Boolean accepted;
+ wxDialog::OSXBeginModalDialog();
err = PMSessionPageSetupDialog( nativeData->GetPrintSession(), nativeData->GetPageFormat(),
&accepted );
+ wxDialog::OSXEndModalDialog();
if ((err == noErr) && !accepted)
{
#include "wx/osx/private.h"
-// Lists to keep track of windows, so we can disable/enable them
-// for modal dialogs
+static int s_openDialogs = 0;
+bool wxDialog::OSXHasModalDialogsOpen()
+{
+ return s_openDialogs > 0;
+}
+
+void wxDialog::OSXBeginModalDialog()
+{
+ s_openDialogs++;
+}
+
+void wxDialog::OSXEndModalDialog()
+{
+ wxASSERT_MSG( s_openDialogs > 0, "incorrect internal modal dialog count");
+ s_openDialogs--;
+}
-wxList wxModalDialogs;
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
wxModalEventLoop modalLoop(this);
m_eventLoop = &modalLoop;
+ wxDialog::OSXBeginModalDialog();
modalLoop.Run();
+ wxDialog::OSXEndModalDialog();
m_eventLoop = NULL;