git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67866
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
void* m_modalSession;
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
void* m_modalSession;
+
+ wxWindow* m_modalWindow;
+
+
+ int m_modalNestedLevel;
};
#endif // _WX_OSX_COCOA_EVTLOOP_H_
};
#endif // _WX_OSX_COCOA_EVTLOOP_H_
{
m_modalSession = nil;
m_dummyWindow = nil;
{
m_modalSession = nil;
m_dummyWindow = nil;
+ m_modalNestedLevel = 0;
+ m_modalWindow = NULL;
}
wxGUIEventLoop::~wxGUIEventLoop()
{
wxASSERT( m_modalSession == nil );
wxASSERT( m_dummyWindow == nil );
}
wxGUIEventLoop::~wxGUIEventLoop()
{
wxASSERT( m_modalSession == nil );
wxASSERT( m_dummyWindow == nil );
+ wxASSERT( m_modalNestedLevel == 0 );
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow )
{
WXWindow nsnow = nil;
void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow )
{
WXWindow nsnow = nil;
+
+ if ( m_modalNestedLevel > 0 )
+ {
+ wxASSERT_MSG( m_modalWindow == modalWindow, "Nested Modal Sessions must be based on same window");
+ m_modalNestedLevel++;
+ return;
+ }
+
+ m_modalWindow = modalWindow;
+ m_modalNestedLevel = 1;
void wxGUIEventLoop::EndModalSession()
{
wxASSERT_MSG(m_modalSession != NULL, "no modal session active");
void wxGUIEventLoop::EndModalSession()
{
wxASSERT_MSG(m_modalSession != NULL, "no modal session active");
- [NSApp endModalSession:(NSModalSession)m_modalSession];
- m_modalSession = nil;
- if ( m_dummyWindow )
+
+ wxASSERT_MSG(m_modalNestedLevel > 0, "incorrect modal nesting level");
+
+ if ( --m_modalNestedLevel == 0 )
- [m_dummyWindow release];
- m_dummyWindow = nil;
+ [NSApp endModalSession:(NSModalSession)m_modalSession];
+ m_modalSession = nil;
+ if ( m_dummyWindow )
+ {
+ [m_dummyWindow release];
+ m_dummyWindow = nil;
+ }