supporting nested window disablers on the same window
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,7 +31,12 @@ protected:
|
|||||||
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
|
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
|
||||||
|
|
||||||
void* m_modalSession;
|
void* m_modalSession;
|
||||||
|
|
||||||
|
wxWindow* m_modalWindow;
|
||||||
|
|
||||||
WXWindow m_dummyWindow;
|
WXWindow m_dummyWindow;
|
||||||
|
|
||||||
|
int m_modalNestedLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_OSX_COCOA_EVTLOOP_H_
|
#endif // _WX_OSX_COCOA_EVTLOOP_H_
|
||||||
|
@@ -107,12 +107,15 @@ wxGUIEventLoop::wxGUIEventLoop()
|
|||||||
{
|
{
|
||||||
m_modalSession = nil;
|
m_modalSession = nil;
|
||||||
m_dummyWindow = nil;
|
m_dummyWindow = nil;
|
||||||
|
m_modalNestedLevel = 0;
|
||||||
|
m_modalWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGUIEventLoop::~wxGUIEventLoop()
|
wxGUIEventLoop::~wxGUIEventLoop()
|
||||||
{
|
{
|
||||||
wxASSERT( m_modalSession == nil );
|
wxASSERT( m_modalSession == nil );
|
||||||
wxASSERT( m_dummyWindow == nil );
|
wxASSERT( m_dummyWindow == nil );
|
||||||
|
wxASSERT( m_modalNestedLevel == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -309,6 +312,16 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow )
|
|||||||
{
|
{
|
||||||
WXWindow nsnow = nil;
|
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;
|
||||||
|
|
||||||
if ( modalWindow )
|
if ( modalWindow )
|
||||||
{
|
{
|
||||||
// we must show now, otherwise beginModalSessionForWindow does it but it
|
// we must show now, otherwise beginModalSessionForWindow does it but it
|
||||||
@@ -339,6 +352,11 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow )
|
|||||||
void wxGUIEventLoop::EndModalSession()
|
void wxGUIEventLoop::EndModalSession()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_modalSession != NULL, "no modal session active");
|
wxASSERT_MSG(m_modalSession != NULL, "no modal session active");
|
||||||
|
|
||||||
|
wxASSERT_MSG(m_modalNestedLevel > 0, "incorrect modal nesting level");
|
||||||
|
|
||||||
|
if ( --m_modalNestedLevel == 0 )
|
||||||
|
{
|
||||||
[NSApp endModalSession:(NSModalSession)m_modalSession];
|
[NSApp endModalSession:(NSModalSession)m_modalSession];
|
||||||
m_modalSession = nil;
|
m_modalSession = nil;
|
||||||
if ( m_dummyWindow )
|
if ( m_dummyWindow )
|
||||||
@@ -347,6 +365,7 @@ void wxGUIEventLoop::EndModalSession()
|
|||||||
m_dummyWindow = nil;
|
m_dummyWindow = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user