X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f029f1d15b04dd70522008cdf105be87140fabc6..12b5f4b4d2d8a07962da7ba3b78c8c1ec2634a67:/src/common/combocmn.cpp diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 6ed975c8a8..89367d068b 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -757,18 +757,18 @@ IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl) void wxComboCtrlBase::Init() { - m_winPopup = (wxWindow *)NULL; - m_popup = (wxWindow *)NULL; + m_winPopup = NULL; + m_popup = NULL; m_popupWinState = Hidden; - m_btn = (wxWindow*) NULL; - m_text = (wxTextCtrl*) NULL; - m_popupInterface = (wxComboPopup*) NULL; + m_btn = NULL; + m_text = NULL; + m_popupInterface = NULL; - m_popupExtraHandler = (wxEvtHandler*) NULL; - m_textEvtHandler = (wxEvtHandler*) NULL; + m_popupExtraHandler = NULL; + m_textEvtHandler = NULL; #if INSTALL_TOPLEV_HANDLER - m_toplevEvtHandler = (wxEvtHandler*) NULL; + m_toplevEvtHandler = NULL; #endif m_mainCtrlWnd = this; @@ -892,7 +892,7 @@ wxComboCtrlBase::~wxComboCtrlBase() #if INSTALL_TOPLEV_HANDLER delete ((wxComboFrameEventHandler*)m_toplevEvtHandler); - m_toplevEvtHandler = (wxEvtHandler*) NULL; + m_toplevEvtHandler = NULL; #endif DestroyPopup(); @@ -1177,6 +1177,8 @@ bool wxComboCtrlBase::Enable(bool enable) m_btn->Enable(enable); if ( m_text ) m_text->Enable(enable); + + Refresh(); return true; } @@ -1220,8 +1222,8 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) } else { - if ( m_text ) m_text->SetToolTip( (wxToolTip*) NULL ); - if ( m_btn ) m_btn->SetToolTip( (wxToolTip*) NULL ); + if ( m_text ) m_text->SetToolTip( NULL ); + if ( m_btn ) m_btn->SetToolTip( NULL ); } } #endif // wxUSE_TOOLTIPS @@ -1233,16 +1235,15 @@ void wxComboCtrlBase::SetValidator(const wxValidator& validator) if ( textCtrl ) textCtrl->SetValidator( validator ); + else + wxControl::SetValidator( validator ); } wxValidator* wxComboCtrlBase::GetValidator() { wxTextCtrl* textCtrl = GetTextCtrl(); - if ( textCtrl ) - return textCtrl->GetValidator(); - - return wxControl::GetValidator(); + return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator(); } #endif // wxUSE_VALIDATORS @@ -1636,7 +1637,7 @@ void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent& event ) { // relay (some) mouse events to the popup if ( evtType == wxEVT_MOUSEWHEEL ) - m_popup->AddPendingEvent(event); + m_popup->GetEventHandler()->AddPendingEvent(event); } else if ( evtType ) event.Skip(); @@ -1787,10 +1788,10 @@ void wxComboCtrlBase::DestroyPopup() m_winPopup->Destroy(); } - m_popupExtraHandler = (wxEvtHandler*) NULL; - m_popupInterface = (wxComboPopup*) NULL; - m_winPopup = (wxWindow*) NULL; - m_popup = (wxWindow*) NULL; + m_popupExtraHandler = NULL; + m_popupInterface = NULL; + m_winPopup = NULL; + m_popup = NULL; } void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) @@ -1810,7 +1811,7 @@ void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) } else { - m_popup = (wxWindow*) NULL; + m_popup = NULL; } // This must be done after creation