Only give capture to wxPopupTransientWindow child if it's the only one.

This removes the arbitrariness of using the first child which didn't make any
sense when the popup had several controls inside it, e.g. in wxRichToolTip
case this resulted in the mouse capture being given to wxStaticBitmap showing
the tooltip icon even though it didn't need it at all.

This probably doesn't really change the observable behaviour but seems more
logical.

See #15288.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-08-18 13:28:28 +00:00
parent 5f9e369af0
commit 60435227b1

View File

@ -265,8 +265,16 @@ void wxPopupTransientWindow::PopHandlers()
void wxPopupTransientWindow::Popup(wxWindow *winFocus) void wxPopupTransientWindow::Popup(wxWindow *winFocus)
{ {
// If we have a single child, we suppose that it must cover the entire
// popup window and hence we give the mouse capture to it instead of
// keeping it for ourselves.
//
// Notice that this works best for combobox-like popups which have a single
// control inside them and not so well for popups containing a single
// wxPanel with multiple children inside it but OTOH it does no harm in
// this case neither and we can't reliably distinguish between them.
const wxWindowList& children = GetChildren(); const wxWindowList& children = GetChildren();
if ( children.GetCount() ) if ( children.GetCount() == 1 )
{ {
m_child = children.GetFirst()->GetData(); m_child = children.GetFirst()->GetData();
} }