tracking open modal dialogs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,6 +62,10 @@ public:
|
||||
// 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
|
||||
// --------------
|
||||
|
||||
|
@@ -59,7 +59,9 @@ int wxColourDialog::ShowModal()
|
||||
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 ;
|
||||
|
@@ -141,6 +141,7 @@ int wxColourDialog::ShowModal()
|
||||
//
|
||||
// Start the color panel modal loop
|
||||
//
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
NSModalSession session = [NSApp beginModalSessionForWindow:theColorPanel];
|
||||
for (;;)
|
||||
{
|
||||
@@ -151,6 +152,7 @@ int wxColourDialog::ShowModal()
|
||||
break;
|
||||
}
|
||||
[NSApp endModalSession:session];
|
||||
wxDialog::OSXEndModalDialog();
|
||||
|
||||
//free up the memory for the delegates - we don't need them anymore
|
||||
[theColorPanel setDelegate:nil];
|
||||
|
@@ -88,7 +88,9 @@ int wxDirDialog::ShowModal()
|
||||
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
|
||||
if (err == noErr)
|
||||
{
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = NavDialogRun(dialog);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
if ( err == noErr )
|
||||
{
|
||||
err = NavDialogGetReply(dialog, &reply);
|
||||
|
@@ -541,7 +541,11 @@ int wxFileDialog::ShowModal()
|
||||
SetupExtraControls(NavDialogGetWindow(dialog));
|
||||
|
||||
if (err == noErr)
|
||||
{
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = ::NavDialogRun(dialog);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
}
|
||||
|
||||
// clean up filter related data, etc.
|
||||
if (navFilterUPP)
|
||||
|
@@ -257,8 +257,9 @@ int wxFontDialog::ShowModal()
|
||||
if ( !FPIsFontPanelVisible() )
|
||||
FPShowHideFontPanel();
|
||||
#endif
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
int retval = RunMixedFontDialog(this);
|
||||
|
||||
wxDialog::OSXEndModalDialog();
|
||||
#if wxOSX_USE_CARBON
|
||||
::RemoveEventHandler(handler);
|
||||
#endif
|
||||
|
@@ -453,6 +453,7 @@ int wxFontDialog::ShowModal()
|
||||
// the color panel until the color panel closes, switching
|
||||
// back to the font panel modal loop once it does close.
|
||||
//
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
do
|
||||
{
|
||||
//
|
||||
@@ -491,6 +492,7 @@ int wxFontDialog::ShowModal()
|
||||
//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];
|
||||
|
@@ -216,7 +216,9 @@ int wxMessageDialog::ShowModal()
|
||||
{
|
||||
DialogRef alertRef;
|
||||
CreateStandardAlert( alertType, cfTitle, cfText, ¶m, &alertRef );
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
RunStandardAlert( alertRef, NULL, &result );
|
||||
wxDialog::OSXEndModalDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -39,8 +39,10 @@ int wxMacPrintDialog::ShowModal()
|
||||
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)
|
||||
{
|
||||
@@ -80,8 +82,10 @@ int wxMacPageSetupDialog::ShowModal()
|
||||
OSErr err = noErr;
|
||||
Boolean accepted;
|
||||
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = PMSessionPageSetupDialog( nativeData->GetPrintSession(), nativeData->GetPageFormat(),
|
||||
&accepted );
|
||||
wxDialog::OSXEndModalDialog();
|
||||
|
||||
if ((err == noErr) && !accepted)
|
||||
{
|
||||
|
@@ -23,10 +23,23 @@
|
||||
|
||||
#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)
|
||||
|
||||
@@ -130,7 +143,9 @@ int wxDialog::ShowModal()
|
||||
wxModalEventLoop modalLoop(this);
|
||||
m_eventLoop = &modalLoop;
|
||||
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
modalLoop.Run();
|
||||
wxDialog::OSXEndModalDialog();
|
||||
|
||||
m_eventLoop = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user