Correct HasFocus() to work with subwindows of a composite control.

When a subwindow (i.e. one that overrides GetMainWindowOfCompositeControl() to
return a parent window) has focus, HasFocus() should return true for it too,
in addition to returning true for the main window.

This completes the fix of r69788.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-11-28 19:15:57 +00:00
parent 4e2b91bb27
commit 202388d3bc

View File

@ -3328,7 +3328,9 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move)
bool wxWindowBase::HasFocus() const
{
return FindFocus() == this;
wxWindowBase* const win = DoFindFocus();
return win &&
(this == win || this == win->GetMainWindowOfCompositeControl());
}
// ----------------------------------------------------------------------------