Fix for event propagation in "single document" doc/view mode.

Ensure that the events still get to wxDocManager even when we are using the
single document mode in which a view can be directly associated with the
parent frame.

Closes #14314.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-05-07 15:07:28 +00:00
parent bc4185a458
commit 82dfe81b28

View File

@@ -2075,15 +2075,24 @@ bool wxDocParentFrameAnyBase::TryProcessEvent(wxEvent& event)
// already forwarded the event to wxDocManager, check for this:
if ( wxView* const view = m_docManager->GetAnyUsableView() )
{
// Notice that we intentionally don't use wxGetTopLevelParent() here
// because we want to check both for the case of a child "frame" (e.g.
// MDI child frame or notebook page) inside this TLW and a separate
// child TLW frame (as used in the SDI mode) here.
for ( wxWindow* win = view->GetFrame(); win; win = win->GetParent() )
wxWindow* win = view->GetFrame();
if ( win != m_frame )
{
if ( win == m_frame )
return false;
// Notice that we intentionally don't use wxGetTopLevelParent()
// here because we want to check both for the case of a child
// "frame" (e.g. MDI child frame or notebook page) inside this TLW
// and a separate child TLW frame (as used in the SDI mode) here.
for ( win = win->GetParent(); win; win = win->GetParent() )
{
if ( win == m_frame )
return false;
}
}
//else: This view is directly associated with the parent frame (which
// can happen in the so called "single" mode in which only one
// document can be opened and so is managed by the parent frame
// itself), there can be no child frame in play so we must forward
// the event to wxDocManager ourselves.
}
// But forward the event to wxDocManager ourselves if there are no views at