reverting r74098, applying John's version, see #15008, #15765, #13841 will be backported if no regressions are discovered

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2013-12-20 16:03:13 +00:00
parent 0cf0dfae6b
commit 947a8734ac
3 changed files with 48 additions and 7 deletions

View File

@@ -26,6 +26,8 @@ public:
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
virtual bool Show(bool show = true);
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow)
};

View File

@@ -2070,19 +2070,16 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event)
void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
{
// On Mac, setting focus here leads to infinite recursion and eventually
// a crash due to the SetFocus call producing another event.
// Handle Mac in OnIdleEvent using m_resetFocus.
// On Mac, setting focus here led to infinite recursion so
// m_resetFocus is used as a guard
if ( event.GetEventType() == wxEVT_SET_FOCUS )
{
if ( GetTextCtrl() && !GetTextCtrl()->HasFocus() )
if ( !m_resetFocus && GetTextCtrl() && !GetTextCtrl()->HasFocus() )
{
#ifdef __WXMAC__
m_resetFocus = true;
#else
GetTextCtrl()->SetFocus();
#endif
m_resetFocus = false;
}
}
@@ -2438,10 +2435,28 @@ void wxComboCtrlBase::ShowPopup()
}
}
#ifdef __WXMAC__
bool wxComboCtrlBase::AnimateShow( const wxRect& rect, int WXUNUSED(flags) )
{
// Overridden AnimateShow() will call Raise() and ShowWithEffect() so do
// here to avoid duplication. Raise and Show are needed for some contained
// control's scrollbars, selection highlights, hit-test accuracy and popup
// close via left mousedown when the mouse is not over the parent app.
if ( GetPopupWindow() )
{
GetPopupWindow()->SetSize(rect);
GetPopupWindow()->Raise();
GetPopupWindow()->Show();
}
return true;
}
#else
bool wxComboCtrlBase::AnimateShow( const wxRect& WXUNUSED(rect), int WXUNUSED(flags) )
{
return true;
}
#endif
void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) )
{

View File

@@ -55,4 +55,28 @@ bool wxPopupWindow::Create(wxWindow *parent, int flags)
}
// under
bool wxPopupWindow::Show(bool show)
{
if ( !wxWindow::Show(show) )
return false;
if ( m_nowpeer && show)
m_nowpeer->ShowWithoutActivating();
else if ( m_nowpeer )
m_nowpeer->Show(false);
if ( show )
{
// because apps expect a size event to occur at this moment
wxSizeEvent event(GetSize() , m_windowId);
event.SetEventObject(this);
HandleWindowEvent(event);
}
return true;
}
#endif // #if wxUSE_POPUPWIN