allowing direct native tlw modal loops
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -98,7 +98,8 @@ class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
|
|||||||
class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop
|
class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxModalEventLoop(wxWindow *winModal);
|
wxModalEventLoop(wxWindow *modalWindow);
|
||||||
|
wxModalEventLoop(WXWindow modalNativeWindow);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoRun();
|
virtual void DoRun();
|
||||||
@@ -107,6 +108,7 @@ protected:
|
|||||||
|
|
||||||
// (in case) the modal window for this event loop
|
// (in case) the modal window for this event loop
|
||||||
wxNonOwnedWindow* m_modalWindow;
|
wxNonOwnedWindow* m_modalWindow;
|
||||||
|
WXWindow m_modalNativeWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -94,26 +94,39 @@ void wxGUIEventLoop::DoStop()
|
|||||||
QuitApplicationEventLoop();
|
QuitApplicationEventLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxModalEventLoop::wxModalEventLoop(wxWindow *winModal)
|
// TODO move into a evtloop_osx.cpp
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
|
||||||
{
|
{
|
||||||
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (winModal);
|
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
|
||||||
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = m_modalWindow->GetWXWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
|
||||||
|
{
|
||||||
|
m_modalWindow = NULL;
|
||||||
|
wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = modalNativeWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// END move into a evtloop_osx.cpp
|
||||||
|
|
||||||
void wxModalEventLoop::DoRun()
|
void wxModalEventLoop::DoRun()
|
||||||
{
|
{
|
||||||
wxMacAutoreleasePool autoreleasepool;
|
wxMacAutoreleasePool autoreleasepool;
|
||||||
WindowRef windowRef = m_modalWindow->GetWXWindow();
|
|
||||||
|
bool resetGroupParent = false;
|
||||||
|
|
||||||
WindowGroupRef windowGroup = NULL;
|
WindowGroupRef windowGroup = NULL;
|
||||||
WindowGroupRef formerParentGroup = NULL;
|
WindowGroupRef formerParentGroup = NULL;
|
||||||
bool resetGroupParent = false;
|
|
||||||
|
|
||||||
// make sure modal dialogs are in the right layer so that they are not covered
|
// make sure modal dialogs are in the right layer so that they are not covered
|
||||||
|
if ( m_modalWindow != NULL )
|
||||||
|
{
|
||||||
if ( m_modalWindow->GetParent() == NULL )
|
if ( m_modalWindow->GetParent() == NULL )
|
||||||
{
|
{
|
||||||
windowGroup = GetWindowGroup(windowRef) ;
|
windowGroup = GetWindowGroup(m_modalNativeWindow) ;
|
||||||
if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
|
if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
|
||||||
{
|
{
|
||||||
formerParentGroup = GetWindowGroupParent( windowGroup );
|
formerParentGroup = GetWindowGroupParent( windowGroup );
|
||||||
@@ -121,10 +134,11 @@ void wxModalEventLoop::DoRun()
|
|||||||
resetGroupParent = true;
|
resetGroupParent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_modalWindow->SetFocus();
|
m_modalWindow->SetFocus();
|
||||||
|
|
||||||
RunAppModalLoopForWindow(windowRef);
|
RunAppModalLoopForWindow(m_modalNativeWindow);
|
||||||
|
|
||||||
if ( resetGroupParent )
|
if ( resetGroupParent )
|
||||||
{
|
{
|
||||||
@@ -136,8 +150,7 @@ void wxModalEventLoop::DoRun()
|
|||||||
void wxModalEventLoop::DoStop()
|
void wxModalEventLoop::DoStop()
|
||||||
{
|
{
|
||||||
wxMacAutoreleasePool autoreleasepool;
|
wxMacAutoreleasePool autoreleasepool;
|
||||||
WindowRef theWindow = m_modalWindow->GetWXWindow();
|
QuitAppModalLoopForWindow(m_modalNativeWindow);
|
||||||
QuitAppModalLoopForWindow(theWindow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -175,12 +175,24 @@ void wxGUIEventLoop::DoStop()
|
|||||||
[NSApp stop:0];
|
[NSApp stop:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxModalEventLoop::wxModalEventLoop(wxWindow *winModal)
|
// TODO move into a evtloop_osx.cpp
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
|
||||||
{
|
{
|
||||||
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (winModal);
|
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
|
||||||
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = m_modalWindow->GetWXWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
|
||||||
|
{
|
||||||
|
m_modalWindow = NULL;
|
||||||
|
wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = modalNativeWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// END move into a evtloop_osx.cpp
|
||||||
|
|
||||||
void wxModalEventLoop::DoRun()
|
void wxModalEventLoop::DoRun()
|
||||||
{
|
{
|
||||||
wxMacAutoreleasePool pool;
|
wxMacAutoreleasePool pool;
|
||||||
@@ -197,8 +209,7 @@ void wxModalEventLoop::DoRun()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSWindow* theWindow = m_modalWindow->GetWXWindow();
|
[NSApp runModalForWindow:m_modalNativeWindow];
|
||||||
[NSApp runModalForWindow:theWindow];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxModalEventLoop::DoStop()
|
void wxModalEventLoop::DoStop()
|
||||||
|
@@ -97,12 +97,25 @@ void wxGUIEventLoop::DoRun()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxModalEventLoop::wxModalEventLoop(wxWindow *winModal)
|
// TODO move into a evtloop_osx.cpp
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
|
||||||
{
|
{
|
||||||
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (winModal);
|
m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
|
||||||
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = m_modalWindow->GetWXWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
|
||||||
|
{
|
||||||
|
m_modalWindow = NULL;
|
||||||
|
wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||||
|
m_modalNativeWindow = modalNativeWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// END move into a evtloop_osx.cpp
|
||||||
|
|
||||||
|
|
||||||
void wxModalEventLoop::DoRun()
|
void wxModalEventLoop::DoRun()
|
||||||
{
|
{
|
||||||
// presentModalViewController:animated:
|
// presentModalViewController:animated:
|
||||||
|
Reference in New Issue
Block a user