X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b445b6a76eddacd5bab45c71f640dad672d83393..15495b26032c30a9edc07d30e18cfd0a4f207e86:/src/common/combocmn.cpp?ds=sidebyside diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index b5cd42e424..666049997d 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -140,7 +140,7 @@ class wxComboFrameEventHandler : public wxEvtHandler { public: wxComboFrameEventHandler( wxComboCtrlBase* pCb ); - ~wxComboFrameEventHandler(); + virtual ~wxComboFrameEventHandler(); void OnPopup(); @@ -191,7 +191,7 @@ void wxComboFrameEventHandler::OnIdle( wxIdleEvent& event ) { wxWindow* winFocused = ::wxWindow::FindFocus(); - wxWindow* popup = m_combo->GetPopupControl(); + wxWindow* popup = m_combo->GetPopupControl()->GetControl(); wxWindow* winpopup = m_combo->GetPopupWindow(); if ( @@ -386,7 +386,7 @@ void wxComboPopup::DefaultPaintComboControl( wxComboCtrlBase* combo, { if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl { - combo->DrawFocusBackground(dc,rect,0); + combo->PrepareBackground(dc,rect,0); dc.DrawText( combo->GetValue(), rect.x + combo->GetTextIndent(), @@ -438,7 +438,7 @@ public: { m_combo = combo; } - ~wxComboBoxExtraInputHandler() { } + virtual ~wxComboBoxExtraInputHandler() { } void OnKey(wxKeyEvent& event); void OnFocus(wxFocusEvent& event); @@ -510,7 +510,7 @@ public: m_combo = combo; m_beenInside = false; } - ~wxComboPopupExtraEventHandler() { } + virtual ~wxComboPopupExtraEventHandler() { } void OnMouseEvent( wxMouseEvent& event ); @@ -1036,8 +1036,9 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) // painting // ---------------------------------------------------------------------------- -// draw focus background on area in a way typical on platform -void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const +#if (!defined(__WXMSW__)) || defined(__WXUNIVERSAL__) +// prepare combo box background on area in a way typical on platform +void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const { wxSize sz = GetClientSize(); bool isEnabled; @@ -1106,7 +1107,19 @@ void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int fla dc.SetBrush( bgCol ); dc.SetPen( bgCol ); dc.DrawRectangle( selRect ); + + // Don't clip exactly to the selection rectangle so we can draw + // to the non-selected area in front of it. + wxRect clipRect(rect.x,rect.y, + (selRect.x+selRect.width)-rect.x,rect.height); + dc.SetClippingRegion(clipRect); +} +#else +// Save the library size a bit for platforms that re-implement this. +void wxComboCtrlBase::PrepareBackground( wxDC&, const wxRect&, int ) const +{ } +#endif void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg ) { @@ -1342,6 +1355,15 @@ bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, wxLongLong t = ::wxGetLocalTimeMillis(); int evtType = event.GetEventType(); +#if !USE_TRANSIENT_POPUP + if ( m_isPopupShown && + ( evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_RIGHT_DOWN ) ) + { + HidePopup(); + return true; + } +#endif + // // Generate our own double-clicks // (to allow on-focus dc-event on double-clicks instead of triple-clicks) @@ -1541,13 +1563,13 @@ void wxComboCtrlBase::CreatePopup() // Destroy popup window and the child control void wxComboCtrlBase::DestroyPopup() { + HidePopup(); + if ( m_popup ) m_popup->RemoveEventHandler(m_popupExtraHandler); delete m_popupExtraHandler; - HidePopup(); - delete m_popupInterface; if ( m_winPopup )